Commit Graph

1707 Commits

Author SHA1 Message Date
Nick Clifton f9d3ecaa78 Updated translations for various binutils components.
gold	* po/fi.po: Updated Finnish translation.

opcodes	* po/fr.po: Updated French translation.

gprof	* po/da.po: Update Danish translation.
2015-04-29 16:26:14 +01:00
Alan Modra faa2211d4d Tidy PowerPC gold find_global_entry uses
Completely removing the assert probably wasn't the best idea, so
reinstate it for allocated sections.  Also cope with debug info
potentially referring to a missing plt call stub.

And a tidy.  find_global_entry now returns an Address, so make temps
holding the return value of type Address, and compare against
invalid_address.

	* powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
	than unsigned int for find_global_entry result temp.  Compare
	against invalid_address.
	(Target_powerpc::do_plt_address_for_global): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.  Don't assert
	on plt call stub existence for debug info.  Do assert for plt
	and global entry stub existence if an alloc section.
2015-04-28 16:55:38 +09:30
Alan Modra 6ec65f28db PowerPC gold assertion on missing global entry stub
Global entry stubs are used on ELFv2 to provide addresses for
functions not defined in a non-PIC executable but whose address is
taken, in much the same way as PLT stub code is used on other
targets to provide function addresses.  We don't want to insert a
global entry stub just because (bogus) debug info refers to the
address of a non-local function, but we also don't want gold to die.

	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
	on missing global entry stub due to bogus debug info.
2015-04-28 13:38:56 +09:30
Han Shen 7a2a1c7935 [gold] Rename '--fix-cortex-a53' to '--fix-cortex-a53-843419'.
Keep gold consistent with bfd erratum-fixing option names, so as to
ease life in Makefile/scripts.

gold/

	* options.h (--fix-cortex-a53-843419): Rename option.
	* aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
	option.
	(AArch64_relobj::scan_sections_for_stubs): Use renamed option.
2015-04-27 15:49:41 -07:00
Rafael Ávila de Espíndola cfbf0e3c5b If a range is missing, assume the input address is mapped.
When Output_section::is_input_address_mapped is called we have entries for
all dropped ranges, but not for all ranges.
2015-04-27 14:35:17 -04:00
Sriraman Tallam a100d66fb4 Add option --weak-unresolved-symbols to treat unresolved symbols as weak ref.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.
2015-04-23 13:56:40 -07:00
Sriraman Tallam 65eb8c79be Add option --weak-unresolved-symbols to treat unresolved as weak references.
This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.

2015-04-23  Sriraman Tallam  <tmsriram@google.com>
	* options.h (--weak-unresolved-symbols): New option.
	* symtab.cc (Symbol_table::sized_write_globals): Change symbol
	binding to weak with new option.
	* symtab.h (is_weak_undefined): Check for new option.
	(is_strong_undefined): Check for new option.
	* testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/weak_unresolved_symbols_test.cc: New file.
2015-04-23 13:50:48 -07:00
Ian Coolidge 4b889c3013 Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.
gold/
	* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
	GNU_UNIQUE.
2015-04-20 18:07:49 -07:00
Rafael Ávila de Espíndola 4277535cdc Use LIFO instead of FIFO to implement gc's transitive closure.
FIFO is harder to implement and has less locality than LIFO. It is
also not necessary to implement a transitive closure, a LIFO works
just as well.
2015-04-17 11:51:36 -04:00
Han Shen 5019d64a1f [gold] The first patch to address cortex-a53 erratum-843419.
It implemented scanning the binary and reporting occurrences to users
when '--fix-cortex-a53' is turned on. With this, gold users will be
able to see if or not there are such erratum occurrences in the output
binary. Also included in the CL is reading/recording mapping symbols,
which is needed during scan.

