ld-gc tests on underscore targets
authorAlan Modra <amodra@gmail.com>
Wed, 3 Mar 2021 06:55:28 +0000 (17:25 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 3 Mar 2021 07:16:36 +0000 (17:46 +1030)
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.

ld/ChangeLog
ld/testsuite/ld-gc/abi-note.d
ld/testsuite/ld-gc/gc.exp
ld/testsuite/ld-gc/pr19167.d
ld/testsuite/ld-gc/pr19167a.s
ld/testsuite/ld-gc/start.d
ld/testsuite/ld-gc/start.s
ld/testsuite/ld-gc/start2.d
ld/testsuite/ld-gc/start2.s
ld/testsuite/ld-gc/stop.d

index 9116ee01170f18c0ab6335f584b42fcd49ef850a..bf1d226b80954751e90a745f3655ed83bd43494e 100644 (file)
@@ -1,3 +1,16 @@
+2021-03-03  Alan Modra  <amodra@gmail.com>
+
+       * 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.
+
 2021-03-02  Nick Alcock  <nick.alcock@oracle.com>
 
        * ldelfgen.c (ldelf_ctf_strtab_iter_cb): Skip zero-refcount strings.
index 12391e198a05ce02fb08a03bcdadd4cc4231709e..1f78ceaa3515c9175daaf92fef5dc78db22619e6 100644 (file)
@@ -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.*
index ad3bc2e641e456a62c6f365df708cb45601fa42c..ba528d000bff3e20d690abf41d1368331e93ea8a 100644 (file)
@@ -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
index 9555cc8105a8c43ab627125e99c5506586bc0337..f652dd018f4778e52f62bd846836d1830c214ae0 100644 (file)
@@ -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:
index 7dc16e263f66eee6d68841ba39bb928390d45a05..73a0a27680914926195e5a45d740b9b7fa5b2ed1 100644 (file)
@@ -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 "
index 85b06127226090e814de30ce1ffe3ec2adcf725b..0998ecfcc68b8dac2f72956863fb42336a3d5052 100644 (file)
@@ -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
 #...
index a417a97b22c73fcce20142a1d366ff4ed3c2ccda..505122d520448050c13aa04f26812125b2b4ad0f 100644 (file)
@@ -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
index 480dc74d9f30c62bd3ac4e17edd421fda25312c2..b893ba2372952ec0190c81ceb783bfdb0f3ff5b6 100644 (file)
@@ -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
 #...
index b0084a188ae28546046e9ca403b91e0e0ef6b3ba..920feb26936776831f0ecfe6a5bb8e9d085f0e96 100644 (file)
@@ -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
index ebd3597d6e1ed71c94ac0cb7e9f2f2dc71f8f263..140d1d2f27e685626d08e5f76144889ca01ed916 100644 (file)
@@ -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
 #...
This page took 0.030619 seconds and 4 git commands to generate.