aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-03-01 17:07:12 -0800
committerH.J. Lu <hjl.tools@gmail.com>2020-03-01 17:10:49 -0800
commit2aa90762b71af7f04032d2bebed6470070d3d801 (patch)
tree227042b9ed311df00ec6123a1b37632eb9683a08 /ld/testsuite
parenta4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7 (diff)
downloadgdb-2aa90762b71af7f04032d2bebed6470070d3d801.zip
gdb-2aa90762b71af7f04032d2bebed6470070d3d801.tar.gz
gdb-2aa90762b71af7f04032d2bebed6470070d3d801.tar.bz2
plugin: Copy the no_export field to the IR dummy object
Copy the no_export field to the IR dummy object when claiming an IR object. PR ld/25618 * plugin.c (plugin_object_p): Copy the no_export field to the IR dummy object. * testsuite/ld-plugin/lto.exp (lto_link_elf_tests): Add PR ld/25618 tests. * testsuite/ld-plugin/pr25618.d: New file. * testsuite/ld-plugin/pr25618a.cc: Likewise. * testsuite/ld-plugin/pr25618a.h: Likewise. * testsuite/ld-plugin/pr25618b.cc: Likewise. * testsuite/ld-plugin/pr25618b.h: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp10
-rw-r--r--ld/testsuite/ld-plugin/pr25618.d4
-rw-r--r--ld/testsuite/ld-plugin/pr25618a.cc3
-rw-r--r--ld/testsuite/ld-plugin/pr25618a.h2
-rw-r--r--ld/testsuite/ld-plugin/pr25618b.cc2
-rw-r--r--ld/testsuite/ld-plugin/pr25618b.h2
6 files changed, 23 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 0243f09..31da465 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -368,6 +368,16 @@ set lto_link_elf_tests [list \
"-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \
tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
{dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \
+ [list "Build pr25618a.o" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618a.cc} {} "" "c++"] \
+ [list "Build pr25618.a" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618b.cc} {} "pr25618.a" "c++"] \
+ [list "Build pr25618.so" \
+ "-shared -Wl,--exclude-libs,ALL tmpdir/pr25618a.o tmpdir/pr25618.a" \
+ "-fpic" \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr25618.d}} "pr25618.so" "c++"] \
]
# PR 14918 checks that libgcc is not spuriously included in a shared link of
diff --git a/ld/testsuite/ld-plugin/pr25618.d b/ld/testsuite/ld-plugin/pr25618.d
new file mode 100644
index 0000000..2815d92
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr25618.d
@@ -0,0 +1,4 @@
+#failif
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?_Z3foov
+#...
diff --git a/ld/testsuite/ld-plugin/pr25618a.cc b/ld/testsuite/ld-plugin/pr25618a.cc
new file mode 100644
index 0000000..6d35b3c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr25618a.cc
@@ -0,0 +1,3 @@
+#include "pr25618a.h"
+#include "pr25618b.h"
+int bar() { return foo(); }
diff --git a/ld/testsuite/ld-plugin/pr25618a.h b/ld/testsuite/ld-plugin/pr25618a.h
new file mode 100644
index 0000000..9bf857c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr25618a.h
@@ -0,0 +1,2 @@
+#pragma once
+__attribute__((visibility("default"))) int bar();
diff --git a/ld/testsuite/ld-plugin/pr25618b.cc b/ld/testsuite/ld-plugin/pr25618b.cc
new file mode 100644
index 0000000..1d3dff3
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr25618b.cc
@@ -0,0 +1,2 @@
+#include "pr25618b.h"
+int foo() { return 100; }
diff --git a/ld/testsuite/ld-plugin/pr25618b.h b/ld/testsuite/ld-plugin/pr25618b.h
new file mode 100644
index 0000000..cd80074
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr25618b.h
@@ -0,0 +1,2 @@
+#pragma once
+__attribute__((visibility("default"))) int foo();