ld/
authorAlan Modra <amodra@gmail.com>
Sun, 29 Jul 2007 12:33:38 +0000 (12:33 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 29 Jul 2007 12:33:38 +0000 (12:33 +0000)
* ldlang.c (lang_insert_orphan): When searching through linker
script to place an orphan, don't stop on statements that appear
outside of SECTIONS.
* emultempl/elf32.em (output_rel_find): Prefer read-only alloc
sections over read/write alloc sections.
ld/testsuite/
* ld-elf/weak-dyn-1.rd: Adjust.

ld/ChangeLog
ld/emultempl/elf32.em
ld/ldlang.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/weak-dyn-1.rd

index 5741a841b4b3cf5606f0a603793b956f87cf2ea6..667125433c09d87674e1cd0bfe875fbef79e04dc 100644 (file)
@@ -1,3 +1,11 @@
+2007-07-29  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldlang.c (lang_insert_orphan): When searching through linker
+       script to place an orphan, don't stop on statements that appear
+       outside of SECTIONS.
+       * emultempl/elf32.em (output_rel_find): Prefer read-only alloc
+       sections over read/write alloc sections.
+
 2007-07-28  Jakub Jelinek  <jakub@redhat.com>
 
        * scripttempl/elf.sc: Add .note.gnu.build-id.
index 6261e1d617509758ab7ab81022e31c23c04c692b..b82e087b446d4cdef6f63b7d4cec1e6476ade97c 100644 (file)
@@ -1567,6 +1567,7 @@ output_rel_find (asection *sec, int isdyn)
   lang_output_section_statement_type *lookup;
   lang_output_section_statement_type *last = NULL;
   lang_output_section_statement_type *last_alloc = NULL;
+  lang_output_section_statement_type *last_ro_alloc = NULL;
   lang_output_section_statement_type *last_rel = NULL;
   lang_output_section_statement_type *last_rel_alloc = NULL;
   int rela = sec->name[4] == 'a';
@@ -1601,7 +1602,11 @@ output_rel_find (asection *sec, int isdyn)
       last = lookup;
       if (lookup->bfd_section != NULL
          && (lookup->bfd_section->flags & SEC_ALLOC) != 0)
-       last_alloc = lookup;
+       {
+         last_alloc = lookup;
+         if ((lookup->bfd_section->flags & SEC_READONLY) != 0)
+           last_ro_alloc = lookup;
+       }
     }
 
   if (last_rel_alloc)
@@ -1610,6 +1615,9 @@ output_rel_find (asection *sec, int isdyn)
   if (last_rel)
     return last_rel;
 
+  if (last_ro_alloc)
+    return last_ro_alloc;
+
   if (last_alloc)
     return last_alloc;
 
index ecc0dad9640b69bff68831bf805b50d6064ed274..decfc5f77b359f5c67f61104709c9c2fd8387570 100644 (file)
@@ -1654,13 +1654,14 @@ lang_insert_orphan (asection *s,
                    case lang_output_section_statement_enum:
                      if (assign != NULL)
                        where = assign;
+                     break;
                    case lang_input_statement_enum:
                    case lang_address_statement_enum:
                    case lang_target_statement_enum:
                    case lang_output_statement_enum:
                    case lang_group_statement_enum:
                    case lang_afile_asection_pair_statement_enum:
-                     break;
+                     continue;
                    }
                  break;
                }
index 9e58f02645b8a0afc8d87f3f9c14a2da1153e79a..ffa18f0f7b4530f4c0d3415bc859f310fea3d900 100644 (file)
@@ -1,3 +1,7 @@
+2007-07-29  Alan Modra  <amodra@bigpond.net.au>
+
+       * ld-elf/weak-dyn-1.rd: Adjust.
+
 2007-07-25  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * ld-cdtest/cdtest-foo.cc (strncpy): Fix parameter name.
index 169abd86edfcd32c5404f344c08f1bc3c3f4d1bd..ab5e0babe58fdd55f2f2dbd63214e57d7e886c32 100644 (file)
@@ -1,3 +1,3 @@
 #...
-0+800000 .* foo.*
+.* foo.*
 #pass