aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-09-05 03:05:19 +0000
committerAlan Modra <amodra@gmail.com>2000-09-05 03:05:19 +0000
commita854a4a7c88688b3af121aa1a41577476904a197 (patch)
tree246b977be0476aab699f8b88aeeca4e1f6ddef01 /ld/emultempl
parent1bd916895e07d6a81e774e50c4a8d95ae3ee51dc (diff)
downloadbinutils-a854a4a7c88688b3af121aa1a41577476904a197.zip
binutils-a854a4a7c88688b3af121aa1a41577476904a197.tar.gz
binutils-a854a4a7c88688b3af121aa1a41577476904a197.tar.bz2
--split-by-reloc, --split-by-file extensions. --unique option.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em44
1 files changed, 16 insertions, 28 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index b6e9856..e8be9cf 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1012,22 +1012,27 @@ gld${EMULATION_NAME}_place_orphan (file, s)
lang_statement_list_type *old = NULL;
lang_statement_list_type add;
etree_type *address;
- const char *secname, *ps = NULL;
+ const char *secname;
const char *outsecname;
+ const char *ps = NULL;
lang_output_section_statement_type *os;
secname = bfd_get_section_name (s->owner, s);
- /* Look through the script to see where to place this section. */
- os = lang_output_section_find (secname);
-
- if (os != NULL
- && os->bfd_section != NULL
- && ((s->flags ^ os->bfd_section->flags) & (SEC_LOAD | SEC_ALLOC)) == 0)
+ if (! config.unique_orphan_sections)
{
- /* We have already placed a section with this name. */
- wild_doit (&os->children, s, os, file);
- return true;
+ /* Look through the script to see where to place this section. */
+ os = lang_output_section_find (secname);
+
+ if (os != NULL
+ && os->bfd_section != NULL
+ && ((s->flags ^ os->bfd_section->flags)
+ & (SEC_LOAD | SEC_ALLOC)) == 0)
+ {
+ /* We have already placed a section with this name. */
+ wild_doit (&os->children, s, os, file);
+ return true;
+ }
}
if (hold_text.os == NULL)
@@ -1087,24 +1092,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
loadable or allocateable characteristics. */
outsecname = secname;
if (bfd_get_section_by_name (output_bfd, outsecname) != NULL)
- {
- unsigned int len;
- char *newname;
- unsigned int i;
-
- len = strlen (outsecname);
- newname = xmalloc (len + 5);
- strcpy (newname, outsecname);
- i = 0;
- do
- {
- sprintf (newname + len, "%d", i);
- ++i;
- }
- while (bfd_get_section_by_name (output_bfd, newname) != NULL);
-
- outsecname = newname;
- }
+ outsecname = bfd_get_unique_section_name (output_bfd, outsecname, NULL);
if (place != NULL)
{