aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-07-29 12:33:38 +0000
committerAlan Modra <amodra@gmail.com>2007-07-29 12:33:38 +0000
commit48f2ff543db37fece56b0a507427917e06dc1b66 (patch)
tree42c5d9ab72516a58170783ecb5e60c3e6f339ef9 /ld/emultempl
parentb112852a8fffee827c599246d59108f9ae4e2544 (diff)
downloadgdb-48f2ff543db37fece56b0a507427917e06dc1b66.zip
gdb-48f2ff543db37fece56b0a507427917e06dc1b66.tar.gz
gdb-48f2ff543db37fece56b0a507427917e06dc1b66.tar.bz2
ld/
* 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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em10
1 files changed, 9 insertions, 1 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 6261e1d..b82e087 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -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;