bfd/
authorAlan Modra <amodra@gmail.com>
Thu, 22 Apr 2010 01:51:01 +0000 (01:51 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 22 Apr 2010 01:51:01 +0000 (01:51 +0000)
* elf.c (assign_file_positions_for_load_sections): Revert 2008-05-29
change.  Tidy.  Don't error on sections not allocated in segment.
ld/testsuite/
* ld-elf/extract-symbol-1sec.d: Update lma.
* ld-i386/alloc.d: Expect a warning, not an error.

bfd/ChangeLog
bfd/elf.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/extract-symbol-1sec.d
ld/testsuite/ld-i386/alloc.d

index 5cd828953f88353ff9344fd2b573afc25e292d89..9fedd11f92814345c2eed82c09606f22fb7c74ea 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-22  Alan Modra  <amodra@gmail.com>
+
+       * elf.c (assign_file_positions_for_load_sections): Revert 2008-05-29
+       change.  Tidy.  Don't error on sections not allocated in segment.
+
 2010-04-15  Andrew Haley  <aph@redhat.com>
 
        * bfd-in.h (elf32_arm_fix_exidx_coverage): Add new flag:
index bcd238d6216b813385d2da0a6bbe81c46fea4f80..0ffc2d0889596190a32f700af5e2383ee5060825 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4453,32 +4453,17 @@ assign_file_positions_for_load_sections (bfd *abfd,
                      && ((this_hdr->sh_flags & SHF_TLS) == 0
                          || p->p_type == PT_TLS))))
            {
-             bfd_signed_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
+             bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
 
-             if (sec->vma < p->p_vaddr + p->p_memsz)
+             if (sec->lma < p->p_paddr + p->p_memsz)
                {
                  (*_bfd_error_handler)
-                   (_("%B: section %A vma 0x%lx overlaps previous sections"),
-                    abfd, sec, (unsigned long) sec->vma);
+                   (_("%B: section %A lma 0x%lx overlaps previous sections"),
+                    abfd, sec, (unsigned long) sec->lma);
                  adjust = 0;
-               }
-             p->p_memsz += adjust;
-
-             if (p->p_paddr + p->p_memsz != sec->lma)
-               {
-                 /* This behavior is a compromise--ld has long
-                    silently changed the lma of sections when
-                    lma - vma is not equal for every section in a
-                    pheader--but only in the internal elf structures.
-                    Silently changing the lma is probably a bug, but
-                    changing it would have subtle and unknown
-                    consequences for existing scripts.
-
-                    Instead modify the bfd data structure to reflect
-                    what happened.  This at least fixes the values
-                    for the lma in the mapfile.  */
                  sec->lma = p->p_paddr + p->p_memsz;
                }
+             p->p_memsz += adjust;
 
              if (this_hdr->sh_type != SHT_NOBITS)
                {
@@ -4581,8 +4566,6 @@ assign_file_positions_for_load_sections (bfd *abfd,
                  (_("%B: section `%A' can't be allocated in segment %d"),
                   abfd, sec, j);
                print_segment_map (m);
-               bfd_set_error (bfd_error_bad_value);
-               return FALSE;
              }
          }
     }
index 3556c5bb4c35c9d176f9e10e0979285080292fbb..2239cf6ab66782ea941c07927268f79fe4a1d17c 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-22  Alan Modra  <amodra@gmail.com>
+
+       * ld-elf/extract-symbol-1sec.d: Update lma.
+       * ld-i386/alloc.d: Expect a warning, not an error.
+
 2010-04-20  Joseph Myers  <joseph@codesourcery.com>
 
        * ld-tic6x/data-reloc-global-rel.d,
index 8dac15bbe9c701935a2e1536cd0c03ffc03fc80a..57a56625b57fb7bd3c8082e30e992ab3b60be9ab 100644 (file)
@@ -8,7 +8,7 @@
 #...
 Sections:
  *Idx +Name +Size +VMA +LMA .*
- *0 +\.foo +0+ +0+10000 +0+ .*
+ *0 +\.foo +0+ +0+10000 +0+10000 .*
  *CONTENTS, ALLOC, LOAD, CODE
  *1 +\.bar +0+ +0+20000 +0+10000 .*
  *ALLOC, READONLY, CODE
index c2b22f2e004696e64065ded302d4f70106c38ace..72d8e91343c8fcde0e1ba82b5233085340546be6 100644 (file)
@@ -1,4 +1,4 @@
 #name: Invalid allocated section
 #as: --32
 #ld: -melf_i386 -T alloc.t
-#error: .*section `.foo' can't be allocated in segment 0.*
+#warning: .*section `.foo' can't be allocated in segment 0.*
This page took 0.032131 seconds and 4 git commands to generate.