aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
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/testsuite
parentbc45bfd25984a709dec4236daf412c58a127633a (diff)
downloadgdb-086c8f406d82ce171d5867eed93f1308e07252c5.zip
gdb-086c8f406d82ce171d5867eed93f1308e07252c5.tar.gz
gdb-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/testsuite')
-rw-r--r--gas/testsuite/gas/elf/attach-1.d10
-rw-r--r--gas/testsuite/gas/elf/attach-2.d12
-rw-r--r--gas/testsuite/gas/elf/attach-2.s4
-rw-r--r--gas/testsuite/gas/elf/elf.exp1
-rw-r--r--gas/testsuite/gas/elf/section21.l2
-rw-r--r--gas/testsuite/gas/elf/section21.s7
6 files changed, 15 insertions, 21 deletions
diff --git a/gas/testsuite/gas/elf/attach-1.d b/gas/testsuite/gas/elf/attach-1.d
index 053783e..b6b76f5 100644
--- a/gas/testsuite/gas/elf/attach-1.d
+++ b/gas/testsuite/gas/elf/attach-1.d
@@ -3,9 +3,9 @@
#source: attach-1.s
#...
-group section \[ 1\] `\.group' \[foo\.group\] contains . sections:
+group section \[ 1\] `\.group' \[foo\.group\] contains [24] sections:
\[Index\] Name
- \[ .\] .*
- \[ .\] foo
-#pass
-
+.* foo
+.* (\.text|P)
+#?.* \.xt\.prop
+#?.* \.rela\.xt\.prop
diff --git a/gas/testsuite/gas/elf/attach-2.d b/gas/testsuite/gas/elf/attach-2.d
index 4aa5211..68a1aab 100644
--- a/gas/testsuite/gas/elf/attach-2.d
+++ b/gas/testsuite/gas/elf/attach-2.d
@@ -1,11 +1,11 @@
#readelf: --section-groups
-#name: Attaching a section to a non-existant group
+#name: Attaching a section to group defined later
#source: attach-2.s
#...
-group section \[ 1\] `\.group' \[foo\.group\] contains 2 sections:
+group section \[ 1\] `\.group' \[foo\.group\] contains [24] sections:
\[Index\] Name
- \[ .\] bar
- \[ .\] foo
-#pass
-
+.* bar
+.* foo
+#?.* \.xt\.prop
+#?.* \.rela\.xt\.prop
diff --git a/gas/testsuite/gas/elf/attach-2.s b/gas/testsuite/gas/elf/attach-2.s
index 4a5663f..d62a81b 100644
--- a/gas/testsuite/gas/elf/attach-2.s
+++ b/gas/testsuite/gas/elf/attach-2.s
@@ -1,9 +1,9 @@
- .section bar
+ .section bar, "ax", %progbits
.nop
.attach_to_group foo.group
.section foo, "G", %note , foo.group
.word 0
- .section bar
+ .section bar, "ax", %progbits
.nop
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index e03dc2b..c828c3a 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -149,6 +149,7 @@ if { [is_elf_format] } then {
run_dump_test "group3"
run_dump_test "attach-1"
+ run_dump_test "attach-2"
run_dump_test "attach-err"
switch -glob $target_triplet {
diff --git a/gas/testsuite/gas/elf/section21.l b/gas/testsuite/gas/elf/section21.l
index 53f0415..b4d1283 100644
--- a/gas/testsuite/gas/elf/section21.l
+++ b/gas/testsuite/gas/elf/section21.l
@@ -1,5 +1,3 @@
[^:]*: Assembler messages:
-[^:]*:11: Error: junk at end of line, first unrecognized character is `f'
-#...
[^:]*: Error: undefined linked-to symbol `bar' on section `__patchable_function_entries'
[^:]*: Error: undefined linked-to symbol `foo' on section `__patchable_function_entries'
diff --git a/gas/testsuite/gas/elf/section21.s b/gas/testsuite/gas/elf/section21.s
index ae5f848..e874154 100644
--- a/gas/testsuite/gas/elf/section21.s
+++ b/gas/testsuite/gas/elf/section21.s
@@ -2,14 +2,9 @@
.dc.a .LPFE1
.text
.LPFE1:
- .byte 0
+ .dc.a 0
.section __patchable_function_entries,"awo",%progbits,foo
.dc.a .LPFE2
.text
.LPFE2:
.dc.a foo
- .section __patchable_function_entries,"awo",%progbits,1foo
- .dc.a .LPFE3
- .text
-.LPFE3:
- .byte 0