gold/ChangeLog:
    * aarch64.cc (AArch64_insn_utilities): New utility class.
    (AArch64_relobj::Mapping_symbol_position): New struct.
    (AArch64_relobj::Mapping_symbol_info): New typedef.
    (AArch64_relobj::do_count_local_symbols): New function overriding
    parent's implementation.
    (AArch64_relobj::mapping_symbol_info_): New member
    (AArch64_relobj::scan_erratum_843419): New method.
    (Target_aarch64::scan_erratum_843419_span): New method.
    (Target_aarch64::is_erratum_843419_sequence): New method.
    * options.h (fix_cortex_a53): New option.
2015-04-16 15:26:34 -07:00
Cary Coutant a6a177507c Allow gold to resolve defined TLS symbols in a PIE link.
This patch fixes Symbol::final_value_is_known so that a defined TLS symbol
in a PIE link is treated as having a known final value, thus allowing
GD->LE TLS optimization, eliminating an unnecessary GOT entry and dynamic
relocation.

gold/
	* symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
	in a PIE link.
	* testsuite/Makefile.am (tls_pie_test.sh): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/tls_pie_test.sh: New.
2015-04-09 15:47:37 -07:00
Cary Coutant 437ddf0c4c Improve ODR checking in gold.
gold/
	* debug.h (DEBUG_LOCATION): New.
	(DEBUG_ALL): Include DEBUG_LOCATION.
	(debug_string_to_enum): Add DEBUG_LOCATION.
	* dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
	output to print correct context.
	(Sized_dwarf_line_info::do_addr2line): Add debug output. Return
	up to 4 more locations at the beginning of the function.
	* symtab.cc (Symbol_table::detect_odr_violations): Get canonical
	result before sorting list of line numbers.
	* testsuite/debug_msg.sh: Allow range of line numbers for
	canonical results on optimized code.
