Fix "overflow in PLT unwind data" warning

When linking statically, it's possible to hit this warning with IFUNC
or very large executables, due to .glink being unused.

	* powerpc.cc (do_plt_fde_location): Handle zero length .glink.
	Compare FDE contents with DW_CFA_nop rather than 0.
This commit is contained in:
Alan Modra 2014-05-15 18:37:43 +09:30
parent 57b287416b
commit 5fe7ffdc98
2 changed files with 52 additions and 33 deletions

View File

@ -1,3 +1,8 @@
2014-05-15 Alan Modra <amodra@gmail.com>
* powerpc.cc (do_plt_fde_location): Handle zero length .glink.
Compare FDE contents with DW_CFA_nop rather than 0.
2014-05-13 Sriraman Tallam <tmsriram@google.com>
* symtab.h (may_need_copy_reloc): Remove check for position independent
@ -15,7 +20,7 @@
* testsuite/pie_copyrelocs_test.cc: New file.
* testsuite/pie_copyrelocs_shared_test.cc: New file.
* Makefile.am (pie_copyrelocs_test): New test.
* Makefile.in: Regenerate.
* Makefile.in: Regenerate.
2014-05-08 Martin Liška <mliska@suse.cz>
@ -45,37 +50,37 @@
class.
2014-05-05 Cary Coutant <ccoutant@google.com>
* gdb-index.cc (Gdb_index_info_reader): Don't complain about language
if we have pubnames/pubtypes.
2014-05-02 Cary Coutant <ccoutant@google.com>
* defstd.cc (in_segment): Define __ehdr_start here...
* layout.cc (Layout::finalize): ...Instead of here. Set the
output segment when known.
* resolve.cc (Symbol::override_base_with_special): Remember
the original binding.
* symtab.cc (Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* symtab.h (Symbol::is_weak_undefined): Check original undef
binding.
(Symbol::is_strong_undefined): New function.
(Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* target-reloc.h (is_strong_undefined): Remove.
(issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
Check for hidden undefs.
(relocate_section): Call Symbol::is_strong_undefined.
* testsuite/Makefile.am (ehdr_start_test_1)
(ehdr_start_test_2, ehdr_start_test_3)
(ehdr_start_test_4, ehdr_start_test_5): New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/ehdr_start_def.cc: New source file.
* testsuite/ehdr_start_test.cc: New source file.
* testsuite/ehdr_start_test.t: New linker script.
* testsuite/ehdr_start_test_4.sh: New shell script.
* defstd.cc (in_segment): Define __ehdr_start here...
* layout.cc (Layout::finalize): ...Instead of here. Set the
output segment when known.
* resolve.cc (Symbol::override_base_with_special): Remember
the original binding.
* symtab.cc (Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* symtab.h (Symbol::is_weak_undefined): Check original undef
binding.
(Symbol::is_strong_undefined): New function.
(Symbol::set_output_segment): New function.
(Symbol::set_undefined): New function.
* target-reloc.h (is_strong_undefined): Remove.
(issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
Check for hidden undefs.
(relocate_section): Call Symbol::is_strong_undefined.
* testsuite/Makefile.am (ehdr_start_test_1)
(ehdr_start_test_2, ehdr_start_test_3)
(ehdr_start_test_4, ehdr_start_test_5): New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/ehdr_start_def.cc: New source file.
* testsuite/ehdr_start_test.cc: New source file.
* testsuite/ehdr_start_test.t: New linker script.
* testsuite/ehdr_start_test_4.sh: New shell script.
2014-04-23 Cary Coutant <ccoutant@google.com>
@ -135,7 +140,7 @@
(Target::do_adjust_dyn_symbol): New function.
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
* output.cc (Output_data_dynamic::Dynamic_entry::write):
Get the value of DYNAMIC_CUSTOM dynamic entry.
* output.h (Output_data_dynamic::add_custom): New function.
@ -208,7 +213,7 @@
Check for is_strong_undefined.
2014-02-05 Cary Coutant <ccoutant@google.com>
Fix problems with the --dynamic-list option.
PR gold/13577
@ -221,11 +226,11 @@
(General_options::have_dynamic_list_): New data member.
* symtab.h (Symbol::is_preemptible): Handle --dynamic-list
correctly.
PR gold/16530
* symtab.cc (Symbol_table::add_from_relobj): If symbol is named
in --dynamic-list, mark it.
* testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
(dynamic_list_2): New test case.
* testsuite/Makefile.in: Regenerate.

View File

@ -2851,7 +2851,21 @@ Target_powerpc<size, big_endian>::do_plt_fde_location(const Output_data* plt,
if (plt == this->glink_)
{
// See Output_data_glink::do_write() for glink contents.
if (size == 64)
if (len == 0)
{
gold_assert(parameters->doing_static_link());
// Static linking may need stubs, to support ifunc and long
// branches. We need to create an output section for
// .eh_frame early in the link process, to have a place to
// attach stub .eh_frame info. We also need to have
// registered a CIE that matches the stub CIE. Both of
// these requirements are satisfied by creating an FDE and
// CIE for .glink, even though static linking will leave
// .glink zero length.
// ??? Hopefully generating an FDE with a zero address range
// won't confuse anything that consumes .eh_frame info.
}
else if (size == 64)
{
// There is one word before __glink_PLTresolve
address += 8;
@ -2863,7 +2877,7 @@ Target_powerpc<size, big_endian>::do_plt_fde_location(const Output_data* plt,
// The first covers the branch table, the second
// __glink_PLTresolve at the end of glink.
off_t resolve_size = this->glink_->pltresolve_size;
if (oview[9] == 0)
if (oview[9] == elfcpp::DW_CFA_nop)
len -= resolve_size;
else
{