aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
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/emultempl
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/emultempl')
-rw-r--r--ld/emultempl/elf32.em10
1 files changed, 8 insertions, 2 deletions
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)