diff options
author | Cary Coutant <ccoutant@gmail.com> | 2016-03-20 19:15:56 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2016-03-20 19:17:14 -0700 |
commit | 698400bfb91b3476d98edcb6a4bf5e4abe1c14cc (patch) | |
tree | 08b2a8c9742e5fafdca141f3f6561f9c7c25d0b3 /gold/testsuite/eh_test_a.cc | |
parent | a3b6c4db68dbcb24c454e6beaaf1002c1ca9e011 (diff) | |
download | binutils-698400bfb91b3476d98edcb6a4bf5e4abe1c14cc.zip binutils-698400bfb91b3476d98edcb6a4bf5e4abe1c14cc.tar.gz binutils-698400bfb91b3476d98edcb6a4bf5e4abe1c14cc.tar.bz2 |
Fix problem where gold cannot build .eh_frame_hdr from ld -r output.
When running ld -r on objects that have comdat groups, when gold
deduplicates a function in a comdat group, it removes the relocations
from the EH information that referred to the dropped copy of the function.
When running a final link using the result of the -r link, the missing
relocation cause it to fail to recognize the FDE for the dropped
function.
This patch improves gold's FDE scanning to take into account the
possibility that an FDE corresponds to a dropped function, and drops
that FDE as well.
Gnu ld, on the other hand, leaves the relocations in the ld -r output,
but makes them R_NONE with an r_sym field of 0. This was sufficient to
let both linkers recognize the FDE properly.
With this fix, if you do an ld -r with gold, then do the final link with
Gnu ld, the .eh_frame_hdr section will not be generated. To make it work
with Gnu ld, we would have to leave the R_NONE relocations in, but I
think it's better to drop the relocations entirely. I'd hope that if
you're doing a -r link with gold, you'll also do the final link with
gold.
gold/
PR gold/19002
* ehframe.cc (Eh_frame::read_fde): Check for dropped functions.
* testsuite/Makefile.am (eh_test_2): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/eh_test_2.sh: New test script.
* testsuite/eh_test_a.cc (bar): Make it comdat.
* testsuite/eh_test_b.cc (bar): Add a duplicate copy.
Diffstat (limited to 'gold/testsuite/eh_test_a.cc')
-rw-r--r-- | gold/testsuite/eh_test_a.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gold/testsuite/eh_test_a.cc b/gold/testsuite/eh_test_a.cc index ad4bcc2..e3c8a16 100644 --- a/gold/testsuite/eh_test_a.cc +++ b/gold/testsuite/eh_test_a.cc @@ -1,4 +1,9 @@ +template<typename C> void -bar() +bar(C*) { } + +template +void +bar<int>(int*); |