exception_static_test fails for powerpc64 due to this layout: .eh_frame 0x00000000100a4290 0xba14 ** eh_frame 0x00000000100a4290 0xba10 .eh_frame 0x00000000100afca0 0x0 /usr/lib/gcc/ppc64-redhat-linux/4.7.0/crtbeginT.o .eh_frame 0x00000000100afca0 0x4 /usr/lib/gcc/ppc64-redhat-linux/4.7.0/crtend.o crtbeginT.o defines __EH_FRAME_BEGIN__, which is passed to __register_frame_info. As you can guess this doesn't work very well with all of the actual eh_frame info preceding this location. The reason for the failure is that on my freshly updated fedora17 box, glibc-devel-2.15-51.fc17.ppc64 provided crt1.o has an .eh_frame section. crt1.o is linked *before* crtbeginT.o so we run foul of the following in layout.cc // We found a .eh_frame section we are going to optimize, so now // we can add the set of optimized sections to the output // section. We need to postpone adding this until we've found a // section we can optimize so that the .eh_frame section in // crtbegin.o winds up at the start of the output section. if (!this->added_eh_frame_data_) Now .eh_frame in crt1.o is a decidedly useless thing to have, but bfd ld manages to link and run exception_static_test OK. What happens with bfd ld is that the crt1.o .eh_frame is linked before __EH_FRAME_BEGIN__ (effectively discarded as far as the unwinder is concerned) but the bulk of .eh_frame from all other files is properly placed after this location.
*** Bug 17366 has been marked as a duplicate of this bug. ***
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, hjl/pr14675 has been created at 4a5d5d94ca76cbf730d7f0379601e75f9469670e (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4a5d5d94ca76cbf730d7f0379601e75f9469670e commit 4a5d5d94ca76cbf730d7f0379601e75f9469670e Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbegin as normal input Force the exception frame section from input files before the crtbegin file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbegin file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files before the crtbegin file to be handled as an ordinary input section if we aren't creating the exception frame header. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the crtbegin file has been processed. * layout.cc (Layout::Layout): Initialize seen_crtbegin_. (Layout::layout_eh_frame): Pass this->seen_crtbegin_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->seen_crtbegin_ to true when processing the crtbegin file. * layout.h (Layout): Add a seen_crtbegin_ field. -----------------------------------------------------------------------
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, hjl/pr14675 has been created at b4e73bc925dfff0da1fcca6159a9b0c5d7792ea9 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b4e73bc925dfff0da1fcca6159a9b0c5d7792ea9 commit b4e73bc925dfff0da1fcca6159a9b0c5d7792ea9 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize has_crtbeginT_ to has_crtbeginT and optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add has_crtbeginT_ and optimize_ehframe_ members. * main.cc (main): Update layout. * options.cc (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Command_line::crtbeginT): New function. -----------------------------------------------------------------------
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, hjl/pr14675 has been created at cade3c669933278d78d5a8900458324aadd68b14 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cade3c669933278d78d5a8900458324aadd68b14 commit cade3c669933278d78d5a8900458324aadd68b14 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add an optimize_ehframe_ member. * main.cc (main): Update layout. * options.cc: Include "layout.h". (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_ to false. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Command_line::crtbeginT): New function. -----------------------------------------------------------------------
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, hjl/pr14675 has been created at c694de32e282069ac0965ebb650cea7de4bf6a30 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c694de32e282069ac0965ebb650cea7de4bf6a30 commit c694de32e282069ac0965ebb650cea7de4bf6a30 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add an optimize_ehframe_ member. * main.cc (main): Pass command_line.has_crtbeginT() to layout. * options.cc: Include "layout.h". (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_ to false. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Command_line::has_crtbeginT): New function. -----------------------------------------------------------------------
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, hjl/pr14675 has been created at f7780984db99e1c87bcdec3cc8dc3e001eb08d74 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7780984db99e1c87bcdec3cc8dc3e001eb08d74 commit f7780984db99e1c87bcdec3cc8dc3e001eb08d74 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add an optimize_ehframe_ member. * main.cc (main): Pass command_line.has_crtbeginT() to layout. * options.cc: Include "layout.h". (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_ to false. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Command_line::has_crtbeginT): New function. -----------------------------------------------------------------------
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, users/hjl/pr14675 has been created at 355d5e8db8f93fd2e5e73fc972bf3c3c818a4d66 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=355d5e8db8f93fd2e5e73fc972bf3c3c818a4d66 commit 355d5e8db8f93fd2e5e73fc972bf3c3c818a4d66 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add an optimize_ehframe_ member. * main.cc (main): Pass command_line.has_crtbeginT() to layout. * options.cc: Include "layout.h". (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file and the last one is a crti file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_ and last_is_crti_ to false. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Input_arguments::last_is_crti_): Likewise. (Command_line::has_crtbeginT): New function. -----------------------------------------------------------------------
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, users/hjl/pr14675 has been created at 081ff0b8a64fa33a2fbd8b900f31228138400438 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=081ff0b8a64fa33a2fbd8b900f31228138400438 commit 081ff0b8a64fa33a2fbd8b900f31228138400438 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Dec 20 05:45:51 2014 -0800 Treat .eh_frame section before crtbeginT as normal input Force the exception frame section from input files before the crtbeginT file to be handled as an ordinary input section if we aren't creating the exception frame header. If we don't do this, we won't correctly handle the special marker symbol in the exception frame section in the crtbeginT file. PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the exception frame section from input files if it can't be optimized. (Eh_frame::add_ehframe_input_section<32, false>): Updated. (Eh_frame::add_ehframe_input_section<32, true>): Likewise. (Eh_frame::add_ehframe_input_section<64, false>): Likewise. (Eh_frame::add_ehframe_input_section<64, true>): Likewise. * ehframe.h (Eh_frame::add_ehframe_input_section): Add a bool parameter to indicate if the exception frame section can be optimized. * layout.cc (Layout::Layout): Initialize optimize_ehframe_ to !has_crtbeginT. (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to Eh_frame::add_ehframe_input_section. (Layout::make_eh_frame_section): Set this->optimize_ehframe_ to true when processing the crtbeginT file if it is on command line. (Layout::match_file_name (const char*, const char*)): New. (Layout::match_file_name(const Relobj*, const char*): Use it. * layout.h (Layout::Layout): Add has_crtbeginT. (Layout::match_file_name (const char*, const char*)): New. (Layout): Add an optimize_ehframe_ member. * main.cc (main): Pass command_line.has_crtbeginT() to layout. * options.cc: Include "layout.h". (Input_arguments::add_file): Set this->has_crtbeginT_ to true if there is a crtbeginT file and the last one is a crti file. * options.h (Input_arguments::Input_arguments): Initialize has_crtbeginT_ and last_is_crti_ to false. (Input_arguments::has_crtbeginT): New function. (Input_arguments::has_crtbeginT_): New bool member. (Input_arguments::last_is_crti_): Likewise. (Command_line::has_crtbeginT): New function. -----------------------------------------------------------------------
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e16631979e847a6b39db3435bea7708b9f34b36d commit e16631979e847a6b39db3435bea7708b9f34b36d Author: Cary Coutant <ccoutant@google.com> Date: Mon Mar 9 10:10:29 2015 -0700 Fix failure in exception_static_test. Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section, we place all optimized .eh_frame sections into the output section ahead of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked binaries. This patch fixes the problem by delaying the attachment of the optimized .eh_frame sections to the output section until we see the end marker section (or to the end of pass 1 if we never see an end marker). gold/ PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type; return enum indicating whether .eh_frame section is empty, optimizable, unrecognized, or an end marker. Adjust explicit instantiations. * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type. (Eh_frame::add_ehframe_input_section): Change return type. * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section. * layout.cc (Layout::layout_eh_frame): Don't add optimized sections to the .eh_frame output section until we see the end marker. (Layout::finalize_eh_frame_section): New. * layout.h: (Layout::finalize_eh_frame_section): New.
Fixed on trunk.
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd9e0d4628f1265c42516f90c4f162cefa787294 commit bd9e0d4628f1265c42516f90c4f162cefa787294 Author: Cary Coutant <ccoutant@gmail.com> Date: Sat Mar 21 17:47:49 2015 -0700 Fix internal error in do_relocate_sections when using plugins. In a previous patch for PR 14675, to fix a problem with the .eh_frame section when static linking, I added a step to finalize the .eh_frame section at the end of the first link pass. This patch caused PR 18152, where a plugin-claimed object caused a non-claimed object's layout to be deferred until replacement files were read. The call to finalize_eh_frame_section() is happening before the layout of the deferred objects, leading to the internal error in do_relocate_sections. This patch moves the finalization of the .eh_frame section to after deferred objects have been processed. gold/ PR gold/14675 PR gold/18152 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out deferred objects.