Commit Graph

1900 Commits

Author SHA1 Message Date
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
Rafael Ávila de Espíndola b39b8b9d90 Combine loop epilogue into main loop body to reduce duplication. 2015-02-04 17:37:05 -05:00
Cary Coutant b66d1c52ac Add missing ChangeLog entry. 2015-02-04 10:36:25 -08:00
Peter Collingbourne 3c537f7fdb Resolve forwarding symbols in plugins.
2015-02-04  Peter Collingbourne  <pcc@google.com>

	* plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
	forwarding symbols when computing symbol resolution info for plugins.
2015-02-04 09:48:22 -08:00
Cary Coutant 23081de018 Add missing ChangeLog entries. 2015-02-03 20:18:25 -08:00
Cary Coutant 2cfbf2fece Fix a file descriptor leak in gold.
When an LTO linker plugin claims an external member of a thin archive, gold
does not properly unlock the file and make its file descriptor available for
reuse. This patch fixes the problem by modifying Archive::include_member to
unlock the object file via an RAII class instance, ensuring that it will be
unlocked no matter what path is taken through the function.

gold/
	PR gold/15660
	* archive.cc (Thin_archive_object_unlocker): New class.
	(Archive::include_member): Unlock external members of thin archives.
	* testsuite/Makefile.am (plugin_test_1): Rename .syms files.
	(plugin_test_2): Likewise.
	(plugin_test_3): Likewise.
	(plugin_test_4): Likewise.
	(plugin_test_5): Likewise.
	(plugin_test_6): Likewise.
	(plugin_test_7): Likewise.
	(plugin_test_8): Likewise.
	(plugin_test_9): Likewise.
	(plugin_test_10): Likewise.
	(plugin_test_11): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
	file to decide whether to claim file.
	(all_symbols_read_hook): Likewise.
	* testsuite/plugin_test_1.sh: Adjust expected output.
	* testsuite/plugin_test_2.sh: Likewise.
	* testsuite/plugin_test_3.sh: Likewise.
	* testsuite/plugin_test_6.sh: Likewise.
	* testsuite/plugin_test_tls.sh: Likewise.
	* testsuite/plugin_test_11.sh: New testcase.
2015-02-03 20:03:42 -08:00
Cary Coutant 8265ef9502 Add extra debugging output for files and descriptors.
gold/
	* descriptors.cc (Descriptors::open): Set artificially-low limit for
	file descriptors when debugging enabled. Add debug output.
	(Descriptors::release): Add debug output.
	(Descriptors::close_some_descriptor): Likewise.
	(Descriptors::close_all): Likewise.
	* fileread.cc (File_read::lock): Likewise.
	(File_read::unlock): Likewise.
2015-02-03 20:03:41 -08:00
Cary Coutant 24dd580891 Fix bug with previous patch for unresolved TLS symbol.
We need to check that the output is executable before assuming that we
can replace the reference with zero.

2015-02-02  Cary Coutant  <ccoutant@google.com>

gold/
	* x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
	executable output file.
2015-02-02 11:46:45 -08:00
Han Shen fa89cc82f5 This patch adds IFUNC support for arm gold backend.
This is a feature required in chromeos arm development work.

Tested:
1) Built passed all-gold on x86_64 machine
2) Tested with basic gold aarch64 ifunc unittests -
   a) global ifunc, statically/non-statically linked
   b) local ifunc, statically/non-statically linked
   c) global/local, other shared library routine mixed,
   statically/non-statically linked
   d) arm/thumb mode ifunc
   e) linking chrome browser passed
2015-01-29 10:15:42 -08:00
Alan Modra 0f81d3f0a7 Correct GOLD PowerPC64 local-dynamic TLS linker optimization
Similar to b86ac8e3

	* powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
	and GOT_TLSGD to LE optimization.
2015-01-29 20:34:45 +10:30
Cary Coutant 65d9213705 Allow undefined references to TLS symbols.
When --warn-unresolved-symbols is used, gold tries to create a dynamic relocation
for it, and gives an internal error if the TLS segment has not already been
created. This patch allows the IE-to-LE optimization for an undefined symbol
when building an executable, which suppresses the dynamic relocation, and
relaxes the requirement to have a TLS segment when applying a relocation for
an undefined symbol.

2015-01-28  Cary Coutant  <ccoutant@google.com>

gold/
	* x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
	for undef TLS symbols.
	(Target_x86_64::Relocate::relocate_tls): Likewise.
	(Target_x86_64::Relocate::tls_ie_to_le): Likewise.
2015-01-28 15:39:08 -08:00
Cary Coutant 5485698ae4 2015-01-25 Cary Coutant <ccoutant@google.com>
gold/
	* output.cc (Output_segment::set_section_addresses): Fix calculation
	of size of relro segment.
2015-01-25 17:31:32 -08:00
Alan Modra b01a4b043a [GOLD] Correct powerpc64 ifunc plt entry test
Found when attempting to build an ELFv2 Linux kernel.  We don't
generally need a plt entry for ELFv2 got relocs, only on ifunc, just
like ppc32.

	* powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
	condition for need of ifunc plt entry.
	(Target_powerpc::Scan::global <got relocs>): Likewise.
