Summary: | Malformed .eh_frame generated with LTO, gold and optimization enabled | ||
---|---|---|---|
Product: | binutils | Reporter: | Peter Wu <peter> |
Component: | gold | Assignee: | Cary Coutant <ccoutant> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | arun, ian |
Priority: | P2 | ||
Version: | 2.24 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Peter Wu
2014-11-24 13:52:59 UTC
This bug breaks C++ exceptions too. ==> foo.cpp <== #include <stdio.h> void foo(int n) { puts("FOO"); throw 42; } ==> main.cpp <== #include <stdio.h> extern void foo(int x); int main(void) { puts("calling foo"); try { foo(1); } catch (int i) { printf("Caught %d\n", i); } puts("done with foo"); With ld.gold (-Wl,-fuse-ld=gold): calling foo FOO Aborted Without gold: calling foo FOO Caught 42 done with foo This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, master has been updated via c924eb67e143722e4098d84c1cb91123a51c988f (commit) from 61e6682207163bfc02b2fc0c54c084cf8f2c5f10 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c924eb67e143722e4098d84c1cb91123a51c988f commit c924eb67e143722e4098d84c1cb91123a51c988f Author: Cary Coutant <ccoutant@google.com> Date: Tue Nov 25 13:55:42 2014 -0800 Fix corrupted .eh_frame section with LTO and --gc-sections. When --gc-sections is turned on during an LTO link, the .eh_frame sections from deferred files are processed before those from the replacement files. As a result, the section end-cap from crtendS.o is placed ahead of the .eh_frame data from the replacement files. This patch fixes the bug by skipping the layout of the deferred sections during GC pass 2. gold/ PR gold/17639 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_. (Sized_relobj_file::do_layout): Handle deferred sections properly during GC pass 1. Don't add reloc sections to deferred list twice. * object.h (Sized_relobj_file::is_deferred_layout): New function. (Sized_relobj_file::is_deferred_layout_): New data member. ----------------------------------------------------------------------- Summary of changes: gold/ChangeLog | 9 +++++++++ gold/object.cc | 20 ++++++++++++++------ gold/object.h | 7 +++++++ 3 files changed, 30 insertions(+), 6 deletions(-) Should be fixed on binutils trunk. If you'd like this backported to 2.25, let me know. Verified with master (git commit c924eb67e143722e4098d84c1cb91123a51c988f). The current binutils stable is 2.24 right? It would be nice if it available in the next version (2.25?). Thank you for the prompt response! This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, binutils-2_25-branch has been updated via 9ec85a27138aefcd3fc35ddbd7727f384fe299b1 (commit) from bd30b2c856c9ae1fc3559d80fc8c8ccdf65e5fce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9ec85a27138aefcd3fc35ddbd7727f384fe299b1 commit 9ec85a27138aefcd3fc35ddbd7727f384fe299b1 Author: Cary Coutant <ccoutant@google.com> Date: Tue Nov 25 13:55:42 2014 -0800 Fix corrupted .eh_frame section with LTO and --gc-sections. Backport from trunk: When --gc-sections is turned on during an LTO link, the .eh_frame sections from deferred files are processed before those from the replacement files. As a result, the section end-cap from crtendS.o is placed ahead of the .eh_frame data from the replacement files. This patch fixes the bug by skipping the layout of the deferred sections during GC pass 2. gold/ PR gold/17639 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_. (Sized_relobj_file::do_layout): Handle deferred sections properly during GC pass 1. Don't add reloc sections to deferred list twice. * object.h (Sized_relobj_file::is_deferred_layout): New function. (Sized_relobj_file::is_deferred_layout_): New data member. ----------------------------------------------------------------------- Summary of changes: gold/ChangeLog | 9 +++++++++ gold/object.cc | 20 ++++++++++++++------ gold/object.h | 7 +++++++ 3 files changed, 30 insertions(+), 6 deletions(-) |