diff options
author | Guy Martin <gmsoft@tuxicoman.be> | 2014-01-20 14:16:16 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-01-20 14:21:36 +1030 |
commit | 24ef1aa73ed312282bd1a755b3ac94681c9f1544 (patch) | |
tree | d16b770019d07c69d750fe0f8252cf00db9c3157 /ld/emultempl | |
parent | d7c85de1c3d15d7abf68212e4b18cd140dd3f397 (diff) | |
download | gdb-24ef1aa73ed312282bd1a755b3ac94681c9f1544.zip gdb-24ef1aa73ed312282bd1a755b3ac94681c9f1544.tar.gz gdb-24ef1aa73ed312282bd1a755b3ac94681c9f1544.tar.bz2 |
Fix duplicate output section statement lookup
Tie output section statements to their associated output section via
output section userdata. This allows us to avoid hash lookups which
are slower and fail when multiple output sections have the same name.
* ldlang.h (lang_output_section_get): Define.
* ldlang.c (lang_output_section_get): Likewise.
(init_os): Set the output_section userdata to the output
section statement.
* emultempl/hppaelf.em: Use lang_output_section_get instead of
lang_output_section_find where applicable.
* emultempl/aarch64elf.em: Likewise.
* emultempl/aix.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/aarch64elf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/aix.em | 2 | ||||
-rw-r--r-- | ld/emultempl/armelf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/hppaelf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/m68hc1xelf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/metagelf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/mipself.em | 5 | ||||
-rw-r--r-- | ld/emultempl/ppc64elf.em | 4 | ||||
-rw-r--r-- | ld/emultempl/spuelf.em | 5 |
9 files changed, 11 insertions, 25 deletions
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em index b3279bf..b631feb 100644 --- a/ld/emultempl/aarch64elf.em +++ b/ld/emultempl/aarch64elf.em @@ -159,7 +159,6 @@ elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name, asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -173,8 +172,7 @@ elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name, bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3); output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); info.input_section = input_section; lang_list_init (&info.add); diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 084bb66..d080133 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -854,7 +854,7 @@ gld${EMULATION_NAME}_before_allocation (void) /* Remove this section from the list of the output section. This assumes we know what the script looks like. */ is = NULL; - os = lang_output_section_find (sec->output_section->name); + os = lang_output_section_get (sec->output_section); if (os == NULL) einfo ("%P%F: can't find output section %s\n", sec->output_section->name); diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index eee6af1..85e924f 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -189,7 +189,6 @@ elf32_arm_add_stub_section (const char * stub_sec_name, asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -203,8 +202,7 @@ elf32_arm_add_stub_section (const char * stub_sec_name, bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power); output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); info.input_section = input_section; lang_list_init (&info.add); diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em index 65c1ea5..1b7e384 100644 --- a/ld/emultempl/hppaelf.em +++ b/ld/emultempl/hppaelf.em @@ -178,7 +178,6 @@ hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section) asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -190,8 +189,7 @@ hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section) goto err_ret; output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); info.input_section = input_section; lang_list_init (&info.add); diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em index 594b193..4e1360f 100644 --- a/ld/emultempl/m68hc1xelf.em +++ b/ld/emultempl/m68hc1xelf.em @@ -250,7 +250,6 @@ m68hc11elf_add_stub_section (const char *stub_sec_name, asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -262,8 +261,7 @@ m68hc11elf_add_stub_section (const char *stub_sec_name, goto err_ret; output_section = tramp_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); /* Try to put the new section at the same place as an existing .tramp section. Such .tramp section exists in most cases and diff --git a/ld/emultempl/metagelf.em b/ld/emultempl/metagelf.em index 21e3e94..7760f81 100644 --- a/ld/emultempl/metagelf.em +++ b/ld/emultempl/metagelf.em @@ -154,7 +154,6 @@ metagelf_add_stub_section (const char *stub_sec_name, asection *input_section) asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -166,8 +165,7 @@ metagelf_add_stub_section (const char *stub_sec_name, asection *input_section) goto err_ret; output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); info.input_section = input_section; lang_list_init (&info.add); diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em index 3c6ec9f..02043b7 100644 --- a/ld/emultempl/mipself.em +++ b/ld/emultempl/mipself.em @@ -136,7 +136,6 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section, { asection *stub_sec; flagword flags; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -176,9 +175,7 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section, if (!bfd_set_section_flags (stub_bfd, stub_sec, flags)) goto err_ret; - /* Create an output section statement. */ - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); /* Initialize a statement list that contains only the new statement. */ lang_list_init (&info.add); diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index f2085d7..c126297 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -378,7 +378,6 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section) asection *stub_sec; flagword flags; asection *output_section; - const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -392,8 +391,7 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section) goto err_ret; output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); - os = lang_output_section_find (secname); + os = lang_output_section_get (output_section); info.input_section = input_section; lang_list_init (&info.add); diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em index e14fa26..8feb8bf 100644 --- a/ld/emultempl/spuelf.em +++ b/ld/emultempl/spuelf.em @@ -138,8 +138,9 @@ spu_place_special_section (asection *s, asection *o, const char *output_name) lang_output_section_statement_type *os; if (o != NULL) - output_name = o->name; - os = lang_output_section_find (output_name); + os = lang_output_section_get (o); + else + os = lang_output_section_find (output_name); if (os == NULL) { os = gld${EMULATION_NAME}_place_orphan (s, output_name, 0); |