aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-07-23 16:32:53 +0000
committerNick Clifton <nickc@redhat.com>2004-07-23 16:32:53 +0000
commit9f61903d7388315e3d7b83a7e7c5ce1e30ab5ed3 (patch)
treeeb9ce7ffc8685e78e7cdb117bc7a842409d790e6 /ld
parent60ee6567b0c7fa9bda75eff0206406d36b23294b (diff)
downloadgdb-9f61903d7388315e3d7b83a7e7c5ce1e30ab5ed3.zip
gdb-9f61903d7388315e3d7b83a7e7c5ce1e30ab5ed3.tar.gz
gdb-9f61903d7388315e3d7b83a7e7c5ce1e30ab5ed3.tar.bz2
(_place_orphan): Use an already existing section name if that section does not
have any flags set.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/elf32.em10
-rw-r--r--ld/ldlang.c1
3 files changed, 14 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 25aa0a0..16ff5a6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-23 Nick Clifton <nickc@redhat.com>
+
+ * emultempl/elf32.em (_place_orphan): Use an already existing
+ section name if that section does not have any flags set.
+
2004-07-21 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (already_linked_hash_entry): Removed.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 469f054..1956fd5 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1175,8 +1175,10 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
lang_statement_union_type **os_tail;
etree_type *load_base;
int isdyn = 0;
+ asection *sec;
secname = bfd_get_section_name (s->owner, s);
+
if (! link_info.relocatable
&& link_info.combreloc
&& (s->flags & SEC_ALLOC)
@@ -1260,8 +1262,12 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
- loadable or allocatable characteristics. */
- if (bfd_get_section_by_name (output_bfd, secname) != NULL)
+ loadable or allocatable characteristics. But if the section
+ already exists but does not have any flags set, then it has been
+ been created by the linker, probably as a result of a --section-start
+ command line switch. */
+ if ((sec = bfd_get_section_by_name (output_bfd, secname)) != NULL
+ && bfd_get_section_flags (output_bfd, sec) != 0)
{
secname = bfd_get_unique_section_name (output_bfd, secname, &count);
if (secname == NULL)
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 6cc05a6..8c6ebaf 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -612,6 +612,7 @@ lang_output_section_find_1 (const char *const name, int constraint)
for (u = lang_output_section_statement.head; u != NULL; u = lookup->next)
{
lookup = &u->output_section_statement;
+
if (strcmp (name, lookup->name) == 0
&& lookup->constraint != -1
&& (constraint == 0 || constraint == lookup->constraint))