aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-gc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-03 17:25:28 +1030
committerAlan Modra <amodra@gmail.com>2021-03-03 17:46:36 +1030
commit270f32fc50b465e84c214a17d4ad3aebc3161bae (patch)
treed8f6a240063357e746463638b44f507836a7bf47 /ld/testsuite/ld-gc
parentdc83f2d20e964f9a7fd9a97ba9d3950b908752a1 (diff)
downloadgdb-270f32fc50b465e84c214a17d4ad3aebc3161bae.zip
gdb-270f32fc50b465e84c214a17d4ad3aebc3161bae.tar.gz
gdb-270f32fc50b465e84c214a17d4ad3aebc3161bae.tar.bz2
ld-gc tests on underscore targets
Adjust tests to reference __start and __stop syms with an extra leading underscore when appropriate, and run tests on more targets. * testsuite/ld-gc/gc.exp: Define UNDERSCORE in ASFLAGS. Move tests with ELF section directives to is_elf_format block. * testsuite/ld-gc/abi-note.d: Run on more targets. * testsuite/ld-gc/pr19167.d: Likewise and adjust xfails. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-gc/start2.d: Likewise. * testsuite/ld-gc/stop.d: Likewise. * testsuite/ld-gc/pr19167a.s: Add support for underscore targets. * testsuite/ld-gc/start.s: Likewise. * testsuite/ld-gc/start2.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-gc')
-rw-r--r--ld/testsuite/ld-gc/abi-note.d1
-rw-r--r--ld/testsuite/ld-gc/gc.exp18
-rw-r--r--ld/testsuite/ld-gc/pr19167.d3
-rw-r--r--ld/testsuite/ld-gc/pr19167a.s4
-rw-r--r--ld/testsuite/ld-gc/start.d5
-rw-r--r--ld/testsuite/ld-gc/start.s6
-rw-r--r--ld/testsuite/ld-gc/start2.d6
-rw-r--r--ld/testsuite/ld-gc/start2.s7
-rw-r--r--ld/testsuite/ld-gc/stop.d3
9 files changed, 35 insertions, 18 deletions
diff --git a/ld/testsuite/ld-gc/abi-note.d b/ld/testsuite/ld-gc/abi-note.d
index 12391e1..1f78cea 100644
--- a/ld/testsuite/ld-gc/abi-note.d
+++ b/ld/testsuite/ld-gc/abi-note.d
@@ -1,7 +1,6 @@
#name: --gc-sections with note section
#ld: --gc-sections -e _start
#readelf: -S --wide
-#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
#...
.* .note.ABI-tag[ ]+NOTE.*
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index ad3bc2e..ba528d0 100644
--- a/ld/testsuite/ld-gc/gc.exp
+++ b/ld/testsuite/ld-gc/gc.exp
@@ -86,15 +86,21 @@ test_gc "Check --gc-section/-q" "gcrexe" $ld "--gc-sections -q -e main"
test_gc "Check --gc-section/-r/-e" "gcrel" $ld "-r --gc-sections -e main"
test_gc "Check --gc-section/-r/-u" "gcrel" $ld "-r --gc-sections -u used_func"
+set old_asflags $ASFLAGS
+if [is_underscore_target] {
+ set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
+}
+
run_dump_test "noent"
-run_dump_test "abi-note"
-run_dump_test "start"
-run_dump_test "start2"
-run_dump_test "stop"
-run_dump_test "pr19167"
+
if { [is_elf_format] } then {
+ run_dump_test "abi-note"
run_dump_test "all-debug-sections"
+ run_dump_test "pr19167"
run_dump_test "pr20882"
+ run_dump_test "stop"
+ run_dump_test "start"
+ run_dump_test "start2"
}
if { [is_elf_format] && [check_shared_lib_support] } then {
@@ -175,3 +181,5 @@ if { [is_elf_format] && [check_shared_lib_support] \
if { [is_elf_format] } then {
run_dump_test "skip-map-discarded"
}
+
+set ASFLAGS $old_asflags
diff --git a/ld/testsuite/ld-gc/pr19167.d b/ld/testsuite/ld-gc/pr19167.d
index 9555cc8..f652dd0 100644
--- a/ld/testsuite/ld-gc/pr19167.d
+++ b/ld/testsuite/ld-gc/pr19167.d
@@ -2,8 +2,7 @@
#source: pr19167b.s
#ld: --gc-sections -e _start
#objdump: -s -j _foo
-#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
-#xfail: frv-*-* metag-*-*
+#xfail: bfin-*-*linux* frv-*-*linux* lm32-*-*linux*
#...
Contents of section _foo:
diff --git a/ld/testsuite/ld-gc/pr19167a.s b/ld/testsuite/ld-gc/pr19167a.s
index 7dc16e2..73a0a27 100644
--- a/ld/testsuite/ld-gc/pr19167a.s
+++ b/ld/testsuite/ld-gc/pr19167a.s
@@ -1,6 +1,10 @@
.globl _start
_start:
+ .ifdef UNDERSCORE
+ .dc.a ___start__foo
+ .else
.dc.a __start__foo
+ .endif
.section _foo,"aw",%progbits
foo:
.ascii "This is "
diff --git a/ld/testsuite/ld-gc/start.d b/ld/testsuite/ld-gc/start.d
index 85b0612..0998ecf 100644
--- a/ld/testsuite/ld-gc/start.d
+++ b/ld/testsuite/ld-gc/start.d
@@ -1,9 +1,8 @@
#name: --gc-sections with __start_
#ld: --gc-sections -e _start
#nm: -n
-#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
-#xfail: frv-*-* metag-*-*
+#xfail: bfin-*-*linux* frv-*-*linux* lm32-*-*linux*
#...
-[0-9a-f]+ D +__start__foo
+[0-9a-f]+ D +_?__start__foo
#...
diff --git a/ld/testsuite/ld-gc/start.s b/ld/testsuite/ld-gc/start.s
index a417a97..505122d 100644
--- a/ld/testsuite/ld-gc/start.s
+++ b/ld/testsuite/ld-gc/start.s
@@ -1,6 +1,10 @@
-.globl _start
+ .globl _start
_start:
+ .ifdef UNDERSCORE
+ .dc.a ___start__foo
+ .else
.dc.a __start__foo
+ .endif
.section _foo,"aw",%progbits
foo:
.long 1
diff --git a/ld/testsuite/ld-gc/start2.d b/ld/testsuite/ld-gc/start2.d
index 480dc74..b893ba2 100644
--- a/ld/testsuite/ld-gc/start2.d
+++ b/ld/testsuite/ld-gc/start2.d
@@ -1,10 +1,10 @@
#name: --gc-sections with -z start-stop-gc
#ld: --gc-sections -e _start -z start-stop-gc
#nm: -n
-#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
-#xfail: bfin-*-*linux* frv-*-*
+#notarget: [uses_genelf]
+#xfail: bfin-*-*linux* frv-*-*linux*
#failif
#...
-[0-9a-f]+ D +__start__foo
+[0-9a-f]+ D +_?__start__foo
#...
diff --git a/ld/testsuite/ld-gc/start2.s b/ld/testsuite/ld-gc/start2.s
index b0084a1..920feb2 100644
--- a/ld/testsuite/ld-gc/start2.s
+++ b/ld/testsuite/ld-gc/start2.s
@@ -1,7 +1,12 @@
-.globl _start
+ .globl _start
_start:
+ .ifdef UNDERSCORE
+ .weak ___start__foo
+ .dc.a ___start__foo
+ .else
.weak __start__foo
.dc.a __start__foo
+ .endif
.section _foo,"aw",%progbits
foo:
.long 1
diff --git a/ld/testsuite/ld-gc/stop.d b/ld/testsuite/ld-gc/stop.d
index ebd3597..140d1d2 100644
--- a/ld/testsuite/ld-gc/stop.d
+++ b/ld/testsuite/ld-gc/stop.d
@@ -1,9 +1,8 @@
#name: --gc-sections removing __stop_
#ld: --gc-sections -e _start
#nm: -n
-#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
#failif
#...
-[0-9a-f]+ D +__stop__foo
+[0-9a-f]+ D +_?__stop__foo
#...