aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-07-04 06:27:58 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-07-04 06:29:13 -0700
commit94d401b8b88a76b1372ce44e805516756a4f737b (patch)
tree62f580d5a657896a602fad555ea6b11c7cdc48fa /ld/testsuite/ld-plugin
parentb14b7ff14ffe911ec562004304841cf7d2775a19 (diff)
downloadgdb-94d401b8b88a76b1372ce44e805516756a4f737b.zip
gdb-94d401b8b88a76b1372ce44e805516756a4f737b.tar.gz
gdb-94d401b8b88a76b1372ce44e805516756a4f737b.tar.bz2
ld: Set non_ir_ref_regular for --undefined SYMBOL
Set non_ir_ref_regular to TRUE for symbols forced into the output file so that they won't be removed by garbage collection with LTO. PR ld/23309 * ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE. * plugin.c (is_visible_from_outside): Don't scan entry_symbol. * testsuite/ld-plugin/pr23309.c: New file. * testsuite/ld-plugin/pr23309.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-plugin')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp4
-rw-r--r--ld/testsuite/ld-plugin/pr23309.c10
-rw-r--r--ld/testsuite/ld-plugin/pr23309.d3
3 files changed, 17 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 70274b3..7c50b0f 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -242,6 +242,10 @@ set lto_compile_elf_tests [list \
[list "Compile 8b" \
"" "-flto -O2" \
{lto-8b.c} {} ""] \
+ [list "PR ld/23309" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections -Wl,--gc-sections,-u,KeepMe" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections" \
+ {pr23309.c} {{"nm" {} "pr23309.d"}} "pr23309.exe" "c"] \
]
# Generate input files for complex LTO tests for ELF.
diff --git a/ld/testsuite/ld-plugin/pr23309.c b/ld/testsuite/ld-plugin/pr23309.c
new file mode 100644
index 0000000..da8bb3a
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr23309.c
@@ -0,0 +1,10 @@
+int
+main (void)
+{
+ return 0;
+}
+
+void
+KeepMe (void)
+{
+}
diff --git a/ld/testsuite/ld-plugin/pr23309.d b/ld/testsuite/ld-plugin/pr23309.d
new file mode 100644
index 0000000..c353b66
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr23309.d
@@ -0,0 +1,3 @@
+#...
+[0-9a-f]+ . _?KeepMe
+#pass