aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-xtensa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-02-24 11:38:57 +1030
committerAlan Modra <amodra@gmail.com>2024-02-24 14:59:13 +1030
commit086c8f406d82ce171d5867eed93f1308e07252c5 (patch)
tree2968d0a88337f90ddaea4a91a929810fca35a6e7 /gas/config/tc-xtensa.c
parentbc45bfd25984a709dec4236daf412c58a127633a (diff)
downloadbinutils-086c8f406d82ce171d5867eed93f1308e07252c5.zip
binutils-086c8f406d82ce171d5867eed93f1308e07252c5.tar.gz
binutils-086c8f406d82ce171d5867eed93f1308e07252c5.tar.bz2
PR25333, GAS is slow processing -fdebug-types-sections
gas needs to build lists of sections for each group. This arranges to build the lists earlier, so they can be used when looking for sections that belong to a group. Using the section hash table to find sections by name, then by group isn't efficient when there are numerous groups with the same section names. Using a hash table to quickly find a group, then searching by section name on a list for the group results in a 100-fold speed improvement assembling the testcase in this PR. To reduce the number of times we traverse the section list, the patch also moves some processing done in elf_adjust_symtab for linked-to section, to elf_frob_file. This requires a testsuite change because processing will stop before elf_frob_file if there is a parse error in section21.s, ie. you'll only get the "junk at end of line" error, not the "undefined linked-to symbol" errors. PR 25333 * config/obj-elf.c (struct group_list, groups): Move earlier. (match_section): New function, extracted from.. (get_section_by_match): ..here. (free_section_idx): Move earlier. (group_section_find, group_section_insert): New functions. (change_section): Use the above. (elf_set_group_name): New function. (obj_elf_attach_to_group): Use elf_set_group_name. (set_additional_section_info): Handle linked_to_symbol_name and stabs code, extracted from.. (adjust_stab_sections): ..here,.. (build_additional_section_info): ..and here. (elf_adjust_symtab): Don't call build_additional_section_info. (elf_frob_file): Adjust. * config/obj-elf.h (elf_set_group_name): Declare. * config/tc-xtensa.c (cache_literal_section): Use elf_set_group_name. (xtensa_make_property_section): Likewise. * testsuite/gas/elf/attach-1.d: Stricter group section matching, and changed group section ordering. * testsuite/gas/elf/attach-2.d: Stricter group section matching. * testsuite/gas/elf/attach-2.s: Provide section bar type. * testsuite/gas/elf/elf.exp: Run attach-2. * testsuite/gas/elf/section21.l: Update. * testsuite/gas/elf/section21.s: Don't check for a parse error.
Diffstat (limited to 'gas/config/tc-xtensa.c')
-rw-r--r--gas/config/tc-xtensa.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 188715d..e051bb9 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -11718,10 +11718,11 @@ cache_literal_section (bool use_abs_literals)
| (linkonce ? (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD) : 0)
| (use_abs_literals ? SEC_DATA : SEC_CODE));
- elf_group_name (seg) = group_name;
-
bfd_set_section_flags (seg, flags);
bfd_set_section_alignment (seg, 2);
+
+ if (group_name)
+ elf_set_group_name (seg, group_name);
}
*pcached = seg;
@@ -11813,7 +11814,8 @@ xtensa_make_property_section (asection *sec, const char *base_name)
if (! prop_sec)
return 0;
- elf_group_name (prop_sec) = elf_group_name (sec);
+ if (elf_group_name (sec))
+ elf_set_group_name (prop_sec, elf_group_name (sec));
}
free (prop_sec_name);