Description of problem: I use partial linking in my project. No matter how I try to configure it, I seem to get a corrupt .eh_frame_hdr in the final (fully linked) executable. Version-Release number of selected component (if applicable): How reproducible: Every Time. Steps to Reproduce: 1. ld -Ur --eh-frame-hdr $(RANDOM_CPP_OBJS) -o partial_obj.o 2. g++ -Wl,--export-dynamic $(MORE_OBJS) partial_obj.o -o final.exe Actual results: /usr/bin/ld: error in lib/partial_obj.o(.eh_frame); no .eh_frame_hdr table will be created. Expected results: n/t Additional info: The executable generated seems to work okay, though what happens on an actual excpetion is in doubt for me.
Upstream post: http://sourceware.org/ml/binutils/2008-09/msg00124.html
*** This bug has been marked as a duplicate of bug 458950 ***
Please reopen this bug, it is not a duplicate of 458950 because that bug is fixed, and my problem still persists. I will add a test case for reproducing the bug later. That will take some time because the only system I've got that produces the bug is complicated, and I don't have an easy way to pare it down.
In fact some binary ball would be also useful as you write in your comment in Bug 458950 Comment 10.
Okay, here are the binaries in question, and a script that links the partial object, and then the final executable. I realize we are well off into the woods on the linker features in use here. I've never even seen .a's linked by anyone like that, but that is what the packagers of the libs I use did to me. Here is a link: http://www.parl.clemson.edu/~bradles/downloads/test_case.tar.gz The download is 13MB, and it creates a single dedicated directory. Nothing malicious in there, just a call to ld, followed by a call to g++.
Created attachment 330285 [details] Fix + testcase. My former patch was: http://sourceware.org/ml/binutils/2008-09/msg00124.html Relaxed the check there with a comment: + /* For NULL RSEC (cleared FDE belonging to a discarded section) + the relocations are commonly cleared. We do not sanity check if + all these relocations are cleared as (1) relocations to + .gcc_except_table will remain uncleared (they will get dropped + with the drop of this unused FDE) and (2) BFD already safely drops + relocations of any type to .eh_frame by + elf_section_ignore_discarded_relocs. + FIXME: The .gcc_except_table entries should be also filtered as + .eh_frame entries; moreover both could rather use COMDAT. */ Fortunately the former patch had no regressions just its effect was incomplete. Thanks for the bugreport, scratch build (-U --oldpackage, please) is at: http://koji.fedoraproject.org/scratch/jkratoch/task_1089661/ After the multiarch regression tests going to post it upstream.
Post upstream with an updated testcase: http://sourceware.org/ml/binutils/2009-01/msg00412.html
binutils-2.18.50.0.6-7.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
binutils-2.18.50.0.9-8.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.