Special handling of AIX xcoff text alignment fix.
authorTom Rix <trix@redhat.com>
Thu, 20 Dec 2001 21:29:21 +0000 (21:29 +0000)
committerTom Rix <trix@redhat.com>
Thu, 20 Dec 2001 21:29:21 +0000 (21:29 +0000)
bfd/ChangeLog
bfd/coffcode.h

index 223f350b861f6ed9370524846a1513043e34dd81..a81b0b31141da7029aa15a1750f8f647f40a27a8 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-20  Tom Rix  <trix@redhat.com>
+
+       * coffcode.h (coff_compute_section_file_positions): Add special AIX 
+       loader alignment of text section.
+
 2001-12-20  Jason Thorpe  <thorpej@wasabisystems.com>
        
        * config.bfd (mips-dec-netbsd*): Delete alias for mips*el-*-netbsd*.
index d759115be0af5dd8fe3dfe771a8ce0c2cd898608..b5bd4429c779b8726c93bf99a138aac41f9a2f9e 100644 (file)
@@ -3054,7 +3054,36 @@ coff_compute_section_file_positions (abfd)
             padding the previous section up if necessary */
 
          old_sofar = sofar;
-         sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+#ifdef RS6000COFF_C
+         /* AIX loader checks the text section alignment of (vma - filepos)
+            So even though the filepos may be aligned wrt the o_algntext, for
+            AIX executables, this check fails. This shows up when an native 
+            AIX executable is stripped with gnu strip because the default vma
+            of native is 0x10000150 but default for gnu is 0x10000140.  Gnu
+            stripped gnu excutable passes this check because the filepos is 
+            0x0140. */
+         if (!strcmp (current->name, _TEXT)) 
+           {
+             bfd_vma pad;
+             bfd_vma align;
+
+             sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+
+             align = 1 << current->alignment_power;
+             pad = abs (current->vma - sofar) % align;
+             
+             if (pad) 
+               {
+                 pad = align - pad;
+                 sofar += pad;
+               }
+           }
+         else
+#else
+           {
+             sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+           }
+#endif
          if (previous != (asection *) NULL)
            {
              previous->_raw_size += sofar - old_sofar;
This page took 0.029652 seconds and 4 git commands to generate.