diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-11-28 03:48:25 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-11-28 03:48:44 -0800 |
commit | a83ef4d139c377e0e87d105977d85c6ef9fbb162 (patch) | |
tree | 5c962499a8395d45d1d270f31a94f381ea0a7b6c /ld | |
parent | f0531ed6a429b0e6e6509e6852ccd3586f3fa1bd (diff) | |
download | gdb-a83ef4d139c377e0e87d105977d85c6ef9fbb162.zip gdb-a83ef4d139c377e0e87d105977d85c6ef9fbb162.tar.gz gdb-a83ef4d139c377e0e87d105977d85c6ef9fbb162.tar.bz2 |
ld: Set non_ir_ref_regular on symbols referenced in regular objects
If linker plugin is enabled, set non_ir_ref_regular on symbols referenced
in regular objects so that linker plugin will get the correct symbol
resolution.
bfd/
PR ld/22502
* elflink.c (_bfd_elf_merge_symbol): Also skip definition from
an IR object.
(elf_link_add_object_symbols): If linker plugin is enabled, set
non_ir_ref_regular on symbols referenced in regular objects so
that linker plugin will get the correct symbol resolution.
ld/
PR ld/22502
* testsuite/ld-plugin/lto.exp: Run PR ld/22502 test.
* testsuite/ld-plugin/pr22502a.c: New file.
* testsuite/ld-plugin/pr22502b.c: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/lto.exp | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr22502a.c | 16 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr22502b.c | 3 |
4 files changed, 35 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 9c10c7e..ed63236 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2017-11-28 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/22502 + * testsuite/ld-plugin/lto.exp: Run PR ld/22502 test. + * testsuite/ld-plugin/pr22502a.c: New file. + * testsuite/ld-plugin/pr22502b.c: Likewise. + 2017-11-24 H.J. Lu <hongjiu.lu@intel.com> * testsuite/ld-elf/pr21562c.t: Also provide ___start_scnfoo and diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index d34479f..56c852d 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -208,6 +208,12 @@ set lto_link_tests [list \ "-flto -Wl,-plugin,$plug_so" "-flto" \ {pr20321.c} {{warning ".*: duplicated plugin"}} \ "pr20321" "c"] \ + [list "Build pr22502a.o" \ + "" "" \ + {pr22502a.c}] \ + [list "Build pr22502b.o" \ + "$plug_opt" "-flto $lto_no_fat" \ + {pr22502b.c}] \ ] if { [at_least_gcc_version 4 7] } { @@ -391,6 +397,9 @@ set lto_run_tests [list \ [list "Run pr20267b" \ "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \ {dummy.c} "pr20267b" "pass.out" "-flto -O2" "c"] \ + [list "Run pr22502" \ + "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \ + {dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \ ] if { [at_least_gcc_version 4 7] } { diff --git a/ld/testsuite/ld-plugin/pr22502a.c b/ld/testsuite/ld-plugin/pr22502a.c new file mode 100644 index 0000000..0eaa1af --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22502a.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +volatile int x; +extern void abort (); + +__attribute__((weak)) +void foobar (void) { x++; } + +int main (void) +{ + foobar (); + if (x != -1) + abort (); + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-plugin/pr22502b.c b/ld/testsuite/ld-plugin/pr22502b.c new file mode 100644 index 0000000..87389b9 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22502b.c @@ -0,0 +1,3 @@ +extern volatile int x; + +void foobar (void) { x--; } |