Add --gc-sections test checking removal of __start/__stop symbols.
authorAlan Modra <amodra@gmail.com>
Tue, 30 Jan 2018 11:41:00 +0000 (22:11 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 30 Jan 2018 11:43:43 +0000 (22:13 +1030)
Well, just __stop__foo but that should be good enough.

* testsuite/ld-gc/stop.d,
* testsuite/ld-gc/stop.s: New test.
* testsuite/ld-gc/gc.exp: Run it.

ld/ChangeLog
ld/testsuite/ld-gc/gc.exp
ld/testsuite/ld-gc/stop.d [new file with mode: 0644]
ld/testsuite/ld-gc/stop.s [new file with mode: 0644]

index 83c9689f37a5eb5c356cdd25d2994c57f42535a1..f29d51ada00e5b3e47e6a51b9eb763324b48b00c 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-30  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-gc/stop.d,
+       * testsuite/ld-gc/stop.s: New test.
+       * testsuite/ld-gc/gc.exp: Run it.
+
 2018-01-30  Maciej W. Rozycki  <macro@mips.com>
 
        PR ld/22649
index eaaa8e158ab29c78698a5084dc67c378762c5008..ad983ef7cdbe2dac37706630d49640da0caaffd6 100644 (file)
@@ -104,6 +104,7 @@ test_gc "Check --gc-section/-r/-u" "gcrel" $ld "-r --gc-sections -u used_func"
 run_dump_test "noent"
 run_dump_test "abi-note"
 run_dump_test "start"
+run_dump_test "stop"
 run_dump_test "pr19167"
 if { [is_elf_format] } then {
     run_dump_test "all-debug-sections"
diff --git a/ld/testsuite/ld-gc/stop.d b/ld/testsuite/ld-gc/stop.d
new file mode 100644 (file)
index 0000000..f8a32d6
--- /dev/null
@@ -0,0 +1,10 @@
+#name: --gc-sections removing __stop_
+#ld: --gc-sections -e _start
+#nm: -n
+#target: *-*-linux* *-*-gnu*
+#notarget: *-*-*aout *-*-*oldld frv-*-linux* metag-*-linux*
+
+#failif
+#...
+[0-9a-f]+ D +__stop__foo
+#...
diff --git a/ld/testsuite/ld-gc/stop.s b/ld/testsuite/ld-gc/stop.s
new file mode 100644 (file)
index 0000000..cb46d04
--- /dev/null
@@ -0,0 +1,8 @@
+       .text
+       .globl _start
+_start:
+       .dc.a   0
+
+       .section        _foo,"aw",%progbits
+foo:
+       .long   1