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.
This commit is contained in:
H.J. Lu
2020-03-01 17:07:12 -08:00
parent a4dd6c97bd
commit 2aa90762b7
8 changed files with 37 additions and 0 deletions

View File

@@ -1,3 +1,16 @@
2020-03-01 H.J. Lu <hongjiu.lu@intel.com>
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.
2020-02-27 Alan Modra <amodra@gmail.com>
PR 24511

View File

@@ -1239,6 +1239,7 @@ plugin_object_p (bfd *ibfd)
ibfd->plugin_format = bfd_plugin_yes;
ibfd->plugin_dummy_bfd = abfd;
bfd_make_readable (abfd);
abfd->no_export = ibfd->no_export;
return abfd->xvec;
}
else

View File

@@ -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

View File

@@ -0,0 +1,4 @@
#failif
#...
+[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?_Z3foov
#...

View File

@@ -0,0 +1,3 @@
#include "pr25618a.h"
#include "pr25618b.h"
int bar() { return foo(); }

View File

@@ -0,0 +1,2 @@
#pragma once
__attribute__((visibility("default"))) int bar();

View File

@@ -0,0 +1,2 @@
#include "pr25618b.h"
int foo() { return 100; }

View File

@@ -0,0 +1,2 @@
#pragma once
__attribute__((visibility("default"))) int foo();