2015-01-22 15:42:45 +10:30
Cary Coutant 3d0064a95d Fix a bug in resolving HI16/LO16 relocation pairs for MIPS.
2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* mips.cc (reloc_high): Add r_sym.
	(Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
	reloc_high constructor.
	(Mips_relocate_functions::relgot16_local): Likewise.
	(Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
	r_type to decide whether LO16 matches HI16.
	(Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
	rello16 and relgot16_local.
2015-01-14 10:30:14 -08:00
Cary Coutant a5cd8f05ca Don't align start of segment unless alignment is larger than page size.
This fixes an issue where a page-aligned data section, combined with -z relro,
could lead to a gap between text and data segments larger than a page, and
we would fail to overlap the segments in the file.

gold/
	* layout.cc (Layout::set_segment_offsets): Don't align start of segment
	unless alignment is larger than page size.
2015-01-09 15:58:39 -08:00
H.J. Lu 4fc1b9d43c Handle stack split for x32
X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.

	PR gold/17729
	* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
	(DEFAULT_TARGET_X32): Set for x32.
	* x86_64.cc (cmp_insn_32): New.
	(lea_r10_insn_32): Likewise.
	(lea_r11_insn_32): Likewise.
	(cmp_insn_64): Likewise.
	(lea_r10_insn_64): Likewise.
	(lea_r11_insn_64): Likewise.
	(Target_x86_64<size>::do_calls_non_split): Handle x32.
	* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
	(check_DATA): Add split_x32 files.
	(split_x32_[1234n].o): New targets.
	(split_x32_[124]): New targets.
	(split_x32_[1234r].stdout): New targets.
	* testsuite/split_x32.sh: New file.
	* testsuite/split_x32_1.s: Likewise.
	* testsuite/split_x32_2.s: Likewise.
	* testsuite/split_x32_3.s: Likewise.
	* testsuite/split_x32_4.s: Likewise.
	* testsuite/split_x32_n.s: Likewise.
	* configure: Regenerated.
	* testsuite/Makefile.in: Likewise.
2015-01-06 15:38:25 -08:00
H.J. Lu e749cab89d Handle Initial-Exec to Local-Exec for x32
PR gold/17809
	* x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
	x32.
2015-01-06 12:58:54 -08:00
Alan Modra 2f5346cd7c Regenerate Makeile.in file for copyright update 2015-01-02 22:27:27 +10:30
Alan Modra af759df025 Correct printed year in copyright notices for gold. 2015-01-02 08:51:43 +10:30
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Alan Modra f12d1e8a66 ARM: Add support for value 3 of Tag_ABI_VFP_args attribute
Missing from 5c294fee

elfcpp/
	* arm.h: Add enums for Tag_ABI_FP_number_model and Tag_ABI_VFP_args.
gold/
	* arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
	new enums.
	(Target_arm::merge_object_attributes, ): Likewise.
2014-12-25 22:22:25 +10:30
Terry Guo 5c294fee9a ARM: Add support for value 3 of Tag_ABI_VFP_args attribute
*** bfd/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
	Tag_ABI_VFP_args value and replace hardcoded values by enum
	values.
	(elf32_arm_post_process_headers): Set e_flags in ELF header
	as hard float only when Tag_ABI_VFP_args is 1, using new enum
	value AEABI_VFP_args_vfp to check that.

*** binutils/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible".

*** gdb/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of
	Tag_ABI_VFP_args. Also replace hardcoded values by enum values
	in the switch handling the different values of Tag_ABI_VFP_args.

*** gold/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF
	header as hard float only when Tag_ABI_VFP_args is 1, using new
	enum value AEABI_VFP_args_vfp to check that.
	(Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
	value and replace hardcoded values by enum values.

*** include/elf/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum
	values.

*** ld/testsuite/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args.
	* ld-arm/attr-merge-2b.s: Likewise.
	* ld-arm/attr-merge-2.attr: Likewise.
	* ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and
	Tag_ABI_VFP_args.
	* ld-arm/attr-merge-4b.s: Likewise.
	* ld-arm/attr-merge-4.attr: Likewise.
	* ld-arm/attr-merge-6a.s: Likewise.
	* ld-arm/attr-merge-6b.s: Likewise.
	* ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.
2014-12-25 09:55:03 +08:00
Cary Coutant e30880c2ee gold/
* powerpc.cc (Target_powerpc::relocate): Fix overflow check.
2014-12-22 10:13:37 -08:00
H.J. Lu bd040da1db Change SometimesInlineFunction to "return i * i * 3;"
The debug_msg test has 2 implementations of SometimesInlineFunction:

int SometimesInlineFunction(int i) { return i; }
int SometimesInlineFunction(int i) { return i * i; }

and One Definition Rule (ODR) violation detection expects they will be
compiled into functions of different sizes.  Hower, on x86, GCC 4.7 and
newer compile them into functions of the same size and ODR violation
detection test fails.  This patch changes

int SometimesInlineFunction(int i) { return i; }

to

int SometimesInlineFunction(int i) { return i * i * 3; }

so that it will be compiled into a function of larger size.

	PR gold/14608
	* testsuite/debug_msg.cc (SometimesInlineFunction): Changed
	to "return i * i * 3;".
2014-12-20 08:05:45 -08:00
Cary Coutant e02a4046e0 Fix internal error in gold when -Map and --compress-debug-sections are used
together.

gold/
	* mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
	(Mapfile::print_output_data): Use current_data_size() to avoid
	assert for sections requiring postprocessing; if address is not valid,
	print 0.
	(Mapfile::print_output_section): Use current_data_size(); print note
	that addresses and sizes are before compression.
2014-12-16 14:58:15 -08:00
H.J. Lu add6016bac Cast current_group_size to unsigned long
* aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
	Cast current_group_size to unsigned long when reporting error.
2014-12-14 06:59:20 -08:00
Jing Yu 0bf32ea9e6 Give informative error message for stub-group-size
This patch gives current stub-group-size in error message when stub
is too far away.

	* aarch64.cc (Target_aarch64): Add new variable: stub_group_size_.
	(AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
	Update error message.
	(Target_aarch64::do_relax): Use absolute value of option
	stub_group_size. Replace local variable with class member
	stub_group_size_.
2014-12-10 15:39:13 -08:00
Alan Modra fbad6518c1 ChangeLog typo fix 2014-12-04 22:20:53 +10:30
Alan Modra cbcb23fa01 PowerPC gold, fix 32-bit branch address arithmetic
Mixing 64-bit and 32-bit types led to the wrong promotions.  Keep
calculation in same type.  Also fix a case where PLTREL25 reloc addend
should be ignored.

	* Powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
	addend of PLTREL24 reloc when not generating a plt stub.  Make
	max_branch_offset an "Address".
	(Stub_table::can_read_stub): Make max_branch_offset an "Address".
	(Target_powerpc::Relocate::relocate): Likewise.
2014-12-04 21:17:54 +10:30
Alan Modra 1611bc4afb powerpc gold, work around pr17670
pr17670 is about an assert triggering on a branch to an undefined
weak symbol, the symbol being undefined due to dropping its comdat
group section.  (Well sort of.  The symbol is actually defined in
an .opd section which isn't part of the group, but the code section
the opd entry points at is dropped.)  So don't assert.
Also, don't make long branch stubs to such symbols, and arrange to
have target-reloc.h code warn when applying relocs that use the sym.

	PR 17670
	* symtab.cc (Symbol::set_undefined): Remove assertion.
	* powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
	on symbols defined in discarded sections, instead return false.
	Rearrange params, update all callers.
	(Target_powerpc::Branch_info::make_stub): Don't make stubs for
	branches to syms in discarded sections.
	(Global_symbol_visitor_opd::operator()): Set discarded opd syms
	undefined and flag as discarded.
	(Target_powerpc::Relocate::relocate): Localize variable.
2014-12-04 09:23:59 +10:30
H.J. Lu 4759c34e12 Compile pie_copyrelocs_test.cc with -fno-exceptions -fno-asynchronous-unwind-tables
PR gold/17675
	* testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
	* testsuite/Makefile.in: Regenerated.
2014-12-03 10:59:46 -08:00
Alan Modra 1f98a0748c powerpc gold, fix pr17566
Code stolen from arm.cc.

	PR 17566
	* powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
	when adding dynamic relocations against section symbols.
2014-12-04 01:09:55 +10:30
Dmitriy Ivanov fb25783533 Add support for -z global.
gold/
	* layout.cc (Layout::finish_dynamic_section): When '-z global'
	is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
	* options.h (General_options): New -z option (global).
2014-12-01 13:37:38 -08:00
Cary Coutant d8e603148f Fix extraneous warning about executable stack.
PR gold/17578 notes that gold will print a warning about an executable stack
when the -z execstack option is given, even when there is no --warn_execstack
option. The warning is completely useless and unexpected, since the user
explicitly requested an executable stack, and did not even ask for warnings.

This patch fixes that, and adds an extra warning when --warn_execstack
and -z noexecstack are both given and an input file requires an executable
stack.

gold/
	PR gold/17578
	* layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
	is given.
	(Layout::create_executable_stack_info): Warn when -z noexecstack is
	given but some inputs require executable stack.
2014-12-01 13:21:49 -08:00
Cary Coutant 982bbd97c5 Update list of debug sections for --strip-debug-xxx options.
Add .debug_gdb_scripts, .debug_gnu_pubnames, .debug_gnu_pubtypes,
and .debug_str_offsets to lists of sections to strip or keep
when stripping debug info.

gold/
	* layout.cc (gdb_sections): Keep .debug_gdb_scripts and
	.debug_str_offsets; strip .debug_gnu_pubnames and
	.debug_gnu_pubtypes.
	(lines_only_debug_sections): Strip all four new sections.
2014-11-26 14:41:46 -08:00
Han Shen bb779192ae Fix for gold linking tlsdesc into an executable with -pie.
(Also included in this patch is a minor typo fix in gold/ChangeLog.)

When linking the following tlsdesc access sequence into an executable with -pie,

     adrp    x0, :tlsdesc:tls_gd
     ldr     x1, [x0, #:tlsdesc_lo12:tls_gd]
     add     x0, x0, :tlsdesc_lo12:tls_gd
     .tlsdesccall    tls_gd
     blr	     x1
     mrs	     x1, tpidr_el0
     add	     x0, x1, x0
     ldr	     w0, [x0]

current gold-aarch64 backend does tls-desc-gd-to-ie relaxation, into

       adrp    x0, 1000 <__FRAME_END__+0x720>
       ldr     x1, [x0,#4064]	  ;; <=== the target register should be x0
       nop
       nop
       mrs	x1, tpidr_el0
       add	x0, x1, x0
       ldr	w0, [x0]

This code is wrong. The fix changes ldr target register into x0.
2014-11-26 10:34:46 -08:00
Alan Modra a3e60ddb0b Retry powerpc gold stub grouping when groups prove too large
An unusually large number of stubs can result in the default section
group size being too large;  sections plus stubs exceed the range of a
branch.  Restarting the relaxation pass with a smaller group size can
sometimes help.

	* powerpc.cc (struct Stub_table_owner): New.
	(Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
	unsigned int vector.  Update all references.
	(powerpc_relobj::set_stub_table): Take an unsigned int param
	rather than a Stub_table.  Update callers.
	(Powerpc_relobj::clear_stub_table): New function.
	(Target_powerpc): Add relax_failed_, relax_fail_count_ and
	stub_group_size_ vars.
	(Target_powerpc::new_stub_table): Delete.
	(max_branch_delta): New function, extracted from..
	(Target_powerpc::Relocate::relocate): ..here..
	(Target_powerpc::Branch_info::make_stub): ..and here.  Return
	status on whether stub created successfully.
	(Stub_control::Stub_control): Add "no_size_errors" param.  Move
	default sizing to..
	(Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
	reduce on relax failure.
	(Target_powerpc::group_sections): Add "no_size_errors" param.
	Use stub_group_size_.  Set up group info in a temp vector,
	before building Stub_table vector.  Account for input sections
	possibly already converted to relaxed sections.
	(Stub_table::init): Delete.  Merge into..
	(Stub_table::Stub_table): ..here.
	(Stub_table::can_reach_stub): New function.
	(Stub_table::add_plt_call_entry): Add "from" parameter and
	return true iff stub could be reached.
	(Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
	param too.
	(Stub_table::clear_stubs): Add "all" param.
2014-11-26 13:29:29 +10:30
Alan Modra a20605cf85 [GOLD] PowerPC relaxation corner case
It's possible for the section grouping code to decide that the last
section looked at (the first section by address) doesn't fit into a
group.  In one case that section is already a group owner and that is
handled correctly.  In other cases the section should be put into its
own group.  Like this:

	* powerpc.cc (Stub_control::set_output_and_owner): New function.
	(Target_powerpc::group_sections): Use it.
2014-11-26 10:50:33 +10:30
Cary Coutant 43b64debe3 Add file size to ELF symbol labelling start of a binary file.
gold/
	* binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
	(Binary_to_elf::write_symbol): Add st_size parameter.
	* binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
2014-11-25 14:33:51 -08:00
Cary Coutant c924eb67e1 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.
2014-11-25 13:56:21 -08:00
H.J. Lu 9d58518888 Check PC-relative offset overflow in PLT entry
PR gold/17619
	* x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
	Check PC-relative offset overflow in PLT entry.
2014-11-21 11:26:56 -08:00
Alan Modra 3ffaac206b PPC gold doesn't check for overflow properly
* powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
	for undefined weaks.
2014-11-21 08:16:22 +10:30
Alan Modra 0cfb071748 PPC gold doesn't check for overflow properly
Corrects overflow test for rel14, addr14, rel24, addr24 branch relocs,
and prints an information message to give a hint as to how a branch
that can't reach a stub might be cured.

bfd/
	* elf64-ppc.c (group_sections): Init stub14_group_size from
	--stub-group-size parameter divided by 1024.
gold/
	* powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
	from --stub-group-size parameter divided by 1024.
	(Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
	template parameter.  Update all uses.
	(Target_powerpc::Relocate::relocate): Rename has_plt_value to
	has_stub_value.  Set for long branches.  Don't report overflow for
	branch to undefined weak symbols.  Print info message on
	overflowing branch to stub.
2014-11-20 21:37:05 +10:30
Alan Modra f9dffbf086 Default powerpc64 to --plt-thread-safe for Go
Go is multi-threaded, so use thread-safe plt stubs.  __go_go doesn't
actually start threads, but is a convenient libgo function with a
reasonably unique name that is called by all Go executables.  (Threads
are started by a static function of libgo, runtime_newosproc, called
by a whole lot of global functions, including runtime_starttheworld
and runtime_main.)

bfd/
	* elf64-ppc.c (ppc64_elf_size_stubs): Add __go_go to thread_starters.
gold/
	* powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
2014-11-20 08:57:31 +10:30
H.J. Lu e88ba8d569 Don't make PLT entry for R_X86_64_GOTPLT64
* x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
	entry for R_X86_64_GOTPLT64.
	(Target_x86_64<size>::Relocate::relocate): Update comments for
	R_X86_64_GOTPLT64.
2014-11-14 16:47:15 -08:00
Evgeniy Dushistov d37ffe2537 Fix race condition when using --threads with linker plugins.
2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>

gold/
	* plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
	* plugin.h: add lock definition
2014-11-07 16:12:58 -08:00
Han Shen 9726c3c179 Misc about gold for aarch64 backend.
The patch does the following things:
  -- Add support for ifunc.
  -- Enable safe icf
  -- Add support for TLSLD relocations
     R_AARCH64_TLSLD_ADR_PAGE21,
     R_AARCH64_TLSLD_ADD_LO12_NC,
     R_AARCH64_TLSLD_MOVW_DTPREL_G1,
     R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC.
     (R_AARCH64_TLSLD_MOVW_* are used by LLVM.)
  -- Add support for TLSLD->TLSLE relaxation.
  -- Add support for R_AARCH64_LD_PREL_LO19, R_AARCH64_ADR_PREL_LO21.
  -- Fix 2 encoding bugs in AArch64_relocate_functions::update_movnz.
  -- Correct TLS relocation properties in gold/aarch64-reloc.def.
  -- Update testsuite/icf_safe_so_test.cc, testsuite/icf_safe_test.sh.

gold/
2014-10-29  Han Shen  <shenhan@google.com>
            Jing Yu   <jingyu@google.com>

	* aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
	TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
	TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
	Symbol::TLS_REF.
	* aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
	method.
	(Target_aarch64::reloc_needs_plt_for_ifunc): New method.
	(Target_aarch64::tls_ld_to_le): New method.
	(Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
	for 64bit targets.
	(Output_data_plt_aarch64::irelative_rel_): New data member.
	(Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
	(Output_data_plt_aarch64::add_local_ifunc_entry): New method.
	(Output_data_plt_aarch64::add_relocation): New method.
	(Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
	offset. Add got_irelative size to got size.
	(AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
	type string with the new typename.
	(AArch64_relocate_functions::update_adr): Replace parameter x with
	immed.
	(AArch64_relocate_functions::update_movnz): Correct wrong val mask.
	(AArch64_relocate_functions::reloc_common): New method.
	(AArch64_relocate_funcsions::rela_general): Extract common part out
	into reloc_common method.
	(AArch64_relocate_functions::rela_general): Likewise.
	(AArch64_relocate_functions::pcrela_general): Likewise.
	(AArch64_relocate_functions::adr): New method.
	(AArch64_relocate_functions::adrp): Calculate immed before calling
	update_adr.
	(AArch64_relocate_functions::adrp): Likewise.
	(AArch64_relocate_functions::movnz): Cast x to SignedW type when
	comparing x to 0. Calculate immed from ~x when x < 0.
	(Target_aarch64::optimize_tls_reloc): Add new cases for
	TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
	TLSLD_MOVW_DTPREL_G0_NC.
	(Target_aarch64::possible_function_pointer_reloc): Implement this
	method.
	(Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
	comment.
	(Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
	symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
	TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
	(Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
	symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
	TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
	(Target_aarch64::make_plt_entry): Call add_entry with two more
	parameters.
	(Target_aarch64::make_local_ifunc_plt_entry): New method.
	(Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
	ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
	TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
	(Target_aarch64::Relocate::relocate_tls): Add cases for
	TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
	TLSLD_MOVW_DTPREL_G0_NC.
	* testsuite/icf_safe_so_test.cc: Correct test comment.
	* testsuite/icf_safe_test.sh: Add AArch64 arch.
2014-10-29 11:31:36 -07:00
Alan Modra 80272b8cb9 [GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7
As for bfd.ld.  Refer 2300b5a14

	* powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
	thread_starter.
2014-10-22 08:10:47 +10:30
Andreas Schwab 998a69f46a * configure.tgt (targ_extra_obj) [aarch64*-*]: Define. 2014-10-18 10:31:31 +02:00
Cary Coutant aed56ec5f2 Add "typename" keyword to satisfy GCC 4.2.
gold/
	* aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
	Add "typename" keyword.
2014-10-17 16:24:20 -07:00
Han Shen 83a0195717 Here we have the patch for gold aarch64 backend to support relaxation.
In short relaxation is the linker's generation of stubs that fixes the
out-of-range jumps/branches in the original object file.

With this implementation, we are able to link a 456MB aarch64 application.

Tested:
1) Build natively on x86_64 and aarch64 machines.
2) Pass unit tests regarding relaxation.
2014-10-15 15:23:01 -07:00
Cary Coutant db4c959472 Fix error from previous patch where tosize and tovalue were redefined
in a block, shadowing the declarations outside the block.

gold/
	PR gold/17432
	* resolve.cc (Symbol_table::resolve): Fix local shadowing error.
2014-09-30 16:06:50 -07:00
Kito Cheng cd6da0366d Fix SysV-style hash table when --hash-style=both.
When --hash-style-both is used, gold currently builds the sysv hash
table first, then the gnu hash table. Building the gnu hash table
renumbers the dynamic symbol table, invalidating the sysv hash
table. This patch reverses the order in which the hash tables are
build so that both hash tables are correct.

gold/
	PR gold/13597
	* layout.cc (Layout::create_dynamic_symtab): Build gnu-style
	hash table before sysv-style hash table.
2014-09-30 14:36:46 -07:00
Sriraman Tallam 5f77241211 2014-09-29 Sriraman Tallam <tmsriram@google.com>
* options.h (--pic-executable): Add negative to alias to -no-pie.
2014-09-29 17:30:54 -07:00
Cary Coutant 5efeedf61e Fix handling of relocations against TLS section symbols.
Gold doesn't handle relocations against the section symbol for a TLS
section correctly. Instead of using the offset of the section relative
to the TLS segment, it uses the address of the actual section.  This
patch checks for section symbols for TLS sections, and treats them
the same as TLS symbols.

gold/
	PR gold/16773
	* object.cc (Sized_relobj_file): Compute value of section symbols
	for TLS sections the same as TLS symbols.
2014-09-26 13:34:27 -07:00
Cary Coutant 1707f18344 Fix problem where TLS common symbols are not allocated properly during LTO.
The plugin API doesn't provide a way for the claimed file handler to
identify a TLS symbol, so when adding a common TLS symbol, gold
mistakenly places the symbol in the non-TLS commons list, and does
not override it when we see the replacement symbol that is marked
as TLS. Consequently, we allocate the TLS common symbol as a regular
common, and, if it's the only TLS in the program, we'll give an
internal error because we haven't allocated a TLS segment.

This patch fixes the problem by removing an exclusion where common
symbols would not override the placeholder symbols, but checking to
see if the size needs adjusting (the original reason for the exclusion).
Furthermore, we need to avoid putting placeholder symbols in the common
list, and wait until we see a real common symbol with a type we can
trust.

gold/
	PR gold/17432
	* resolve.cc (Symbol_table::resolve): Override common placeholder
	symbols, but adjust sizes.
	* symtab.cc (Symbol_table::add_from_object): Don't add placeholder
	symbols to common lists.
2014-09-25 21:49:42 -07:00
Alan Modra 00cac886aa Regen gold POTFILES.in
* po/POTFILES.in: Regenerate.
2014-09-24 19:14:38 +09:30
Cary Coutant 71b9b91bce Add PR reference to ChangeLog entry.
2014-09-23  Taiju Tsuiki  <tzik@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
	PR gold/14860
	* gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
	on input_sections_blocker.
	* layout.cc (Write_sections_task::locks): Unblock
	input_sections_blocker_.
	* layout.h (Write_sections_task::Write_sections_task): Add
	input_sections_blocker.
	* testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
	to DEPENDENCIES.
	* testsuite/Makefile.in: Regenerate.
2014-09-23 23:35:36 -07:00
Cary Coutant 635aa30e3a Fix race condition causing assert in Eh_frame_hdr::do_sized_write().
2014-09-23  Taiju Tsuiki  <tzik@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
	* gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
	on input_sections_blocker.
	* layout.cc (Write_sections_task::locks): Unblock
	input_sections_blocker_.
	* layout.h (Write_sections_task::Write_sections_task): Add
	input_sections_blocker.
	* testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
	to DEPENDENCIES.
	* testsuite/Makefile.in: Regenerate.
2014-09-23 23:20:57 -07:00
Rafael Ávila de Espíndola c0c71592f7 A a testcase for common symbol handling with plugins.
2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

	* testsuite/Makefile.am (plugin_test_10): New test.
	* testsuite/Makefile.in: Regenerate
	* testsuite/plugin_common_test_2.c (c1): Align to 8.
	* testsuite/plugin_test_10.sh: New file.
2014-09-18 13:58:16 -04:00
Cary Coutant 6d610fa7ce Regenerate gold/Makefile.in. 2014-09-17 15:12:21 -07:00
Rafael Ávila de Espíndola 6168c2a1c6 Fix handling of common symbols with plugins.
gold/ChangeLog:
2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

	* plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
	* resolve.cc (Symbol_table::resolve): Don't override common symbols
	during the replacement phase.
2014-09-17 17:53:49 -04:00
Jing Yu 3a53193762 Add tls support to gold aarch64 backend.
elfcpp/ChangeLog:
2014-09-17  Han Shen  <shenhan@google.com>
	* aarch64.h (R_AARCH64_TLS_DTPREL64): Switch enum value with ...
	(R_AARCH64_TLS_DTPMOD64): ... enum value.

gold/ChangeLog:
2014-09-17  Han Shen  <shenhan@google.com>
	    Jing Yu  <jingyu@google.com>
        * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
        TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
        * aarch64.cc (Target_aarch64): Add data members
        got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
        tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
        constructor.
        (Target_aarch64::do_reloc_symbol_index): New method.
        (Target_aarch64::do_reloc_addend): New method.
        (Target_aarch64::add_tlsdesc_info): New method.
        (Target_aarch64::do_dynsym_value): New method.
        (Target_aarch64::do_make_data_plt): Add new parameters: got,
        got_irelative. Pass them to Output_data_plt_aarch64_standard.
        (Target_aarch64::make_data_plt): Add new parameters: got,
        got_irelative. Pass them to do_make_data_plt.
        (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
        (Target_aarch64::Relocate:tls_gd_to_le): New method.
        (Target_aarch64::Relocate:tls_ie_to_le): New method.
        (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
        (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
        (Target_aarch64::got_tlsdesc_section): New method.
        (Target_aarch64::make_local_ifunc_plt_entry): New method.
        (Target_aarch64::define_tls_base_symbol): New method.
        (Target_aarch64::reserve_tlsdesc_entries): New method.
        (Target_aarch64::got_mod_index_entry): New method.
        (Target_aarch64::rela_tlsdesc_section): New method.
        (Target_aarch64::rela_irelative_section): New method.
        (Target_aarch64::Tlsdesc_info): New struct.
        (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
        relocations and tlsdesc relocations.
        (Target_aarch64::optimize_tls_reloc): Implement method.
        (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
        got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
        in constructor.
        (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
        (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
        (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
        (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
        (Output_data_plt_aarch64::rela_tlsdesc): New method.
        (Output_data_plt_aarch64::rela_irelative): New method.
        (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
        (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
        (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
        (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
        (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
        (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
        (Output_data_plt_aarch64_standard): New member variables:
        plt_tlsdesc_entry_size, tlsdesc_plt_entry.
        (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
        New parameter: got, got_irelative.
        (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
        (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
        (Output_data_plt_aarch64::do_write): Replace got_address with
        gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
        (AArch64_relocate_functions::update_movnz): New method.
        (AArch64_relocate_functions): Correct format.
        (AArch64_relocate_functions::movnz): New method.
        (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
        before the switch. Add new cases to switch.
        Check ie_to_le relaxation on tlsie relocations. Add code handling
        tlsgd tlsdesc cases.
        (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
        needed. Add new cases to switch. Insert dynamic RELATIVE relocation
        when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
        Call reloc_name_in_error_message to print unsupported reloc.
        (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
        make_data_plt.
        (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
        relocs. Fill in some more dynamic tags.
        (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
        Skip call tls_get_addr when tlsgd is relaxed.
        (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
        handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
        tlsdesc->ie relaxation.
2014-09-17 14:24:10 -07:00
Sasa Stankovic 62661c935d Add NaCl (NativeClient) specific classes Target_mips_nacl and
Target_selector_mips_nacl.

gold/
	* mips.cc (Target_mips_nacl): New class.
	(Target_selector_mips_nacl): New class.
	(target_selector_mips32): Rename from target_selector_mips32be and use
	Target_selector_mips_nacl instead of Target_selector_mips.
	(target_selector_mips32el): Rename from target_selector_mips32 and use
	Target_selector_mips_nacl instead of Target_selector_mips.
	(target_selector_mips64): Rename from target_selector_mips64be and use
	Target_selector_mips_nacl instead of Target_selector_mips.
	(target_selector_mips64el): Rename from target_selector_mips64 and use
	Target_selector_mips_nacl instead of Target_selector_mips.
	(Target_mips::mips_info): Add const attribute.
2014-09-03 09:44:11 -07:00
Cary Coutant 54674d3893 Make Elf_file::section_name() a const function, so that it can be used in
places where we have only a const Elf_file*.

elfcpp/
	* elfcpp_file.h (Elf_file::shnum): New const function.
	(Elf_file::shstrndx): New const function.
	(Elf_file::large_shndx_offset): New const function.
	(Elf_file::section_name): Add const attribute.
	(Elf_file::section_header_offset): Likewise.

gold/
	* dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
	* dynobj.h (Sized_dynobj::do_section_name): Likewise.
	* incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
	(Sized_incr_dynobj::do_section_name): Likewise.
	* incremental.h (Sized_relobj_incr::do_section_name): Likewise.
	(Sized_incr_dynobj::do_section_name): Likewise.
	* object.h (Object::section_name): Likewise.
	(Object::do_section_name): Likewise.
	(Sized_relobj_file::do_section_name): Likewise.
	* plugin.cc (Sized_pluginobj::do_section_name): Likewise.
	* plugin.h (Sized_pluginobj::do_section_name): Likewise.
2014-09-02 15:44:58 -07:00
Cary Coutant 9860cbcfb6 Fix problem with optimization of .eh_frame section and --sort-section option.
When --sort-section=name is used, gold will sort the linker-generated contents
of .eh_frame (after optimization) after the endcap provided by crtendS.o.
This causes two problems: the .eh_frame_hdr section is generated assuming that
the optimized .eh_frame contents will be placed at the very beginning of the
section, and the endcap no longer appears at the end of the section.

This patch fixes the first problem by adjusting FDE offsets to take into account
the actual starting offset within the output section, and fixes the second
problem by sorting linker-generated (Output_section_data) sections based on the
name of the output section.

gold/
	PR gold/17005
	* ehframe.cc (Fde::write): Add output_offset parameter.
	(Cie::write): Likewise.
	(Eh_frame::set_final_data_size): Account for offset within output
	section.
	(Eh_frame::do_sized_write): Likewise.
	* ehframe.h (Fde::write): Add output_offset parameter.
	(Cie::write): Likewise.
	* output.cc (Output_section::Input_section_sort_entry): Remove
	section_has_name_; add output_section_name parameter. Use
	output section name for non-input sections.
	(Output_section::Input_section_sort_entry::section_has_name): Remove.
	(Output_section::Input_section_sort_entry::section_has_name_): Remove.
	(Output_section::Input_section_sort_compare): Remove logic for
	sections without names.
	(Output_section::Input_section_sort_init_fini_compare): Likewise.
	(Output_section::Input_section_sort_section_prefix_special_ordering_compare):
	Likewise.
	(Output_section::Input_section_sort_section_name_compare): Likewise.
2014-09-02 14:49:18 -07:00
Han Shen 8e33481e13 The 3rd patch for aarch64 gold.
This enables -
1. static linking hello world
2. limited support for TLSIE and TLSLE
3. limited support for linking shared library, linking executable against shared
   library.

gold/ChangeLog
2014-08-29 Han Shen <shenhan@google.com>
       Jing Yu <jingyu@google.com>

    * aarch64-reloc-property.cc
    (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
    reference reloc property in the table.
    * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
    3 other entries.
    * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
    2 new overloaded methods.
    (Output_data_got_aarch64::do_write): Add code to write out
    static relocs.
    (class Output_data_got_aarch64::Static_reloc): New class to wrap
    static relocs.
    (Output_data_got_aarch64::static_relocs): New vector to
    hold static relocs.
    (Target_aarch64::TCB_SIZE): New const static memeber.
    (Target_aarch64::tcb_size): New method.
    (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
    (Target_aarch64::Relocate::relocate_tls): New method.
    (Target_aarch64::Scan::local): Add code handling new reloc types.
    (Target_aarch64::Scan::global): Add code handling new reloc types.
2014-08-29 17:53:03 -07:00
Sriraman Tallam 8123365312 Add option -no-pie. 2014-08-13 18:40:19 -07:00
Jing Yu 9363c7c3ad gold aarch64 patch to enable linking hello_wolrd.
elfcpp/ChangeLog:
2014-08-08  Han Shen  <shenhan@google.com>

	* aarch64.h (withdrawn): Replaced with R_AARCH64_withdrawn.

2014-08-08  Jing Yu  <jingyu@google.com>
	    Han Shen  <shenhan@google.com>

	* Makefile.am (HFILES): Add aarch64-reloc-property.h.
	(DEFFILES): add aarch64-reloc.def.
	(TARGETSOURCES): Add aarch64-reloc-property.cc.
	(ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
	* Makefile.in: Regenerate.
	* aarch64-reloc-property.cc: New file.
	* aarch64-reloc-property.h: New file.
	* aarch64-reloc.def: New file.
	* aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
	with tab to make the format consistent.
	(Output_data_got_aarch64::symbol_table_): New method.
	(Target_aarch64::do_plt_address_for_global): New method.
	(Target_aarch64::do_plt_address_for_local): New method.
	(Target_aarch64::do_select_as_default_target): New method.
	(Target_aarch64::do_make_data_plt): New method.
	(Target_aarch64::make_data_plt): New method.
	(Output_data_plt_aarch64::has_irelative_section): New method.
	(Output_data_plt_aarch64::address_for_global): New method.
	(Output_data_plt_aarch64::address_for_local): New method.
	(Output_data_plt_aarch64::irelative_rel_): New parameter.
	(Output_data_plt_aarch64::add_entry): Implement contents.
	(Output_data_plt_aarch64::set_final_data_size): Fix typo.
	(Output_data_plt_aarch64::do_write): Remove useless got_base. Set
	the got_pov entry to plt0.
	(Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
	Implement contents.
	(Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
	(AArch64_howto): New struct.
	(aarch64_howto[]): New static const array.
	(AArch64_relocate_functions): New class.
	(Target_aarch64::Scan::get_reference_flags): Remove method.
	(Target_aarch64::Scan::local): Implement to support a few relocations.
	(Target_aarch64::Scan::global): Implement to support a few relocations.
	(Target_aarch64::make_plt_section): Implement contents.
	(Target_aarch64::make_plt_entry): Implement contents.
	(Target_aarch64::do_finalize_sections): Implement contents.
	(Target_aarch64::Relocate::relocate): Implement a few relocations.
	(Target_aarch64::relocate_section): Implement contents.
2014-08-08 14:18:35 -07:00
Alan Modra ad9fe6c108 Modify new gold test to pass on powerpc64le
* testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2014-08-06 22:15:48 +09:30
Alan Modra 7cd4e5b756 Warn for gold on lto objects without plugin
PR 13227
	* symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2014-08-06 12:40:00 +09:30
Sriraman Tallam 7c16d96edb Fix ChangeLog entry:
2014-07-21  Sriraman Tallam  <tmsriram@google.com>

	* object.cc (Relobj::is_section_name_included): Add
	".rodata.nptl_version" to not garbage collect this section.
2014-07-21 11:15:38 -07:00
Sriraman Tallam 5ad9b0a773 2014-07-21 Sriraman Tallam <tmsriram@google.com>
* object.cc (Relobj::is_section_name_included): Add
	".rodata.nptl_version".
2014-07-21 11:12:05 -07:00
Cary Coutant e051745c83 Fix --defsym to copy symbol attributes.
Alan Modra committed a patch to Gnu ld to fix a problem encountered on
PPC where the --defsym option wasn't copying the st_other bits to the
newly-defined symbol.

    https://sourceware.org/ml/binutils/2014-07/msg00094.html

Gold has the same problem, and additionally wasn't copying the symbol type.
This patch fixes both problems, by copying the symbol type, visibility, and
the remaining st_other bits to the new symbol for --defsym=sym1=sym2
assignments.

gold/
	* expression.cc (struct Expression::Expression_eval_info): Add
	new fields type_pointer, vis_pointer, and nonvis_pointer.
	(Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
	nonvis_pointer parameters. Adjust all calls.
	(Symbol_expression::value): Update type, visibility, and nonvis bits
	in caller.
	* script.cc (Symbol_assignment::sized_finalize): Update type,
	visibility, and remaining st_other bits for new symbol.
	* script.h: (Expression::eval_maybe_dot): Add type_pointer,
	vis_pointer, and nonvis_pointer parameters.
	* symtab.h (Symbol::set_type): New method.

	* testsuite/Makefile.am (defsym_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/defsym_test.c: New file.
	* testsuite/defsym_test.sh: New file.
2014-07-08 22:52:37 -07:00
Cary Coutant f35c4853cc Fix internal error with LTO on ARM.
This prevents the target-specific do_read_symbols methods from being called
twice when do_layout_deferred_sections needs to layout an .eh_frame section.

gold/
	PR gold/15639
	* dynobj.h (Sized_dynobj::base_read_symbols): New method.
	* dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
	(Sized_dynobj::base_read_symbols): ...new method.
	* object.h (Sized_relobj_file::base_read_symbols): New method.
	* object.cc (Sized_relobj_file::do_read_symbols): Move body to...
	(Sized_relobj_file::base_read_symbols): ...new method.
	* arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
	* mips.cc: (Mips_relobj::do_read_symbols): Likewise.
	* powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2014-07-08 10:44:09 -07:00
Alan Modra 2900af2d0a Update gold POTFILES.in
for recent aarch64 and mips support.

	* po/POTFILES.in: Regenerate
2014-07-04 12:32:14 +09:30
Jing Yu 053a4d680b 2014-07-02 Jing Yu <jingyu@google.com>
Initial patch to enable gold aarch64 backend.

    This patch is just a skeleton which almost does nothing.
    It does not support ILP32 now.

    gold/ChangeLog:
	* aarch64.cc: New file
	* Makefile.am (TARGETSOURCES): Add aarch64.cc
	(ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
	* Makefile.in: Regenerate.
	* configure.tgt: Add entries for aarch64*.
	* configure.ac:  Likewise.
	* configure: Likewise.

    elfcpp/ChangeLog:
	* aarch64.h: New file. New enums for aarch64-elf64 relocations.
	* elfcpp.h (EM_AARCH64, SHT_AARCH64_ATTRIBUTES, PT_AARCH64_ARCHEXT,
	PT_AARCH64_UNWIND): New enum constant.
2014-07-02 16:21:23 -07:00
Alan Modra 7b54904566 Fix undefined symbol errors from mips.cc
* symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2014-06-27 10:42:28 +09:30
Cary Coutant cb818dbff5 Fix dwp to allow intermediate .dwp files with no .debug_types sections.
gold/
	* dwp.cc (Dwo_file::read): Allow files with no .debug_types
	sections.
	(Dwo_file::sized_read_unit_index): Likewise.
2014-06-24 12:17:09 -07:00
Sasa Stankovic 9810d34d76 gold/
* mips.cc: New file.
	* Makefile.am (TARGETSOURCES): Add mips.cc
	(ALL_TARGETOBJS): Add mips.$(OBJEXT)
	* configure.tgt: Add entries for mips*.
	* configure.ac: Likewise.
	* Makefile.in: Regenerate.
	* configure: Likewise.
2014-06-23 12:02:10 -07:00
Cary Coutant 9baa787b14 Add check to keep from segfaulting on a corrupt .debug_pubnames section.
gold/
	* dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
	unit_length is within section bounds.
2014-06-09 14:55:02 -07:00
Cary Coutant 8f89af0abe Print unattached sections in the link map.
gold/
	PR gold/16980
	* layout.cc (Layout::print_to_mapfile): Print unattached sections in
	map.
2014-06-09 12:58:48 -07:00
Alan Modra a47622ac1b Allow both signed and unsigned fields in PowerPC cmpli insn
There are legitimate reasons to allow a signed value in a cmpli insn
field, for example to test for a "stw r1,lock@sdarel(r13)" instruction
in user code, a kernel might use
	subis r3,r3,STW_R1_0R13@ha	# subtract off high part
	cmplwi r3,lock@sdarel		# is low part accessing lock?
Since the lock@sdarel may take a range of -32768 to 32767,
the allowed range of cmpli immediate must be at least [-32768,65535].

bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Treat field of cmpli
	insn as a bitfield; Use complain_overflow_bitfield.
	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
opcodes/
	* ppc-opc.c (UISIGNOPT): Define and use with cmpli.
gas/
	* config/tc-ppc.c (ppc_insert_operand): Handle PPC_OPERAND_SIGNOPT
	on unsigned fields.  Comment on PPC_OPERAND_SIGNOPT signed fields
	in 64-bit mode.
gold/
	* powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2014-06-07 14:55:11 +09:30
Cary Coutant 4320c69198 Strip .debug_gnu_pubnames and .debug_gnu_pubtypes when building .gdb_index.
When not stripping those sections, there was a bug where gold was incorrectly
adjusting section-relative offsets by the offset of the input section within
the output section. That adjustment was both unnecessary and wrong, causing
gold to miss a number of debug entries that should have been added to
.gdb_index.  (With stripping, the adjustment was always 0, so the bug in
dwarf_reader.cc would have been hidden by the change to layout.cc.)

gold/
	* dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
	* dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
	(Dwarf_pubnames_table::read_header): Likewise.
	* layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
	.debug_gnu_pubtypes.
2014-06-06 16:24:30 -07:00
Joel Brobecker 270c993744 Make it easy to make --disable-werror the default for both binutils and gdb
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.

GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).

This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).

bfd/ChangeLog:

        * development.sh: New file.
        * warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
        Make -Werror the default with GCC only if DEVELOPMENT is true.
        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
        $(srcdir)/development.sh.
        * Makefile.in, configure: Regenerate.

binutils/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gas/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gold/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
        * Makefile.in, configure: Regenerate.

gprof/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

ld/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

opcodes/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gdb/ChangeLog:

        * development.sh: Delete.
        * Makefile.in (config.status): Adjust dependency on development.sh.
        * configure.ac: Adjust development.sh source call.
        * configure: Regenerate.

gdb/gdbserver/ChangeLog:

        * configure.ac: Adjust development.sh source call.
        * Makefile.in (config.status): Adjust dependency on development.sh.
        * configure: Regenerate.

Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
2014-06-05 05:47:29 -07:00
Alan Modra 397998fc32 Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld.  Thus
    addis r12,r2,xxx@ha
    addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
    addis r11,r2,xxx@ha
    addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.

bfd/
	* elf64-ppc.c (ADDIS_R12_R2): Define.
	(build_plt_stub): Support fusion on ELFv2 stub.
	(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
	* powerpc.cc (addis_12_2): Define.
	(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
	* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
	* ppc64-tdep.c (ppc64_standard_linkage8): New.
	(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 10:55:29 +09:30
Alan Modra 61f5c66f62 Fix gold plugin_test failures on PowerPC64 ELFv2
readelf output for ELFv2 includes st_other bits specifying a
function's local entry offset.

	* testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
	st_other output.
2014-06-03 10:47:55 +09:30
Alan Modra f697178787 Fix PowerPC64 ELFv2 icf_safe failures
ELFv2 doesn't use .opd, so folding function code can't be allowed
in safe mode if a function's address might be taken.

	* powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
	Only ignore relocs on ELFv1.
	(Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2014-06-02 09:26:23 +09:30
Cary Coutant f6fb832249 Fix testsuite to use newly-built linker for ehdr_start_test_4, and fix
check script to look for the right binding.

gold/
	* testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2014-05-30 10:21:27 -07:00
H.J. Lu c23dd3426c Properly handle 64-bit GOT relocations
This patch fixes 2 issues:

1. Since the GOT offset is always negative, we need to use signed int
to support 64-bit GOT relocations.
2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is
the address of the .got.plt section, not the .got section.
2014-05-27 12:20:18 -07:00
Alan Modra 5fe7ffdc98 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.
2014-05-15 18:37:43 +09:30
Sriraman Tallam a82bef932e With -pie and x86, the linker complains if it sees a PC-relative relocation
to access a global as it expects a GOTPCREL relocation.  This is really not
necessary as the linker could use a copy relocation to get around it.  This
patch enables copy relocations with pie.

Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable.  By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access.  It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead.  Gold can then create a copy reloc for only the undefined globals.

	gold/
	* symtab.h (may_need_copy_reloc): Remove check for position independent
	code.
	* x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
	position independence before pc absolute may_need_copy_reloc call.
	Add check for executable output befor pc relative may_need_copy_reloc
	call.
	* i386.cc: Ditto.
	* arm.cc: Ditto.
	* sparc.cc: Ditto.
	* tilegx.cc: Ditto.
	* powerpc.cc: Add check for no position independence before
	may_need_copy_reloc calls.
	* 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.
2014-05-13 10:55:11 -07:00
Sriraman Tallam 1642b4b337 Optimizing accesses to Globals with -fpie -pie:
With -pie and x86, the linker complains if it sees a PC-relative relocation
to access a global as it expects a GOTPCREL relocation.  This is really not
necessary as the linker could use a copy relocation to get around it.  This
patch enables copy relocations with pie.

Context:
This is useful because currently the GCC compiler with option -fpie makes
every extern global access go through the GOT. That is because the compiler
cannot tell if a global will end up being defined in the executable or not
and is conservative. This ends up hurting performance when the binary is linked
as mostly static where most of the globals do end up being defined in the
executable.  By allowing copy relocs with fPIE, the compiler need not generate
a GOTPCREL(GOT access) for any global access.  It can safely assume that all
globals will be defined in the executable and generate a PC-relative access
instead.  Gold can then create a copy reloc for only the undefined globals.
2014-05-13 10:33:59 -07:00
Martin Liška 53c6660516 2014-05-08 Martin Liška <mliska@suse.cz>
gold/
	* output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2014-05-08 15:23:53 -07:00
Cary Coutant 57b2284c63 Fix issue where first reserved word of GOT is not initialized if there
is no PLT.

gold/
	PR gold/16900
	* i386.cc (Output_data_got_plt_i386): New class.
	(Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
	parameter. Change all callers.
	(Output_data_plt_i386::layout_): Remove.
	(Output_data_plt_i386::got_plt_): Change type.
	(Target_i386::got_plt_): Change type. Change all references.
	(Target_i386::got_section): Create instance of new class.
	(Output_data_got_plt_i386::do_write): New function.
	* x86_64.cc (Output_data_got_plt_x86_64): New class.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
	parameter. Change all callers.
	(Output_data_plt_x86_64::layout_): Remove.
	(Output_data_plt_x86_64::got_plt_): Change type.
	(Target_x86_64::got_plt_): Change type. Change all references.
	(Target_x86_64::got_section): Create instance of new class.
	(Output_data_got_plt_x86_64::do_write): New function.
	(Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
	(Target_x86_64<size>::init_got_plt_for_update): Create instance of new
	class.
2014-05-06 14:29:42 -07:00
Cary Coutant 6b97515d17 Don't complain about the source language when we have pubnames/pubtypes info.
gold/
	* gdb-index.cc (Gdb_index_info_reader): Don't complain about language
	if we have pubnames/pubtypes.
2014-05-05 15:23:14 -07:00
Cary Coutant d1bddd3c4b Fix handling of __ehdr_start when it cannot be defined.
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.
2014-05-02 16:33:43 -07:00
Cary Coutant bf2cc635e2 Add missing PR ref to ChangeLog entry. 2014-04-23 15:20:56 -07:00
Cary Coutant 7849f6d8dc Add missing break statement for case elfcpp::R_X86_64_PLTOFF64.
gold/
	* x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2014-04-23 15:19:05 -07:00
Cary Coutant 99fd8cfff7 Allow target to decide whether to include a section.
2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* layout.cc (Layout::include_section): Allow a target to decide
	whether to include a section.
	* target.h (Target::should_include_section): New function.
	(Target::do_should_include_section): New function.
2014-04-15 11:56:18 -07:00
Cary Coutant 91f43acd5d Allow target to derive from Copy_relocs class.
2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
	inline into ...
	(Copy_relocs::emit): ... here.
	* copy-relocs.h (Copy_reloc_entry): Change from class to struct.
	(Copy_reloc_entry::make_copy_reloc): Change from private to protected.
	(Copy_reloc_entry::entries_): Change from private to protected.
2014-04-15 11:56:18 -07:00
Sriraman Tallam c4eb27e1db 2014-04-02 Sriraman Tallam <tmsriram@google.com>
* icf.cc (get_section_contents): Replace copies of reloc
	vectors with (const) references.
2014-04-02 17:07:47 -07:00
Cary Coutant ae447ddd12 Modify gold testsuite to disable plugins added by GCC driver.
GCC 4.8 now adds linker plugin options by default, which conflict with the
--incremental tests in the testsuite. This patch checks whether the compiler
supports the -fno-use-linker-plugin option, and adds it to all link
commands.

2014-04-02  Cary Coutant  <ccoutant@google.com>

	* configure.ac (HAVE_PUBNAMES): Use C instead of C++.
	(HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
	* configure: Regenerate.
	* testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
	-fno-use-linker-plugin.
	(LINK1, CXXLINK1): Add it to the link command.
	* testsuite/Makefile.in: Regenerate.
2014-04-02 15:04:36 -07:00
Alan Modra fa47fa9246 autoreconf
Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes.
Regenerate gas/config.in.
2014-03-12 15:02:00 +10:30
Cary Coutant 9b12c50063 Add function to set non-visibility part of st_other.
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* symtab.h (Symbol::set_nonvis): New function.
2014-03-10 13:38:20 -07:00
Cary Coutant beacaa966b Add explicit instantiations for Sized_symbol::init_output_data.
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* symtab.cc (Sized_symbol<32>::init_output_data):
	Instantiate the template.
	(Sized_symbol<64>::init_output_data): Likewise.
2014-03-10 13:36:40 -07:00
Cary Coutant 800d982336 Allow target to adjust dynamic symbol value.
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* symtab.cc (Symbol_table::sized_write_globals): Allow a target to
	adjust dynamic symbol value.
	* target.h (Target::adjust_dyn_symbol): New function.
	(Target::do_adjust_dyn_symbol): New function.
2014-03-10 13:35:53 -07:00
Cary Coutant 918fc1f8d2 Allow target to add custom dynamic table entries.
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* 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.
	(Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
	dynamic entry.
	(enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
	* target.h (Target::dynamic_tag_custom_value): New function.
	(Target::do_dynamic_tag_custom_value): New function.
2014-03-10 13:34:53 -07:00
Cary Coutant 98ff923154 Allow target to set dynsym indexes.
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
	* symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
	dynsym indexes.
	* target.h (Target::has_custom_set_dynsym_indexes): New function.
	(Target::do_has_custom_set_dynsym_indexes): New function.
	(Target::set_dynsym_indexes): New function.
	(Target::do_set_dynsym_indexes): New function.
2014-03-10 13:33:20 -07:00
Alan Modra b80eed39e2 Better overflow checking for powerpc64 relocations
R_PPC64_ADDR16 is used in three contexts:
- .short data relocation
- 16-bit signed insn fields, eg. addi
- 16-bit unsigned insn fields, eg. ori
In the first case we want to allow both signed and unsigned 16-bit
values, the latter two ought to error if the field exceeds the range
of values allowed for 16-bit signed and unsigned integers
respectively.  These conflicting requirements meant that ld had to
choose the least restrictive overflow checks, and thus it is possible
to construct testcases where an addi field overflows but is not
reported by ld.  Many relocations dealing with 16-bit insn fields have
this problem.  What's more, some relocations that are only ever used
for signed fields of instructions woodenly copied the lax overflow
checking of R_PPC64_ADDR16.

bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed
	for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN,
	R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS,
	R_PPC64_REL16 entries.  Use complain_overflow_dont for R_PPC64_TOC.
	(ppc64_elf_relocate_section): Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.
gold/
	* powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
	CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
	(Powerpc_relocate_functions::has_overflow_unsigned): New function.
	(Powerpc_relocate_functions::has_overflow_bitfield,
	overflowed): Use the above.
	(Target_powerpc::Relocate::relocate): Correct overflow checking
	for a number of relocations.  Modify overflow test for 16-bit
	fields in instructions to signed/unsigned according to whether
	the field takes a signed or unsigned value.
2014-03-08 12:57:58 +10:30
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Alan Modra 45965137be Support R_PPC64_ADDR64_LOCAL
This adds support for "func@localentry", an expression that returns the
ELFv2 local entry point address of function "func".  I've excluded
dynamic relocation support because that obviously would require glibc
changes.

include/elf/
	* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
	(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
	(ppc64_elf_check_relocs): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
	(md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
ld/testsuite/
	* ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
	* ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
	* ld-powerpc/powerpc.exp: Run new test.
elfcpp/
	* powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
gold/
	* powerpc.cc (Target_powerpc::Scan::local, global): Support
	R_PPC64_ADDR64_LOCAL.
	(Target_powerpc::Relocate::relocate): Likewise.
2014-03-05 19:57:39 +10:30
Alan Modra 2c80b75360 Fix various copyright issues
binutils/
	* README: Add "Copyright Notices" paragraph.
gas/
	* config/bfin-lex-wrapper.c: Correct copyright date.
	* config/tc-frv.c: Correct copyright punctuation.
	* config/tc-ip2k.c: Likewise.
	* config/tc-iq2000.c: Likewise.
	* config/tc-mep.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic4x.h: Likewise.
ld/testsuite/
	* ld-scripts/phdrs2.exp: Correct copyright punctuation.
	* ld-v850/v850.exp: Correct copyright typo.
opcodes/
	* i386-gen.c (process_copyright): Emit copyright notice on one line.
gold/
	* dwp.cc (print_version): Update copyright year to current.
2014-03-03 11:03:08 +10:30
Cary Coutant dd0c4e70fe Update ChangeLog from earlier patch. 2014-02-11 11:26:37 -08:00
Alan Modra c1c69e839e binutils potfiles regen
Adds nds32 files to POTFILES.in
2014-02-10 09:59:35 +10:30
Cary Coutant 1f25b93bc6 Fix problem where -u is ignored when a weak undef is seen.
When the linker has a weak undefined symbol, it normally does not
select an archive library member just to satisfy the reference.
If the same symbol is also listed in a -u option, however, we
should select the archive library member.  This patch reorders
the code in Library_base::should_include_member so that the
additional checks are performed in the case of a weak undef.

gold/

2014-02-06  Cary Coutant  <ccoutant@google.com>

	* archive.cc (Library_base::should_include_member): Reorder
	code to check for -u option if a weak undef has already been seen.
	* testsuite/Makefile.am (weak_undef_test_2): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/weak_undef_file3.cc: New file.
	* testsuite/weak_undef_file4.cc: New file.
	* testsuite/weak_undef_test_2.cc: New file.
2014-02-06 17:15:02 -08:00
Cary Coutant 1a221d3d9c Fix issues with gold undefined symbol diagnostics.
PR binutils/15435 complains that gold issues a visibility error for an
weak undefined symbol with hidden visibility. The message should be
suppressed if the symbol is a weak undef.

An earlier patch to add an extra note about key functions when a class's
vtable symbol is undefined missed a case where the reference to the
vtable came from a shared library. This patch moves the check to a
lower-level routine that catches both cases.

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

	* errors.cc (Errors::undefined_symbol): Move undef vtable symbol
	check to here.
	* target-reloc.h (is_strong_undefined): New function.
	(relocate_section): Move undef vtable symbol check from here.
	Check for is_strong_undefined.
2014-02-05 23:04:52 -08:00
Cary Coutant e889f0a4b1 Add missing gold/ChangeLog entry. 2014-02-05 22:59:17 -08:00
Cary Coutant fd834e57ff Fix problems with the --dynamic-list option.
PR gold/13577 complains that even though symbols listed in
the --dynamic-list script are exported, they are still bound symbolically
if -Bsymbolic is also used. There are two underlying problems here.
First, -Bsymbolic should be overridden by --dynamic-list, since the
dynamic list provides an explicit list of symbols that are not bound
within the library, and if we go ahead and set DT_SYMBOLIC, then the
dynamic loader will bind it within the library anyway. Second, gold
did not properly identify the symbols listed in the file as preemptible.

PR gold/16530 complains that symbols listed in the --dynamic-list script
can still be garbage collected. I've fixed this by checking the symbols
as they're added to the symbol table. (Unlike the --export-dynamic-symbol
option, we can't iterate over the list, because the --dynamic-list script
can have wildcards in it.)

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

	PR gold/13577
	* options.cc (General_options::parse_dynamic_list):
	Set have_dynamic_list_.
	(General_options::General_options): Initialize have_dynamic_list_.
	(General_options::finalize): Turn off -Bsymbolic and
	-Bsymbolic-functions if --dynamic-list provided.
	* options.h (General_options::have_dynamic_list): New function.
	(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.
	* testsuite/dynamic_list_2.cc: New file.
	* testsuite/dynamic_list_2.t: New file.
	* testsuite/dynamic_list_lib1.cc: New file.
	* testsuite/dynamic_list_lib2.cc: New file.
	* testsuite/gc_dynamic_list_test.c: New file.
	* testsuite/gc_dynamic_list_test.sh: New file.
	* testsuite/gc_dynamic_list_test.t: New file.
2014-02-05 18:01:47 -08:00
Cary Coutant ec673e648c Add .gdb_index version 7 support.
This patch adds support for .gdb_index version 7, which adds several
flag bits to the symbol index.  It also fixes a problem where it did
not handle compressed debug sections correctly.

Tested with a google/gcc-4_8 branch compiler, which supports
the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes
tables. (We will submit that patch to GCC when stage 1 reopens.)

2014-01-28  Cary Coutant  <ccoutant@google.com>

	* gold/dwarf_reader.cc: include <utility> (for make_pair).
	(Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
	debug sections.
	(Dwarf_ranges_table::read_ranges_table): Likewise.
	(Dwarf_pubnames_table::read_section): Check for GNU-style
	sections, and for compressed debug sections.
	(Dwarf_pubnames_table::read_header): Compute end address of table.
	(Dwarf_pubnames_table::next_name): Return flag_byte.  Check
	for end of list by offset, not by offset == 0.
	(Dwarf_info_reader::do_read_string_table): Check for compressed
	debug sections.
	* gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
	Initialize new data members.
	(Dwarf_pubnames_table::next_name): return flag_byte.
	(Dwarf_pubnames_table::end_of_table_): New data member.
	(Dwarf_pubnames_table::is_gnu_style_): New data member.
	* gold/gdb-index.cc (gdb_index_version): Update to version 7.
	(Gdb_index_info_reader::read_pubtable): Read flag_byte.
	(Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
	read skeleton type unit DIEs.
	(Gdb_index::add_symbol): Add flag_byte; adjust all callers.
	(Gdb_index::do_write): Write flag_byte.
	* gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
	(Gdb_index::Cu_vector): Store flags along with cu indexes.
	* gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
	* gold/testsuite/gdb_index_test_comm.sh: Likewise.
2014-01-28 15:36:00 -08:00
H.J. Lu 221fd5d598 Update copyright year to 2014
binutils/

	* version.c (print_version): Update copyright year to 2014.

gas/

	* as.c (parse_args): Update copyright year to 2014.

gold/

	* version.cc (print_version): Update copyright year to 2014.

ld/

	* ldver.c (ldversion): Update copyright year to 2014.

opcodes/

	* i386-gen.c (process_copyright): Update copyright year to 2014.
2014-01-08 05:48:12 -08:00
Ian Lance Taylor 6c09fb0ba1 * stringpool.cc (Stringpool_template::reserve): Add
HAVE_UNORDERED_MAP case.
	* stringpool.cc (Stringpool_template::print_stats): Likewise.
2013-12-19 21:54:43 -08:00
Cary Coutant 8356f2d009 Add configure checks for <unordered_set> and <unordered_map>.
gold/
	* configure.ac: Check for <unordered_set> and <unordered_map>.
	* config.in: Regenerate.
	* configure: Regenerate.
	* system.h: Use <unordered_set> and <unordered_map> if available.
2013-12-18 15:53:31 -08:00
Roland McGrath f2c7d7ee5b Use $(INSTALL_PROGRAM_ENV) consistently.
binutils/
	* Makefile.am (install-exec-local): Prefix libtool invocation with
	$(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.

gas/
	* Makefile.am (install-exec-bindir): Prefix libtool invocation
	with $(INSTALL_PROGRAM_ENV).
	(install-exec-tooldir): Likewise.
	* Makefile.in: Regenerate.

gold/
	* Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
	with $(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.

ld/
	* Makefile.am (install-exec-local): Prefix libtool invocation with
	$(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.
2013-12-10 15:19:50 -08:00
Cary Coutant 6632e8ccec Add check for which library is needed for dlopen.
gold/
	PR gold/16203
	* configure.ac: Add check for which library is needed for
	dlopen.
	* configure: Regenerate.
2013-11-22 15:47:18 -08:00
Cary Coutant 0c075858c7 Use in-tree assembler for exception_x86_64_bnd_test.
gold/
	* testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
	assembler.
	* testsuite/Makefile.in: Regenerate.
2013-11-22 15:47:18 -08:00
H.J. Lu f49fe902ba Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold
elfcpp/

	* x86_64.h (R_X86_64_PC32_BND): New.
	(R_X86_64_PLT32_BND): Likewise.

gold/

	* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
	Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
	R_X86_64_PC32 and R_X86_64_PLT32, respectively.
	(Target_x86_64<size>::Scan::local): Likewise.
	(Target_x86_64<size>::Scan::global): Likewise.
	(Target_x86_64<size>::Relocate::relocate): Likewise.
	(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
	(Target_x86_64<size>::Scan::check_non_pic(): Handle
	R_X86_64_PC32_BND.

	* testsuite/Makefile.am (check_PROGRAMS): Add
	exception_x86_64_bnd_test.
	(exception_x86_64_bnd_test_SOURCES): New macro.
	(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
	(exception_x86_64_bnd_test_LDFLAGS): Likewise.
	(exception_x86_64_bnd_test_LDADD): Likewise.
	(exception_x86_64_bnd_1.o): New rule.
	(exception_x86_64_bnd_2.o): Likewise.
	* testsuite/Makefile.in: Regenerated.
2013-11-18 09:55:09 -08:00
Alan Modra 4f65b40ee0 Add missing ChangeLog for 88b8e63904 2013-11-15 16:25:44 +10:30
Alan Modra 9055360d4a Fixes to powerpc64 gold ELFv2 support
* powerpc.cc (Target_powerpc::glink_section): Provide non-const
	accessor.
	(Target_powerpc::Branch_info::make_stub): Make global entry stubs.
	Only call ppc64_local_entry_offset for 64-bit.  Restrict
	symval_for_branch lookup to ELFv1.
	(Stub_table::add_plt_call_entry): Use unsigned int off.
	(Output_data_glink::Address, invalid_address): New.
	(Output_data_glink::add_eh_frame): Move out of line.  Add
	support for ELFv2.
	(Output_data_glink::add_global_entry, find_global_entry,
	global_entry_address): New functions.
	(Output_data_glink::global_entry_stubs_, end_branch_table_,
	ge_size): New variables.
	(Output_data_glink::set_final_data_size): Add global entry
	stub sizing.
	(Output_data_glink::do_write): Write global entry stubs.
	(Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
	parameter.  Return true for ELFv2.  Adjust callers.
	(Target_powerpc::Scan::local, global): Restrict opd lookup to
	ELFv1.  Similarly for ifunc and dynamic relocation processing
	specific to ELFv1.  Recognize that symbols are defined on
	their plt entries for ELFv2.
	(Target_powerpc::symval_for_branch): Assert if called for
	ELFv2 or ppc32.
	(Target_powerpc::Relocate::relocate): Use global entry plt
	stub for symbol value if such exists on ELFv2.
	(Target_powerpc::Relocate::relocate): Don't call
	symval_for_branch when ELFv2.  Do adjust for local entry
	offset when ELFv2.
	(Target_powerpc::do_dynsym_value): Set symbols to global entry
	plt stub for ELFv2.
	(Target_powerpc::do_plt_address_for_global): Similarly.
2013-11-15 10:36:34 +10:30
Cary Coutant cafdd5697b Revert "Fix race condition while building EH frame header."
This reverts commit 7cdd7d57e6.
2013-11-14 13:15:55 -08:00
Cary Coutant 94e49e160d Add --verify-only option to DWP.
gold/
	* dwp.cc (Dwo_file_entry): New type.
	(File_list): Use Dwo_file_entry.
	(Dwo_file::verify): New function.
	(Dwo_file::verify_dwo_list): New function.
	(Dwo_file::sized_verify_dwo_list): New function.
	(Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
	list.
	(Dwp_options): New enum type.
	(dwp_options): Add --verify-only.
	(usage): Likewise.
	(main): Likewise.
	* dwp.h (gold_info): Add declaration.
2013-11-14 11:30:12 -08:00
Cary Coutant 7cdd7d57e6 Fix race condition while building EH frame header.
gold/
	PR gold/14860
	* ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
	(Ehframe_hdr::set_final_data_size): Allocate a Lock.
	* ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
	updating fde_offsets_.
	(Eh_frame_hdr::lock_): New data member.
2013-11-14 10:33:36 -08:00
Cary Coutant 1d946cb356 Fix assert failure with --emit-relocs and .eh_frame sections.
gold/
	PR gold/15758
	* object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
	before reloc sections.
2013-11-06 10:37:45 -08:00
Alan Modra 88b8e63904 Remove powerpc.cc copy of use_plt_offset
This adds an extra flag for needs_dynamic_reloc() in order to remove
the copy of this function and use_plt_offset() in powerpc.cc, and
tweaks the powerpc get_reference_flags() to return the flag as
appropriate.  ELFv2 does not want ELFv1 behaviour here.

	* symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
	(Symbol::needs_dynamic_reloc): Test new flag.
	* powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
	(Target_powerpc::Scan::get_reference_flags): Add target param.
	Return FUNC_DESC_ABI for 64-bit ELFv1.
	(Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
	call.
	(Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
	(Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2013-11-04 16:00:13 +10:30
Cary Coutant 908794a915 Restore support for dwp v2 DWARF package file format.
gold/
	* dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
	tu_length parameter.  Adjust all callers.
	* dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
	* dwp.cc: Include dwarf.h.
	(Section_bounds): New struct type.
	(Unit_set): New struct type.
	(Dwo_file::Dwo_file): Initialize new data member.
	(Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
	Combine and rename to...
	(Dwo_file::read_unit_index): ...this.
	(Dwo_file::sized_read_compunit_index)
	(Dwo_file::sized_read_typeunit_index): Combine and rename to...
	(Dwo_file::sized_read_unit_index): ...this.
	(Dwo_file::copy_section): Remove section_name, is_str_offsets
	parameters; add section_id parameter.
	(Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
	(Dwo_file::add_unit_set): ...this.
	(Dwo_file::shndx_map_): Remove.
	(Dwo_file::sect_offsets_): New data member.
	(Dwp_output_file::Dwp_output_file): Initialize new data members.
	(Dwp_output_file::add_section): Rename to...
	(Dwp_output_file::add_contribution): ...this.
	(Dwp_output_file::add_cu_set): Combine parameters into a struct.
	(Dwp_output_file::add_tu_set): Likewise.
	(Dwp_output_file::Contribution): New type.
	(Dwp_output_file::Section::contributions): New data member.
	(Dwp_output_file::Cu_or_tu_set): Remove.
	(Dwp_output_file::Section::Section): New ctor.
	(Dwp_output_file::Dwp_index::Shndx_pool): Remove.
	(Dwp_output_file::Dwp_index::Section_table): New type.
	(Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
	(Dwp_output_file::Dwp_index::enter_set): Change type of "set"
	parameter.
	(Dwp_output_file::Dwp_index::shndx_pool): Remove.
	(Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
	(Dwp_output_file::Dwp_index::section_table): New member function.
	(Dwp_output_file::Dwp_index::section_table_end): New member function.
	(Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
	(Dwp_output_file::Dwp_index::section_table_rows): New member function.
	(Dwp_output_file::Dwp_index::section_table_cols): New member function.
	(Dwp_output_file::Dwp_index::shndx_pool_): Remove.
	(Dwp_output_file::Dwp_index::section_table_): New data member.
	(Dwp_output_file::Dwp_index::section_mask_): New data member.
	(Dwp_output_file::add_output_section): New member function.
	(Dwp_output_file::write_new_section): New member function.
	(Dwp_output_file::write_contributions): New member function.
	(Dwp_output_file::section_id_map_): New data member.
	(class Dwo_id_info_reader): Remove.
	(class Unit_reader): New class.
	(get_dwarf_section_name): New function.
	(Dwo_file::read_executable): Adjust initializations of class data.
	(Dwo_file::read): Add support for v2 package file format.
	(Dwo_file::read_unit_index): Likewise.
	(Dwo_file::sized_read_unit_index): Likewise.
	(Dwo_file::copy_section): Likewise.
	(Dwo_file::add_unit_set): Likewise.
	(Dwp_output_file::add_output_section): Likewise.
	(Dwp_output_file::add_contribution): Likewise.
	(Dwp_output_file::Dwp_index::find_or_add): Use row index to check
	for empty slot.
	(Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
	file format.
	(Dwp_output_file::Dwp_index::grow): Use row index to check for empty
	slot.
	(Dwp_output_file::initialize): Remove unused function.
	(Dwp_output_file::finalize): Add support for v2 package file format.
	(Dwp_output_file::write_index): Likewise.
	* gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
	function prototype.
2013-10-31 11:48:42 -07:00
Cary Coutant 2500c0173e gold/
* configure.ac: Fix check for -fmerge-constants.
	* configure.ac: Regenerate.
2013-10-31 11:36:32 -07:00
Roland McGrath dd0845d708 gold: x86_64-nacl: Correct 9-byte nop sequence to match what the assembler generates.
gold/
	* x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
	Correct 9-byte nop sequence to match what the assembler generates.
2013-10-30 16:01:06 -07:00
Alan Modra b4f7960d53 PowerPC64 ELFv2 support for gold.
elfcpp/
	* powerpc.h (EF_PPC64_ABI): New enum constant.
	(STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Likewise.
	(ppc64_decode_local_entry): New function.
	(ppc64_encode_local_entry): Likewise.
gold/
	* powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
	ppc64_local_entry_offset, ppc64_local_entry_offset,
	do_read_symbols): New functions.
	(Powerpc_relobj::e_flags_, st_other_): New vars.
	(Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
	(Powerpc_dynobj::abiversion, set_abiversion): New functions.
	(Powerpc_relobj::e_flags_): New var.
	(Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
	and adjust for ELFv2.
	(Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
	(Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
	(Powerpc_dynobj::do_find_special_sections): Likewise.
	(Target_powerpc::do_define_standard_symbols): Define ".TOC.".
	(Target_powerpc::Branch_info::make_stub): Adjust stub destination
	to ELFv2 local entry.
	(Target_powerpc::do_relax): No thread safe barriers needed for
	ELFv2.
	(Output_data_plt_powerpc::initial_plt_entry_size_,
	plt_entry_size): Delete.  Replace all uses with
	first_plt_entry_offset() and plt_entry_size().
	(Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
	reserved_size parm.  Update callers.
	(Output_data_plt_powerpc::entry_count): Update.
	(Output_data_plt_powerpc::first_plt_entry_offset): Make private
	and use Target_powerpc::first_plt_entry_offset().
	(Output_data_plt_powerpc::get_plt_entry_size): Similarly and
	rename to plt_entry_size.
	(Output_data_plt_powerpc::add_ifunc_entry,
	add_local_ifunc_entry): Adjust reloc for ELFv2.
	(glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
	(glink_eh_frame_fde_64v2): New.
	(Stub_table::plt_call_size): Support ELFv2 sizing.
	(Output_data_glink::add_eh_frame): Use the new FDE.
	(Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
	(Stub_table::do_write): Write ELFv2 stubs and glink.
	(Target_powerpc::Relocate::relocate): Replaces nop after call
	with ld 2,24(1) and adjust local offset destination for ELFv2.
2013-10-30 13:45:05 +10:30
Alan Modra f9c6b9078c Report overflow on PowerPC64 @h and @ha relocations.
This changes the behaviour of @h and @ha on PowerPC64 to report errors
on 32-bit overflow.  The motivation for this change is that on
PowerPC64, most uses of @h and @ha modifiers and their corresponding
relocations are to build up 32-bit offsets.  We'd like to know when
such offsets overflow.  Only rarely do people use @h or @ha with the
high 32-bit modifiers to build a 64-bit constant.  Those uses will now
need to use two new modifiers, @high and @higha, if the constant isn't
known at assembly time.  For now, we won't report overflow at assembly
time..

This also fixes an error when applying some of the HIGHER and HIGHEST
relocations.

include/elf/
	* ppc64.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
	R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
	R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): New.
	(IS_PPC64_TLS_RELOC): Match new tls relocs.
bfd/
	* reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA,
	BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA,
	BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New.
	* elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs.
	Make all _HA and _HI relocs report signed overflow.
	(ppc64_elf_reloc_type_lookup): Handle new relocs.
	(must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise.
	(dec_dynrel_count, ppc64_elf_relocate_section): Likewise.
	(ppc64_elf_relocate_section): Don't apply 0x8000 adjust to
	R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST,
	R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-ppc.c (SEX16): Don't mask.
	(REPORT_OVERFLOW_HI): Define as zero.
	(ppc_elf_suffix): Support @high, @higha, @dtprel@high, @dtprel@higha,
	@tprel@high, and @tprel@higha modifiers.
	(md_assemble): Ignore X_unsigned when applying 16-bit insn fields.
	Add (disabled) code to check @h and @ha reloc overflow for powerpc64.
	Handle new relocs.
	(md_apply_fix): Similarly.
elfcpp/
	* powerpc.h (R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
	R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA,
	R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Define.
gold/
	* powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
	(Target_powerpc::Scan::global, local): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
	on all ppc64 @h and @ha relocs.
2013-10-30 13:33:15 +10:30
Alan Modra e84fe78fbc * output.h (Output_data_got::add_constant): Tidy.
(Output_data_got::add_constant_pair): New function.
	* powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
	methods used so as to first call reserve_ent().
2013-10-14 02:53:01 +00:00
Roland McGrath 44dcb735e4 gold/
* powerpc.cc (Output_data_got_powerpc): Remove unused methods
	add_got_entry and add_got_entry_pair.
2013-10-11 23:06:08 +00:00
Roland McGrath 52dc3f9c91 Revert inappropriate portions of last change. 2013-10-11 22:16:34 +00:00
Roland McGrath 13323c494d gold/
* configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
	(HAVE_PUBNAMES): Likewise.
	* configure: Regenerate.
2013-10-11 22:07:40 +00:00
Roland McGrath 1496b4465d gold/
* testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
	* testsuite/Makefile.in: Regenerate.
2013-10-11 22:05:16 +00:00
Roland McGrath cc84c10bfe gold/
* target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
	Remove const from declaration.
	* target.cc (Sized_target::do_adjust_elf_header): Update definition.
	* sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
	* output.h (Output_file_header): Remove const from member target_
	and corresponding constructor argument.
	* output.cc (Output_file_header::Output_file_header): Update prototype.
	(Output_file_header::do_sized_write): Use this->target_ in place
	of parameters()->target().
2013-10-11 22:02:21 +00:00
Roland McGrath 52f66a2c4d gold/
* testsuite/undef_symbol.cc (Foo::get_a): New method.
2013-10-11 21:59:46 +00:00
Roland McGrath 2b64b5511a gold/
* configure.ac (MERGE_CONSTANTS_FLAG): New check.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
	* testsuite/merge_string_literals_2.c: Likewise.
	* testsuite/Makefile.am
	(merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
	(AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
	literal -fmerge-constants.
	* testsuite/Makefile.in: Regenerate.
2013-10-11 21:56:16 +00:00
Roland McGrath 43819297ce gold/
* i386.cc (Target_i386): Remove unused member dynbss_.
	* arm.cc (Target_arm): Likewise.
	* powerpc.cc (Target_powerpc): Likewise.
	* sparc.cc (Target_sparc): Likewise.
	* tilegx.cc (Target_tilegx): Likewise.
	* x86_64.cc (Target_x86_64): Likewise.
	* dwarf_reader.h (Dwarf_info_reader): Remove unused members
	type_signature_, type_offset_.
	* plugin.h (Plugin_hook): Remove unused member layout_.
	* readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
	mapfile_.
	(Read_member): Remove unused members input_objects_, symtab_,
	mapfile_, layout_.
	(Check_library): Remove unused member symtab_.
	* archive.h (Lib_group): Remove unused member lib_.
	* archive.cc (Lib_group::Lib_group): Update initializer.
	* incremental.h	(Incremental_binary): Remove unused member target_.
	(Incremental_script_entry): Removed unused member script_.
	* layout.h (Write_symbols_task): Remove unused member input_objects_.
	* icf.h (Icf): Remove unused member num_tracked_relocs.
2013-10-11 21:11:49 +00:00
Roland McGrath 39d9ead7fb gold/
* gold-threads.h (Once): Conditionalize member was_run_lock_ on
	[ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
	its only use.
	* gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2013-10-11 21:02:43 +00:00
Roland McGrath 679e4abfc5 gold/
* archive.h: Use struct rather than class for forward declaration
	of Read_symbols_data.
2013-10-11 17:38:32 +00:00
Cary Coutant 54de2ea658 gold/
PR gold/16010
	* testsuite/Makefile.am (icf_test): Fix dependencies.
	(icf_safe_test): Likewise.
	(icf_safe_so_test): Likewise.
	(large_symbol_alignment): Add empty _LDADD rule.
	* testsuite/Makefile.in: Regenerate.
2013-10-07 17:08:34 +00:00
H.J. Lu b14016f0b2 Use relative relocation for R_X86_64_32 on x32
2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>

	PR gold/15927
	* x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
	relocation for R_X86_64_32 on x32.
2013-09-03 17:38:57 +00:00
Roland McGrath eb426534c3 gold/
* output.cc (Output_segment::set_section_addresses): Take new
	Target* argument.  If target->isolate_execinstr() and the segment
	is executable and starts at a target->abi_pagesize() boundary,
	pad its end out to a target->abi_pagesize() boundary with code fill.
	* output.h (Output_segment::set_section_addresses): Update decl.
	* layout.h (Layout::check_output_data_for_reset_values): Take new
	argument RELAX_OUTPUTS.
	(Layout): New member relax_output_list_.
	(Layout::add_relax_output): New method.
	* layout.cc (Layout::Layout): Update constructor.
	(Layout::reset_relax_output): New method.
	(Layout::clean_up_after_relaxation): Call it.
	(Layout::prepare_for_relaxation): Update caller.
	(Layout::set_segment_offsets): Update callers of set_section_addresses.
	Call reset_relax_output before re-processing segments for
	isolate_execinstr case.
	(Layout::write_data): Handle relax_output_list_.
	(Layout::Relaxation_debug_check::check_output_data_for_reset_values):
	Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2013-08-27 21:49:48 +00:00
Nick Clifton 9aff4b7ac1 PR binutils/15834
Fix typos:
---
 bfd/bfdio.c                                  |  2 +-
 bfd/elf32-spu.c                              |  2 +-
 bfd/elfnn-aarch64.c                          |  2 +-
 binutils/od-xcoff.c                          |  2 +-
 config/tcl.m4                                |  2 +-
 gas/config/tc-ia64.c                         |  2 +-
 gas/config/tc-sparc.c                        |  2 +-
 gas/config/tc-z80.c                          | 12 ++++++------
 gas/doc/c-i386.texi                          |  6 +++---
 gas/doc/c-m32r.texi                          |  2 +-
 gas/testsuite/gas/d10v/instruction_packing.d |  2 +-
 gas/testsuite/gas/z80/atend.d                |  2 +-
 gold/object.h                                |  2 +-
 include/gdb/remote-sim.h                     |  2 +-
 include/opcode/ChangeLog                     |  2 +-
 include/opcode/i960.h                        |  2 +-
 ld/testsuite/ld-mips-elf/mips16-pic-1.inc    |  2 +-
 opcodes/aarch64-asm.c                        |  2 +-
 opcodes/aarch64-dis.c                        |  2 +-
 opcodes/msp430-dis.c                         |  2 +-
2013-08-23 07:54:19 +00:00
Roland McGrath 93f8221c64 gold/
* i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
	* x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2013-08-16 18:12:05 +00:00
Cary Coutant e44c371564 gold/
Revert support for v2 DWP files:

	2013-03-01  Cary Coutant  <ccoutant@google.com>

	    Add dwp support for v2 DWARF package file format.
	    * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
	    tu_length parameter.  Adjust all callers.
	    * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
	    * dwp.cc: Include dwarf.h.
	    (Section_bounds): New struct type.
	    (Unit_set): New struct type.
	    (Dwo_file::Dwo_file): Initialize new data member.
	    (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
	    Combine and rename to...
	    (Dwo_file::read_unit_index): ...this.
	    (Dwo_file::sized_read_compunit_index)
	    (Dwo_file::sized_read_typeunit_index): Combine and rename to...
	    (Dwo_file::sized_read_unit_index): ...this.
	    (Dwo_file::copy_section): Remove section_name, is_str_offsets
	    parameters; add section_id parameter.
	    (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
	    (Dwo_file::add_unit_set): ...this.
	    (Dwo_file::shndx_map_): Remove.
	    (Dwo_file::sect_offsets_): New data member.
	    (Dwp_output_file::Dwp_output_file): Initialize new data members.
	    (Dwp_output_file::add_section): Rename to...
	    (Dwp_output_file::add_contribution): ...this.
	    (Dwp_output_file::add_cu_set): Combine parameters into a struct.
	    (Dwp_output_file::add_tu_set): Likewise.
	    (Dwp_output_file::Contribution): New type.
	    (Dwp_output_file::Section::contributions): New data member.
	    (Dwp_output_file::Cu_or_tu_set): Remove.
	    (Dwp_output_file::Section::Section): New ctor.
	    (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
	    (Dwp_output_file::Dwp_index::Section_table): New type.
	    (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
	    (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
	    parameter.
	    (Dwp_output_file::Dwp_index::shndx_pool): Remove.
	    (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
	    (Dwp_output_file::Dwp_index::section_table): New member function.
	    (Dwp_output_file::Dwp_index::section_table_end): New member function.
	    (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
	    (Dwp_output_file::Dwp_index::section_table_rows): New member function.
	    (Dwp_output_file::Dwp_index::section_table_cols): New member function.
	    (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
	    (Dwp_output_file::Dwp_index::section_table_): New data member.
	    (Dwp_output_file::Dwp_index::section_mask_): New data member.
	    (Dwp_output_file::add_output_section): New member function.
	    (Dwp_output_file::write_new_section): New member function.
	    (Dwp_output_file::write_contributions): New member function.
	    (Dwp_output_file::section_id_map_): New data member.
	    (class Dwo_id_info_reader): Remove.
	    (class Unit_reader): New class.
	    (get_dwarf_section_name): New function.
	    (Dwo_file::read_executable): Adjust initializations of class data.
	    (Dwo_file::read): Add support for v2 package file format.
	    (Dwo_file::read_unit_index): Likewise.
	    (Dwo_file::sized_read_unit_index): Likewise.
	    (Dwo_file::copy_section): Likewise.
	    (Dwo_file::add_unit_set): Likewise.
	    (Dwp_output_file::add_output_section): Likewise.
	    (Dwp_output_file::add_contribution): Likewise.
	    (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
	    for empty slot.
	    (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
	    file format.
	    (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
	    slot.
	    (Dwp_output_file::initialize): Remove unused function.
	    (Dwp_output_file::finalize): Add support for v2 package file format.
	    (Dwp_output_file::write_index): Likewise.
	    * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
	    function prototype.
2013-08-07 17:11:24 +00:00
Cary Coutant c6905c28a5 gold/
* object.cc (Sized_relobj::do_output_section_address): New function.
	(Sized_relobj): Instantiate explicitly.
	* object.h (Object::output_section_address): New function.
	(Object::do_output_section_address): New function.
	(Sized_relobj::do_output_section_address): New function.
	* powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2013-07-31 18:47:50 +00:00
Cary Coutant 5cdb4d9821 Add missing author to last ChangeLog entry. 2013-07-30 21:29:50 +00:00
Cary Coutant a67858e046 gold/
* parameters.cc (Parameters::entry): Return target-specific entry
    	symbol name.
    	* target.h (Target::entry_symbol_name): New function.
    	(Target_info::entry_symbol_name): New data member.

    	* arm.cc (Target_arm::arm_info): Add entry_symbol_name.
    	(Target_arm_nacl::arm_nacl_info): Likewise.
    	* i386.cc (Target_i386::i386_info): Likewise.
    	(Target_i386_nacl::i386_nacl_info): Likewise.
    	* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
    	* sparc.cc (Target_sparc::sparc_info): Likewise.
    	* tilegx.cc (Target_tilegx::tilegx_info): Likewise.
    	* x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
    	(Target_x86_64_nacl::x86_64_nacl_info) Likewise.
    	* testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2013-07-30 21:26:53 +00:00
Sterling Augustine 234d4ab880 2013-07-22 Sterling Augustine <saugustine@google.com>
* dwarf_reader.cc (Dwarf_pubnames_table::read_section):
	Convert parameter shndx to local variable. Add parameters symtab
	and symtab_size.  Scan over section names.  Find relocation
	section corresponding to current section.  Create and initialize
	reloc_mapper_ and reloc_type_.
	(Dwarf_pubnames_table::read_header):  Add assertion.  Change
	unit_length to off_t.  Initialize member unit_length_.  Fill in field
	cu_offset_.
	* dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
	Initialize new fields unit_length_ and cu_offset_.
	(Dwarf_pubnames_table::read_section): Update prototype.
	(Dwarf_pubnames_table::cu_offset): New member function.
	(Dwarf_pubnames_table::subsection_size): Likewise.
	(Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
	New fields.
	(Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
	member functions public.
	* gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
	Update comment.  Rework logic.  Move repeated parts to...
	(Gdb_index_info_reader::read_pubtable): ...here. New function.
	(Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
	pubtypes_table_, and stmt_list_offset.
	(Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
	Gdb_index::find_pubtype_offset,
	Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
	(Gdb_index::pubnames_read): Update prototype and rework logic.
	* gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
	Forward declare.
	(Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
	Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
	Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
	Gdb_index::map_pubtable_to_dies):
	Declare functions.
	(Gdb_index::pubnames_read): Update declaration.
	(Gdb_index::Pubname_offset_map): New type.
	(Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
	Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
	Gdb_index::stmt_list_offset): Declare.
	(Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
	Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
	Gdb_index::pubtypes_offset_): Remove.
2013-07-29 18:29:12 +00:00
Roland McGrath a3ed37d8bc gold/
* options.h (General_options): Add -Trodata-segment option.
	* parameters.cc (Parameters::check_rodata_segment): New function.
	(Parameters::set_target_once): Call it.
	* parameters.h (Parameters): Declare it (private member function).
	* layout.cc (load_seg_unusable_for_headers): New function, broken
	out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
	then validate rodata segment rather than text segment.
	(relaxation_loop_body): Call that.
	(is_text_segment): New function.  Don't admit a non-executable
	segment if TARGET->isolate_execinstr().
	(set_segment_offsets): Call it.  Honor -Trodata-segment option.
2013-07-19 23:07:08 +00:00
Cary Coutant eb5b4dedf4 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
gold/
	PR gold/15070
	* fileread.h (File_read::get_view): Clarify comment about ALIGNED.
	* nacl.h (Sniff_file::View::View): Request aligned view.
2013-07-15 16:49:20 +00:00
Cary Coutant 4d5effb90d gold/
* powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
	correct BRLT entry size.
2013-07-11 21:30:56 +00:00
Alan Modra ba8ca3e739 bfd/
* elf64-ppc.c (struct ppc_stub_hash_entry): Delete "addend".
	(ppc64_elf_size_stubs): Don't set "addend".
	(ppc64_elf_relocate_section): Don't allow calls via
	toc-adjusting stubs without a following nop even in an
	executable, except for self-calls and both libc_start_main
	and .libc_start_main.
gold/
	* powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
	comment.
2013-07-03 02:22:35 +00:00
Cary Coutant 267257d249 gold/
* dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
	reloc_type_.
	(Dwarf_ranges_table::read_range_list): Call lookup_reloc.
	(Dwarf_ranges_table::lookup_reloc): New function.
	* dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
	reloc_type_.
	(Dwarf_ranges_table::lookup_reloc): New function.
	(Dwarf_ranges_table::reloc_type_): New data member.
2013-07-01 20:12:11 +00:00
Cary Coutant 06f30c9d10 PR gold/15662
* powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
	function.
	(Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
	(Target_powerpc::do_relax): Call the above.
2013-06-27 23:20:35 +00:00
Alan Modra a2d7bf59d6 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
on garbage collected .opd section.

	* powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
	is non-zero.
	(Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
	(Target_powerpc::do_function_location): Likewise for loc->shndx.
2013-06-27 03:11:22 +00:00
Cary Coutant 32364e50a7 gold/
* resolve.cc (Symbol::override_base): Don't override st_type
	from plugin placeholder symbols.
	(Symbol_table::resolve): Likewise.
	(Symbol_table::should_override): Don't complain about TLS mismatch
	if the TO symbol is a plugin placeholder.
	* testsuite/Makefile.am (plugin_test_tls): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test_tls.sh: New test script.
	* testsuite/two_file_test_2_tls.cc: New test source.
	* testsuite/two_file_test_tls.cc: New test source.
2013-06-14 20:07:18 +00:00
Cary Coutant 4ca24d905f gold/
Add missing test case from last patch.
2013-06-06 06:06:56 +00:00
Cary Coutant 7fb47cc9a4 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
gold/
	* layout.cc (Layout::set_segment_offsets): Taking care of the case when
	the maximum segment alignment is larger than the page size.
	* testsuite/Makefile.am (large_symbol_alignment): Test that Gold
	correctly aligns the symbols with large alignemnt.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/large_symbol_alignment.cc: New file.
2013-06-05 23:52:21 +00:00
Cary Coutant 6934001a98 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
Sriraman Tallam  <tmsriram@google.com>

	* options.h (sort_section): New option.
	* output.h (Input_section_sort_section_prefix_special_ordering_compare):
	Rename from Input_section_sort_section_name_special_ordering_compare.
	(Input_section_sort_section_name_compare): New struct.
	* output.cc (Output_section::Input_section_sort_section_name_compare::
	operator()): New function.
	(Output_section::sort_attached_input_sections): Use new sort function
	for .text if --sort-section=name is specified.
	* layout.cc (Layout::make_output_section):
	Add sorting by name when --sort-section=name is specified.
	* testsuite/Makefile.am (text_section_grouping): Test option
	--sort-section=name.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/section_sorting_name.cc: New file.
	* testsuite/section_sorting_name.sh: New file.
2013-05-30 23:01:11 +00:00
Cary Coutant 93acabad6a gold/
* symtab.h (Symbol::is_cxx_vtable): New function.
	* target-reloc.h (relocate_section): Check for vtable symbol.
	* testsuite/Makefile.am (missing_key_func.sh): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/missing_key_func.cc: New test source.
	* testsuite/missing_key_func.sh: New test script.
2013-05-21 21:14:40 +00:00
Cary Coutant 60e8b3fccd gold/
* object.cc (Sized_relobj_file::get_symbol_location_info): Set
    	type of enclosing symbol.
    	(Relocate_info::location): Check symbol type when describing symbol.
    	* object.h (Symbol_location_info): Remove unused line_number;
    	add enclosing_symbol_type.
    	* testsuite/debug_msg.sh: Adjust expected output.
2013-05-21 20:56:13 +00:00
Cary Coutant 9df9de2cca gold/
* configure.ac: Export DEFAULT_TARGET.
    	* configure: Regenerate.
    	* Makefile.in: Regenerate.
    	* testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
    	* testsuite/Makefile.in: Regenerate.
    	* testsuite/debug_msg.sh: Delete duplicate tests.
    	Don't check undef_int error message match for powerpc where the
    	source file and line number aren't available.
2013-05-13 17:35:22 +00:00
Roland McGrath bbc5ae17c4 gold/
* options.h (General_options): Add --rosegment-gap option.
	* options.cc (finalize): --rosegment-gap implies --rosegment.
	* layout.cc (set_segment_offsets): Let user option override
	target->rosegment_gap().
2013-05-10 22:33:35 +00:00
Roland McGrath 0c6e6c39ad gold/
* options.h (General_options): Remove leading space from help
	messages for -nostdlib and --rosegment.
2013-05-10 20:35:47 +00:00
Maciej W. Rozycki cde7cb0129 gold/
PR ld/15365
        * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.

        ld/
        PR ld/15365
        * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
        Restrict __ehdr_start's export class to no less than STV_HIDDEN.

        ld/testsuite/
        PR ld/15365
        * ld-elf/ehdr_start.d: Expect __ehdr_start to be STB_LOCAL.
        * ld-mips-elf/ehdr_start-1.nd: New test.
        * ld-mips-elf/ehdr_start-2.nd: New test.
        * ld-mips-elf/ehdr_start-1.ld: New test linker script.
        * ld-mips-elf/ehdr_start-2.ld: New test linker script.
        * ld-mips-elf/ehdr_start-new.s: New test source.
        * ld-mips-elf/ehdr_start-o32.s: New test source.
        * ld-mips-elf/mips-elf.exp: Run the new tests.
2013-05-03 15:19:27 +00:00
Alan Modra f31ae5b84b * merge.cc (Output_merge_string::do_add_input_section): Correct
scan for number of strings.  Rename vars to avoid shadowing.
	Include missing terminator in input_size_.
2013-05-03 09:30:24 +00:00
H.J. Lu d3a7cd45fd Restore empty string handling
* merge.cc (Output_merge_string<Char_type>::do_add_input_section):
	Restore empty string handling.
2013-05-01 19:45:27 +00:00
Cary Coutant 6ad3dabab5 gold/
* stringpool.cc (Stringpool_template::new_key_offset): Fix
	uninitialized warning.
2013-05-01 17:37:14 +00:00
Cary Coutant e31908b642 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
gold/
	* output.cc (Output_section::add_merge_input_section): Allow
	to merge sections if the alignment is more than character size.
	* merge.h (Output_merge_string::Output_merge_string): Remove
	assert.
	* merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
	only not-null strings. Check the alignment of strings.
	* stringpool.h
	(Stringpool_template<Stringpool_char>::Stringpool_template): Add
	alignment as the argument.
	(Stringpool_template<Stringpool_char>::addralign_): New class member.
	* stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
	Align non-zero length strings according to the addralign_.
	(Stringpool_template<Stringpool_char>::set_string_offsets):
	Updating offsets according to the given alignment.
	* testsuite/Makefile.am (text_section_grouping): Test if string
	literals are getting merged.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/merge_string_literals_1.c: New file.
	* testsuite/merge_string_literals_2.c: Ditto.
	* testsuite/merge_string_literals.sh: Ditto.
2013-04-29 17:15:09 +00:00
Ian Lance Taylor 0e8048633e * target-reloc.h (relocate_section): If the reloc offset is out of
range, pass VIEW as NULL to relocate.relocate.
	* arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
	* i386.cc (Target_i386::Relocate::relocate): Likewise.
	* powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
	* sparc.cc (Target_sparc::Relocate::relocate): Likewise.
	* tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
	* x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2013-04-27 00:53:16 +00:00
Cary Coutant e7c5ea405f 2013-04-26 Geoff Pike <gpike@chromium.org>
gold/
	* gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
	* layout.cc (Hash_task): New class.
	(Layout::queue_build_id_tasks): New function.
	(Layout::write_build_id): Handle single-thread portion of build ID
	computation.  (In some cases, all of it is single-threaded.)  Replace
	{sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
	functionality in fewer lines of code.
	* layout.h (Layout::queue_build_id_tasks): New function declaration.
	* options.h (General_options): make "--build-id" default to tree
	rather than sha1.  Add two new options related to --build-id=tree:
	--build-id-chunk-size-for-treehash and
	--build-id-min-file-size-for-treehash.
	* Makefile.am: add testing of --build-id=tree and related new options
	(these tests will be invoked by "make check").
	* Makefile.in: Regenerate.
2013-04-26 21:38:57 +00:00
Alan Modra 49926cd0c8 bfd/
* config.bfd: Add powerpc64le-linux.
gas/
	* configure.in: Allow little-endian linux.
	* configure: Regenerate.
gold/
	* configure.tgt: Add powerpcle and powerpc64le.
ld/
	* Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lppclinux.c.
	(eelf32lppclinux.c): New rule.
	* Makefile.in: Regenerate.
	* configure.tgt: Merge powerpc-linux and other powerpc-elf targets
	with corresponding little-endian targets.
	* emulparams/elf32lppc.sh: Update comment.
	* emulparams/elf32lppclinux.sh: New.
2013-04-25 13:22:52 +00:00
Alan Modra a40347502e PR gold/15355
* layout.cc (Layout::segment_precedes): Allow more than one
	segment with the same type and flags.
2013-04-21 23:21:56 +00:00
Cary Coutant e79c84aa33 gold/
* layout.cc (Layout::set_relocatable_section_offsets): Don't
	allocate space in file for BSS sections.
2013-04-15 16:40:59 +00:00
Cary Coutant 2199fbe773 gold/
* script-sections.cc (Orphan_output_section): Reset address
	to zero after each orphaned section for relocatable links.
2013-04-15 16:37:30 +00:00
Cary Coutant 502e8a8430 gold/
* symtab.cc (Symbol_table::sized_write_globals): Subtract
    	section starting address for relocatable link.
    	* testsuite/Makefile.am (script_test_11): New test.
    	* testsuite/Makefile.in: Regenerate.
    	* testsuite/script_test_11.c: New source file.
    	* testsuite/script_test_11.t: New linker script.
2013-04-15 16:34:12 +00:00
Alan Modra 0cfdc76718 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
owner when sections are not adjacent and exceed group size.
	(Target_powerpc::group_sections): Handle corner case.
	(Target_powerpc::Branch_info::make_stub): Handle case where
	stub table doesn't exist due to branches in non-exec sections.
	(Target_powerpc::Relocate::relocate): Likewise.
2013-04-13 10:12:30 +00:00
Alan Modra 6830ee24c7 PR gold/15354
* powerpc.cc (Target_powerpc::make_brlt_section): Name section
	.branch_lt to match bfd ld.  Adjust comments throughout file.
2013-04-11 01:28:27 +00:00
Ian Lance Taylor 54a3d86564 GCC PR c++/56840
* object.cc (do_layout_deferred_sections): Handle .eh_frame
	sections before checking whether they are included in the link.
2013-04-04 16:49:04 +00:00
Sriraman Tallam 9993ba115b 2013-03-29 Sriraman Tallam <tmsriram@google.com>
* archive.cc (Archive::get_elf_object_for_member):  Create the elf
	object before calling the plugin claim_file handler.  Pass the elf
	object of the archive to the plugin. Delete the elf object if the
	plugin claims the file.
2013-03-30 01:03:23 +00:00
Alan Modra ebacd51e16 * layout.cc (Layout::set_segment_offsets): Accept writable .text
segment when omagic.
2013-03-21 04:52:55 +00:00
Alan Modra 117be58fad * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
comparison warning.
	* layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
	uninitialized" warning.
2013-03-21 02:00:16 +00:00
Alan Modra 32e2b61d0b * symtab.h (Symbol::clear_version): New function.
* symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
	is_needed by weak references.  Clear version for symbols defined
	in as-needed objects that are not needed.
2013-03-20 00:25:28 +00:00
Alan Modra b3ccdeb53f * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
static and public.  Add report_err param.  Return false for data refs.
	(Target_powerpc::rela_dyn_section): New overloaded function.
	(Target_powerpc::plt_, iplt_): Elucidate.
	(Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
	(Output_data_plt_powerpc::do_write): Don't write .iplt.
	(Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
	(Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
	calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
	push_branch and make_plt_entry for ifunc syms when
	reloc_needs_plt_for_ifunc.
	(Target_powerpc::Relocate::relocate): Don't use plt entry value
	for ifunc unless reloc_needs_plt_for_ifunc.
2013-03-15 08:40:49 +00:00
Alan Modra ad3d8a2f04 * gc.h (gc_process_relocs): Don't look through function descriptors.
* icf.cc (get_section_contents): Do so here instead.
2013-03-15 07:51:32 +00:00
Alan Modra 4d9aa15515 * powerpc.cc (is_branch_reloc): Forward declare.
(Target_powerpc::do_can_check_for_function_pointers): New predicate.
	(Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
	false for 64-bit, true for 32-bit non-branch relocs.
	(Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
	* testsuite/Makefile.am (icf_test): Use linker map file instead of
	nm output.
	(icf_safe_test): Generate linker map file as well as nm output.
	(icf_safe_so_test): Likewise.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/icf_test.sh: Parse linker map file to determine
	section folding.
	* testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
	* testsuite/icf_safe_so_test.sh: Likewise.
	(X86_32_or_ARM_specific_safe_fold): Merge into..
	(arch_specific_safe_fold): ..this.
	(X86_64_specific_safe_fold): Delete unused function.
2013-03-12 22:46:19 +00:00
Alan Modra 57420c2084 * gc.h (gc_process_relocs): Look through function descriptors
to determine shndx, symvalue and addend used by ICF.  Tidy
	variable duplication.
2013-03-12 00:42:14 +00:00
Alan Modra dc3714f31f * gold.cc (queue_middle_tasks): Move detect_odr_violations..
* layout.cc (Layout_task_runner::run): ..to here.
	* symtab.h (struct Symbol_location): Extract from..
	(class Symbol_table): ..here.
	* symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
	* target.h (class Target): Add function_location and
	do_function_location functions.
	(class Sized_target): Add do_function_location.
	* object.h (class Sized_relobj_file): Move find_shdr..
	(class Object): ..to here.
	* object.cc: Likewise.  Update to suit.  Instantiate.
	(Sized_relobj_file::find_eh_frame): Update find_shdr call.
	* powerpc.cc (class Powerpc_dynobj): New.
	(Target_powerpc::do_function_location): New function.
	(Powerpc_relobj::do_find_special_sections): Update find_shdr call.
	(Powerpc_dynobj::do_read_symbols): New function.
	(Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2013-03-10 23:08:18 +00:00
Ian Lance Taylor 956b03bbdf * options.cc (General_options::string_to_object_format): Accept
"default".
2013-03-08 22:34:46 +00:00
Alan Modra 4bead2d512 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
pointer to Post_fde.
	(struct Post_fde): Move definition to here..
	* ehframe.cc (struct Post_fde): ..from here.
	(Cie::write): Don't alloc Post_fde.
	(Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2013-03-07 23:27:53 +00:00
Alan Modra 02e60bf7ba * testsuite/discard_locals_relocatable_test.c: Add a powerpc
relocation referencing .LC0.
	* testsuite/discard_locals_test.sh: Remove FIXMEs.
2013-03-07 05:33:50 +00:00
Alan Modra 8343f03ae2 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
always_inline.  Add assembly for powerpc to avoid GOT.
2013-03-07 05:31:44 +00:00
Alan Modra 3366d57cbc * testsuite/script_test_10.sh: Don't test .bss section
header number.
2013-03-07 05:30:06 +00:00
Alan Modra 6c77229c00 * powerpc.cc (class Powerpc_relobj): Move some member functions.
(Target_powerpc::symval_for_branch):  Add symtab param.  Update
	all callers.  Handle folded sections.
	(Target_powerpc::do_gc_add_reference): Don't cast dynamic object
	to Powerpc_relobj.
	(Global_symbol_visitor_opd::operator()): Likewise.
2013-03-06 12:28:47 +00:00
Alan Modra a39e4af6dc * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
* testsuite/Makefile.in: Regenerate.
2013-03-04 00:48:01 +00:00
Cary Coutant d5834edbc8 Add dwp support for v2 DWARF package file format.
gold/
	* dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
	tu_length parameter.  Adjust all callers.
	* dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
	* dwp.cc: Include dwarf.h.
	(Section_bounds): New struct type.
	(Unit_set): New struct type.
	(Dwo_file::Dwo_file): Initialize new data member.
	(Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
	Combine and rename to...
	(Dwo_file::read_unit_index): ...this.
	(Dwo_file::sized_read_compunit_index)
	(Dwo_file::sized_read_typeunit_index): Combine and rename to...
	(Dwo_file::sized_read_unit_index): ...this.
	(Dwo_file::copy_section): Remove section_name, is_str_offsets
	parameters; add section_id parameter.
	(Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
	(Dwo_file::add_unit_set): ...this.
	(Dwo_file::shndx_map_): Remove.
	(Dwo_file::sect_offsets_): New data member.
	(Dwp_output_file::Dwp_output_file): Initialize new data members.
	(Dwp_output_file::add_section): Rename to...
	(Dwp_output_file::add_contribution): ...this.
	(Dwp_output_file::add_cu_set): Combine parameters into a struct.
	(Dwp_output_file::add_tu_set): Likewise.
	(Dwp_output_file::Contribution): New type.
	(Dwp_output_file::Section::contributions): New data member.
	(Dwp_output_file::Cu_or_tu_set): Remove.
	(Dwp_output_file::Section::Section): New ctor.
	(Dwp_output_file::Dwp_index::Shndx_pool): Remove.
	(Dwp_output_file::Dwp_index::Section_table): New type.
	(Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
	(Dwp_output_file::Dwp_index::enter_set): Change type of "set"
	parameter.
	(Dwp_output_file::Dwp_index::shndx_pool): Remove.
	(Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
	(Dwp_output_file::Dwp_index::section_table): New member function.
	(Dwp_output_file::Dwp_index::section_table_end): New member function.
	(Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
	(Dwp_output_file::Dwp_index::section_table_rows): New member function.
	(Dwp_output_file::Dwp_index::section_table_cols): New member function.
	(Dwp_output_file::Dwp_index::shndx_pool_): Remove.
	(Dwp_output_file::Dwp_index::section_table_): New data member.
	(Dwp_output_file::Dwp_index::section_mask_): New data member.
	(Dwp_output_file::add_output_section): New member function.
	(Dwp_output_file::write_new_section): New member function.
	(Dwp_output_file::write_contributions): New member function.
	(Dwp_output_file::section_id_map_): New data member.
	(class Dwo_id_info_reader): Remove.
	(class Unit_reader): New class.
	(get_dwarf_section_name): New function.
	(Dwo_file::read_executable): Adjust initializations of class data.
	(Dwo_file::read): Add support for v2 package file format.
	(Dwo_file::read_unit_index): Likewise.
	(Dwo_file::sized_read_unit_index): Likewise.
	(Dwo_file::copy_section): Likewise.
	(Dwo_file::add_unit_set): Likewise.
	(Dwp_output_file::add_output_section): Likewise.
	(Dwp_output_file::add_contribution): Likewise.
	(Dwp_output_file::Dwp_index::find_or_add): Use row index to check
	for empty slot.
	(Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
	file format.
	(Dwp_output_file::Dwp_index::grow): Use row index to check for empty
	slot.
	(Dwp_output_file::initialize): Remove unused function.
	(Dwp_output_file::finalize): Add support for v2 package file format.
	(Dwp_output_file::write_index): Likewise.
	* gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
	function prototype.
2013-03-01 23:05:27 +00:00