2015-04-09 11:53:01 -07:00
Han Shen 2449132744 Add AArch32 support for arm gold linker. 2015-04-07 17:21:27 -07:00
Rafael Ávila de Espíndola 7fa5525f8e Fix the signature of a virtual method to match the one in the parent class. 2015-04-06 15:49:50 -04:00
Rafael Ávila de Espíndola 5368dcf2ba Avoid a call to find by using the return value of insert. 2015-04-06 15:46:30 -04:00
Rafael Ávila de Espíndola 9dbb4b021d Avoid a copy constructor call. 2015-04-06 15:39:42 -04:00
Ilya Tocar 1fa29f1060 [Gold,x86_64] Convert mov foo@GOTPCREL(%rip), %reg to lea foo(%rip), %reg
2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>

	PR gold/17641
	* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
	(Target_x86_64::Scan::local): Don't create GOT entry, when we
	can convert mov to lea.
	(Target_x86_64::Scan::global): Ditto.
	(Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
	%reg to lea foo(%rip), %reg if possible.
	* testsuite/Makefile.am (x86_64_mov_to_lea): New test.
	* testsuite/x86_64_mov_to_lea1.s: New.
	* testsuite/x86_64_mov_to_lea2.s: Ditto.
	* testsuite/x86_64_mov_to_lea3.s: Ditto.
	* testsuite/x86_64_mov_to_lea4.s: Ditto.
	* testsuite/x86_64_mov_to_lea.sh: Ditto.
---
2015-04-06 12:37:34 +03:00
H.J. Lu 39f3de7c43 Regenerate configure in bfd/binutils/gas/gdb/gold
bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gdb/

	* Makefile.in (top_srcdir): New.
	* configure: Regenerated.

gold/

	* configure: Regenerated.
2015-04-02 05:45:03 -07:00
Ilya Tocar c4fc4724a6 Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>

	PR gold/17640
	* i386.cc (Target_i386::can_convert_mov_to_lea): New.
	(Target_i386::Scan::local): Don't create GOT entry, when we
	can convert GOT to GOTOFF.
	(Target_i386::Scan::global): Ditto.
	(Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
	lea foo@GOTOFF(%reg), %reg if possible.
	* testsuite/Makefile.am (i386_mov_to_lea): New test.
	* testsuite/i386_mov_to_lea1.s: New.
	* testsuite/i386_mov_to_lea2.s: Ditto.
	* testsuite/i386_mov_to_lea3.s: Ditto.
	* testsuite/i386_mov_to_lea4.s: Ditto.
	* testsuite/i386_mov_to_lea5.s: Ditto.
	* testsuite/i386_mov_to_lea.sh: Ditto.
2015-04-01 16:52:09 +03:00
H.J. Lu 918357b955 Regenerate configure in gold
Regenerate configure for zlib.m4 change, which adds --with-system-zlib and
removes --with-zlib in gold.  zlib is enabled unconditionally with builtin
zlib imported from GCC.

	* Makefile.am (ZLIB): New.
	(ZLIBINC): Likewise.
	(AM_CFLAGS): Add $(ZLIBINC).
	(AM_CXXFLAGS): Likewise.
	(ldadd_varldadd_var): Add $(ZLIB).
	(incremental_dump_LDADD): Likewise.
	(dwp_LDADD): Likewise.
	* compressed_output.cc: Don't check HAVE_ZLIB_H to include
	<zlib.h>.
	(zlib_compress): Don't check HAVE_ZLIB_H.
	(zlib_decompress): Likewise.
	* options.h (compress_debug_sections): Likewise.
	* configure.ac (AM_CONDITIONAL): Removed.
	* testsuite/Makefile.am (ZLIB): New.
	(LDADD): Add $(ZLIB).
	Don't check HAVE_ZLIB.
	* Makefile.in: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.
2015-04-01 06:40:35 -07:00
Jing Yu 6b0ad2ebf6 Support AARCH64_TLSLD_ADD_DTPREL_* relocations.
Also Change _TLS_MODULE_BASE_. Always let it point to the start
of TLS segment.

2015-03-28  Jing Yu  <jingyu@google.com>

	* aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
	TLSLD_ADD_DTPREL_LO12_NC.
	* aarch64.cc (Target_aarch64::define_tls_base_symbol): Always
	let _TLS_MODULE_BASE_ point to the start of tls segment.
	(Target_aarch64::optimize_tls_reloc): Add cases for
	R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
	R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
	(Target_aarch64::Scan::local): Likewise.
	(Target_aarch64::Scan::global): Likewise.
	(Target_aarch64::Relocate::relocate): Likewise.
	(Target_aarch64::Relocate::relocate_tls): Likewise. And remove
	subtracting tls segment size from symbol value for
	TLSLD_*_DTPREL relocations.
2015-03-30 14:11:48 -07:00
Rafael Ávila de Espíndola 0916f9e741 Avoid looking up Input_merge_map multiple times.
Avoid looking up Input_merge_map multiple times when we know were are
processing items from the same input section.
2015-03-27 09:51:15 -04:00
Alan Modra 282c975030 PR18147, relocation overflow when --unresolved-symbols=ignore-all
If ignoring unresolved symbols, ignore reloc overflows too.  If not
ignoring unresolved symbols we will report an error about the symbol
being undefined, making any report about reloc overflow superfluous.

	PR18147
	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
	relocation errors for branches to strong undefined symbols.
2015-03-24 17:06:12 +10:30
Rafael Ávila de Espíndola 67f95b96b4 Remove is_merge_section_for.
Now that Input_merge_map has an Output_section_data, we can use it in
implementing find_merge_section and replace the only use of is_merge_section_for
with it.
2015-03-23 09:16:49 -04:00
Cary Coutant 152f702439 Fix support for i386 TLS GD-to-IE optimization.
There are two cases to support, one with an SIB-form (6-byte) LEA,
the other with a 5-byte LEA and a NOP after the call __tls_get_addr.
Gold did not yet support the second case. This patch adds that
support.

gold/
	PR gold/18106
	* i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
	non-SIB form of lea, with nop after the call.
2015-03-22 11:59:21 -07:00
Cary Coutant bccffdfdf2 Fix internal error with -z relro when .tbss is last relro section.
When calculating the padding necessary to align the end of the relro
segment to a page boundary, gold erroneously ignores the .tdata section
when checking to see if there are any relro sections (so if .tdata
is the only relro section, we fail to align the segment properly),
and erroneously pads the cumulative size of the segment based on
the alignment of .tbss. If there are no relro sections following .tbss,
it then fails to note the padding needed at the end of .tdata.

This patch fixes both problems. is_first_section_relro() will return
true when it sees a .tdata section, and we do not align the cumulative
size until after checking for the .tbss section.

gold/
	PR gold/14217
	* output.cc (Output_segment::is_first_section_relro): Don't ignore
	.tdata section.
	(Output_segment::set_section_addresses): Don't align size of relro
	segment for .tbss.
2015-03-21 22:30:44 -07:00
Cary Coutant 1c582fe718 Fix bug when optimizing string pools of aligned strings.
Tail optimization of string pools (enabled when linker is run with -O2
or greater) should not be done when the section alignment is greater
than the size of the characters in the strings; otherwise, unaligned
strings may result.

gold/
	PR gold/18010
	* stringpool.cc (Stringpool_template): Don't optimize if section
	alignment is greater than sizeof(char).
2015-03-21 21:09:46 -07:00
Cary Coutant 410da591ba PR gold/18048: Fix INCLUDE directive support for gold
This patch fixes INCLUDE directives in script files, so that when
an INCLUDE appears inside a sections block, section commands block,
or memory def block, the contents are parsed in the appropriate
context.

gold/
	PR gold/18048
	* script-c.h (script_include_directive): Add first_token parameter.
	* script.cc (script_include_directive): Add first_token parameter, and
	pass it to read_script_file.
	* yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
	(PARSING_MEMORY_DEF): New tokens.
	(top): Add new productions for INCLUDE files.
	(file_cmd): Replace file_or_sections_cmd with copy of its productions.
	Pass PARSING_LINKER_SCRIPT to script_include_directive.
	(section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
	(section_cmd): Pass PARSING_SECTION_CMDS.
	(file_or_sections_cmd): Remove.
	(memory_def): Pass PARSING_MEMORY_DEF.
	* testsuite/Makefile.am (memory_test_2): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/memory_test_inc.t: New script file.
	* testsuite/memory_test_inc_1.t.src: New script file.
	* testsuite/memory_test_inc_2.t.src: New script file.
	* testsuite/memory_test_inc_3.t.src: New script file.
2015-03-21 19:54:15 -07:00
Cary Coutant 0d5bbdb0e1 Support compressed debug sections in dynamic object files.
This patch adds support for reading compressed debug info in
shared objects. It actually simplifies things, by moving the
support for compressed sections all the way up to the top-level
Object class, eliminating the need for several virtual methods.

gold/
	* dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
	(Sized_relobj_dwo::setup): Build compressed section map.
	(Sized_relobj_dwo::do_decompressed_section_contents): Delete.
	* dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
	section map.
	* object.cc (Sized_relobj_file::Sized_relobj_file): Remove
	compressed_sections_ field.
	(build_compressed_section_map): Take Object instead of
	Sized_relobj_file parameter; add decompress_if_needed parameter.
	(Sized_relobj_file::do_find_special_sections): Store compressed
	section map in parent Object.
	(Sized_relobj_file::do_decompressed_section_contents): Move
	implementation to Object::decompressed_section_contents.
	(Sized_relobj_file::do_discard_decompressed_sections): Move
	implementation to Object::discard_decompressed_sections.
	* object.h (build_compressed_section_map): Declare.
	(Object::Object): Add compressed_sections_ field.
	(Object::section_is_compressed): Move implementation here.
	(Object::decompressed_section_contents): De-virtualize.
	(Object::discard_decompressed_sections): De-virtualize.
	(Object::do_section_is_compressed): Delete.
	(Object::do_decompressed_section_contents): Delete.
	(Object::set_compressed_sections): New method.
	(Object::compressed_sections): New method.
	(Object::compressed_sections_): New data member.
	(Compressed_section_info, Compressed_section_map): Move to top of file.
	(Sized_relobj_file::do_section_is_compressed): Delete.
	(Sized_relobj_file::do_decompressed_section_contents): Delete.
	(Sized_relobj_file::do_discard_decompressed_sections): Delete.
	(Sized_relobj_file::compressed_sections_): Move to Object class.
2015-03-21 18:50:11 -07:00
Cary Coutant bd9e0d4628 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.
2015-03-21 17:49:21 -07:00
Cary Coutant 943c8b4393 Fix gold incremental test failures.
Newer version of GCC pass -z relro to the linker, but incremental linking
does not support relro. This patch adds a check to complain about the
conflict, and changes the testsuite to pass -z norelro to the incremental
tests.

2015-03-11  Cary Coutant  <ccoutant@google.com>

gold/
	* options.cc (General_options::finalize): Don't allow -z relro
	with incremental linking.
	* testsuite/Makefile.am (incremental_test): Add -z norelro.
	(incremental_test_2): Likewise.
	(incremental_test_3): Likewise.
	(incremental_test_4): Likewise.
	(incremental_test_5): Likewise.
	(incremental_test_6): Likewise.
	(incremental_copy_test): Likewise.
	(incremental_common_test_1): Likewise.
	(incremental_comdat_test_1): Likewise.
	* testsuite/Makefile.in: Regenerate.
2015-03-11 22:07:51 -07:00
Cary Coutant e16631979e 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.
2015-03-09 10:12:06 -07:00
H.J. Lu beb8418f47 Remove typename on elfcpp::Elf_types<size>::Elf_Addr
GCC 4.2 complains:

binutils/gold/object.cc:3261: error: using ‘typename’ outside of template

This patch removes typename.  It works with both GCC 4.2 and 4.8.

	* output.cc (Relobj::initialize_input_to_output_map<size>):
	Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
2015-03-05 07:52:41 -08:00
Cary Coutant 48c734280a Fix a race condition when setting default target for ARM targets.
gold/
	* parameters.cc (Parameters::set_target_once): Call
	Target::select_as_default_target just once from here...
	(set_parameters_target): ...instead of from here.
2015-03-04 15:17:23 -08:00
Rafael Ávila de Espíndola dbe40a8891 Remove empty class Merge_map.
2015-03-02  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

	* ehframe.cc (Cie::set_output_offset): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Eh_frame::Eh_frame): Don't initialize merge_map_.
	(Eh_frame::read_cie): Use add_merge_mapping instead of
	Merge_map::add_mapping.
	(Eh_frame::read_fde): Ditto.
	(Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
	(Eh_frame::do_output_offset): Use merge_output_offset istead of
	merge_map_->get_output_offset.
	(Eh_frame::do_is_merge_section_for): Delete.
	* ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
	instead of a Merge_map.
	(Cie::set_output_offset): Pass in a Output_section_data instead of a
	Merge_map.
	(Eh_frame::do_is_merge_section_for): Delete.
	(Eh_frame::merge_map_): Delete.
	* merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
	and use a Output_section_data instead of a Merge_map.
	(Object_merge_map::add_mapping): Ditto.
	(Object_merge_map::get_output_offset): Remove the merge_map argument.
	(Object_merge_map::is_merge_section_for): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Merge_map): Delete.
	(Output_merge_base::do_output_offset): Use merge_output_offset instead
	of merge_map_.get_output_offset.
	(Output_merge_base::do_is_merge_section_for): Delete.
	(Output_merge_data::do_add_input_section): Use
	object->add_merge_mapping instead of add_mapping.
	(Output_merge_string<Char_type>::finalize_merged_data): Ditto.
	* merge.h (Merge_map): Delete forward declaration.
	(Object_merge_map::add_mapping): Pass in and use a Output_section_data
	instead of a Merge_map.
	(Object_merge_map::get_output_offset): Remove the merge_map argument.
	(Object_merge_map::is_merge_section_for): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Input_merge_map::Object_merge_map::merge_map): Replace with
	output_data.
	(Object_merge_map::get_or_make_input_merge_map): Pass in and use a
	Output_section_data instead of a Merge_map.
	(Merge_map): Delete.
	(Output_merge_base::Output_merge_base): Don't initialize merge_map_.
	(Output_merge_base::do_is_merge_section_for): Delete.
	(Output_merge_base::add_mapping): Delete.
	(Output_merge_base::merge_map_): Delete.
	* object.cc (Relobj::initialize_input_to_output_map): New.
	(Relobj::initialize_input_to_output_map): New.
	(Relobj::merge_output_offset): New.
	(Relobj::is_merge_section_for): New.
	(Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
	bits.
	* object.h (Relobj::merge_map): Delete.
	(initialize_input_to_output_map): New.
	(set_merge_map): Delete.
	(add_merge_mapping): New.
	(merge_output_offset): New.
	(is_merge_section_for): New.
	* output.cc (Output_section::Input_section::is_merge_section_for):
	Use object->is_merge_section_for.
	* output.h (Output_section_data::is_merge_section_for): Delete.
	(Output_section_data::do_is_merge_section_for): Delete.
	* reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
	Use object->initialize_input_to_output_map.
	(Merged_symbol_value<size>::value_from_output_section): Use
	object->merge_output_offset.
2015-03-04 15:10:18 -08:00
Cary Coutant 2c7b626cee Fix crash when processing merge section with entsize of 0.
2015-02-04  Peter Collingbourne  <pcc@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
	* output.cc (Output_section::add_merge_input_section): Do not
	attempt to merge sections with an entsize of 0.
2015-03-02 10:20:21 -08:00
Cary Coutant 5b07cd848d Fix an internal error in do_print_to_mapfile on Arm.
2015-02-02  Khem Raj  <raj.khem@gmail.com>

gold/
	* attributes.h (class Output_attributes_section_data ): Add
	do_print_to_mapfile function.
2015-03-02 10:10:52 -08:00
Alan Modra ec86f43468 PowerPC64 GOLD: complain on misaligned _DS relocs
PR 18010
	* powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
	complain if value is not a multiple of four.
	(Target_powerpc::Relocate::relocate): Correct handling of
	R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
2015-02-24 18:21:39 +10:30
H.J. Lu be66981e16 Set GOLD_DEFAULT_SIZE to 32 for x32
* configure.ac (default_size): Set to 32 for x32.
	* configure: Regenerated.
2015-02-22 12:26:27 -08:00
Alan Modra e3ee8ed41b Fix gold error: hidden symbol '...' is not defined locally
Found when applying relocs in .debug that reference removed functions.

	PR 17954
	* powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
	visibility.
2015-02-18 22:51:14 +10:30
Rafael Ávila de Espíndola 3a935c6cf9 Simplify Garbage_collection::add_reference a bit.
this->section_reloc_map_[src_id] is created if it doesn't exist, so there
is no point in doing a find.
2015-02-17 10:49:41 -05:00
Rafael Ávila de Espíndola e0a1e121b3 avoid std::vector copy. 2015-02-17 10:47:02 -05:00
Rafael Ávila de Espíndola 45a4fb1a70 Use std::upper_bound to simplify code a bit.
With std::upper_bound we don't have to check p->input_offset > input_offset.
2015-02-17 10:44:37 -05:00
Mark Wielaard 2d9afefe22 [gold] Recognize DWARF5/GCC5 DW_LANG_Fortran03 and DW_LANG_Fortran08.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both in gold gdb-index
as unsupported.

For consistency also add the other new DWARF5/GCC5 language constants in
the elfcpp::DW_LANG enum to match include/dwarf2.h.

elfcpp/ChangeLog:

	* dwarf.h (enum DW_LANG): Add DW_LANG_C_plus_plus_11,
	DW_LANG_C11, DW_LANG_C_plus_plus_14, DW_LANG_Fortran03 and
	DW_LANG_Fortran08 from ../include/dwarf2.h.

gold/ChangeLog:

	* gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
	DW_LANG_Fortran03 and DW_LANG_Fortran08.
2015-02-17 08:08:24 +01:00
Cary Coutant e9c1bdad26 Fix --dynamic-list so that symbols not in the list are still exported.
In PR 13577, the complaint was that -Bsymbolic was overriding the binding
behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
tag in the dynamic table. In reading the Gnu ld manual, I decided that
--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
gold so that --dynamic-list would treat symbols listed as preemptible,
and all other symbols as internally bound. I was wrong.

PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
not listed in the dynamic list is being internally bound within the
shared library, but because it's still in the dynamic symbol table, we
expose it to a COPY relocation, and things go really bad from there.

(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
with the Gnu linker. Even though the symbol is bound internally, it's
still exported to the dynamic symbol table, and is exposed to a COPY
relocation.)

I've backed out part of the fix for PR 13577, and -Bsymbolic (or
-Bsymbolic-functions) can now be used with --dynamic-list, but if the
two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
(this matches Gnu ld behavior). We now treat symbols listed in the
dynamic list as premptible, but we do not automatically treat symbols
not listed there as non-premptible.

gold/
	PR gold/13577
	PR gold/16992
	* layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
	DF_SYMBOLIC if --dynamic-list option is used.
	* options.cc (General_options::finalize): --dynamic-list is not
	mutually exclusive with -Bsymbolic.
	* symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
	listed in --dynamic-list.
	* testsuite/Makefile.am (dynamic_list_lib2.so): Add
	-Bsymbolic-functions.
	* testsuite/Makefile.in: Regenerate.
2015-02-16 22:15:12 -08:00
Cary Coutant 0ed4b0bf3d Remove redundant include of "output.h".
gold/
	PR gold/17971
	* incremental.cc: Remove redundant include of "output.h".
2015-02-16 20:15:07 -08:00
Jing Yu 1a920511af Add missing TLSLE relocations for gold aarch64 backend.
gold/ChangeLog:
	* aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
	TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
	New relocation.
	* aarch64.cc (Target_aarch64::Scan::local): Add cases for new
	TLSLE_MOVW_* relocations.
	(Target_aarch64::Scan::global): Likewise.
	(Target_aarch64::Relocate::relocate): Likewise.
	(Target_aarch64::Relocate::relocate_tls): Add cases and handlings
	for new TLSLE_MOVW_* relocations.
2015-02-12 14:51:57 -08:00
Will Newton 07f107f306 gold/arm.cc: Output mapping symbol for PLT code
Output an ARM state mapping symbol at the start of the PLT. With the
current code objdump will fail to disassemble the PLT that gold
creates.

gold/ChangeLog:

2015-02-11  Will Newton  <will.newton@linaro.org>

	PR gold/13321
	* arm.cc (Target_arm::make_plt_section): Create an ARM
	state mapping symbol at the start of the PLT.
2015-02-11 15:18:59 +08:00
H.J. Lu e051a5b512 Replace two_file_shared_2.so with two_file_shared_1.so
There are

two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so

There should be two_file_shared_1.so, not two_file_shared_2.so in
two_file_shared_2_pic_1_test_DEPENDENCIES.

	* testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
	Replace two_file_shared_2.so with two_file_shared_1.so.
	* testsuite/Makefile.in: Regenerated.
2015-02-09 05:36:02 -08:00
Alan Modra dddcc5b9a8 Gold testsuite make clean
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
	plugin_test_thin.a and defsym_test.
	* testsuite/Makefile.in: Regenerate.
2015-02-09 13:19:53 +10:30