Commit Graph

357 Commits

Author SHA1 Message Date
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 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
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
Roland McGrath 52dc3f9c91 Revert inappropriate portions of last change. 2013-10-11 22:16:34 +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 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
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
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
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
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
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 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 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 a39e4af6dc * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
* testsuite/Makefile.in: Regenerate.
2013-03-04 00:48:01 +00:00
Sriraman Tallam c6ac678db5 Default text reordering fix with a flag to turn it off.
2013-01-24  Sriraman Tallam  <tmsriram@google.com>

	* layout.cc (Layout::layout): Check for option text_reorder.
	(Layout::make_output_section): Ditto.
	* options.h (text_reorder): New option.
	* output.cc (Input_section_sort_compare): Remove special ordering
	of section names.
	(Output_section::
	 Input_section_sort_section_name_special_ordering_compare::
	 operator()): New function.
	(Output_section::sort_attached_input_sections): Use new sort function
	for .text.
	* output.h (Input_section_sort_section_name_special_ordering_compare):
	New struct.
	* testsuite/Makefile.am (text_section_grouping): Test option
	--no-text-reorder
	* testsuite/Makefile.in: Regenerate.
	* testsuite/text_section_grouping.sh: Check order of functions without
	default text reordering.
2013-01-24 18:49:55 +00:00
Sriraman Tallam a880d4c4d4 2013-01-16 Sriraman Tallam <tmsriram@google.com>
* testsuite/plugin_final_layout.cc: Fix comment.
2013-01-17 00:00:48 +00:00
Sriraman Tallam 7c381248b3 2013-01-16 Sriraman Tallam <tmsriram@google.com>
* layout.cc (Layout::layout): Do not do default sorting for
	text sections when section ordering is specified.
	(make_output_section): Ditto.
	* testsuite/plugin_final_layout.cc: Name the function sections
	to catch reordering issues.
2013-01-16 22:47:14 +00:00
Alan Modra 431ed302a8 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
* testsuite/Makefile.in: Regenerate.
2013-01-14 23:11:56 +00:00
Alan Modra 0ec6429be3 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
* testsuite/Makefile.in: Regenerate.
2013-01-14 12:56:39 +00:00
Ian Lance Taylor 0bf402d505 Fix mingw gold build with plugins enabled
* Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
	* configure.ac: Export DLOPEN_LIBS and add headers check.
	* plugin.cc: Handle non-dlfcn case.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2013-01-11 14:36:36 +00:00
Sriraman Tallam 9e9143bc87 Make linker scripts and section ordering via --section-ordering-file or
linker plugins work. This patch lets linker scripts take precedence.

2013-01-09  Sriraman Tallam  <tmsriram@google.com>

	* output.h (sort_attached_input_sections): Change to be public.
	* script-sections.cc
	(Output_section_definition::set_section_addresses): Sort
	attached input sections according to section order before linker
	script assigns section addresses.
	(Orphan_output_section::set_section_addresses): Sort
	attached input sections according to section order before linker
	script assigns section addresses.
	* Makefile.am (final_layout.sh): Use a simple linker script to
	check if section ordering still works.
	* Makefile.in: Regenerate.
2013-01-10 00:18:15 +00:00
Cary Coutant 3d587466ef gold/
* testsuite/Makefile.am (CXXLINK_S): New macro.
	(debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
	* testsuite/Makefile.in: Regenerate.
2013-01-04 23:50:27 +00:00
Sriraman Tallam 28f2a4ac6f Group text sections with prefixes .text.unlikely,.text.hot and .text.startup
by default.


2012-12-18  Sriraman Tallam  <tmsriram@google.com>

	* layout.cc (Layout::is_section_name_prefix_grouped): New function.
	* layout.h (Layout::is_section_name_prefix_grouped): New function.
	* output.cc (Output_section::add_input_section): Check if section
	name contains special prefix.  Keep input sections to sort such
	sections.
	(Output_section::Input_section_sort_section_order_index_compare
	 ::operator()): Group sections according to prefixes.
	* (Output_section::sort_attached_input_sections): Add condition
	to Input_section_entry constructor call.
	* testsuite/Makefile.am (text_section_grouping): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/text_section_grouping.cc: New file.
	* testsuite/text_section_grouping.sh: New file.
2012-12-19 02:55:15 +00:00
Cary Coutant 59965708ea gold/
* testsuite/Makefile.am (exception_separate_shared_12_test): Add
    	--no-as-needed flag.
    	(exception_separate_shared_12_test): Likewise.
    	(incremental_copy_test): Likewise.
    	* testsuite/Makefile.in: Regenerate.
2012-12-15 01:55:08 +00:00
Roland McGrath 4c8a1de1fe gold/
* testsuite/binary_unittest.cc (read_all): New function.
	(Sized_binary_test): Use it instead of ::read.
	* fileread.cc (do_read): Don't assume pread always reads the whole
	amount in a single call.
2012-12-10 17:38:42 +00:00
Roland McGrath 418c15ae72 gold/
* testsuite/binary_unittest.cc (Sized_binary_test):
	Use open_descriptor rather than ::open.
2012-12-07 21:48:32 +00:00
Ian Lance Taylor ae2eea65c6 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2012-12-07 04:28:52 +00:00
Roland McGrath 62fe925ad4 gold/
* target.h (Sized_target::relocate_relocs): Use Elf_Off
	for offset_in_output_section parameter.
	(Sized_target::relocate_special_relocatable): Likewise.
	* arm.cc (Target_arm::relocate_relocs): Likewise.
	(Target_arm::relocate_special_relocatable): Likewise.
	* i386.cc (Target_i386::relocate_relocs): Likewise.
	* powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
	* sparc.cc (Target_sparc::relocate_relocs): Likewise.
	* target-reloc.h (relocate_relocs): Likewise.
	* testsuite/testfile.cc (Target_test): Likewise.
	* tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
	* x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2012-11-01 23:27:00 +00:00
H.J. Lu b2490a7b4f Add final_layout_sequence.txt to MOSTLYCLEANFILES
* testsuite/Makefile.am (MOSTLYCLEANFILES): Add
	final_layout_sequence.txt.
	* testsuite/Makefile.in: Regenerated.
2012-10-26 00:50:05 +00:00
H.J. Lu aa54351297 Strip out -Wp,-D_FORTIFY_SOURCE= for gold tests
* testsuite/Makefile.am (COMPILE1): New variable. Renamed from
	COMPILE generated by automake.
	(LINK1): Likewise.
	(CXXCOMPILE1): Likewise.
	(CXXLINK1): Likewise.
	(COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
	(LINK): Likewise.
	(CXXCOMPILE): Likewise.
	(CXXLINK): Likewise.
	* testsuite/Makefile.in: Regenerated.
2012-10-25 22:50:54 +00:00
Cary Coutant 35c813e224 gold/
* testsuite/Makefile.am (TEST_OBJCOPY): New macro.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/dwp_test.h: New source file.
	* testsuite/dwp_test_1.cc: New source file.
	* testsuite/dwp_test_1.s: New source file.
	* testsuite/dwp_test_1.sh: New source file.
	* testsuite/dwp_test_1b.cc: New source file.
	* testsuite/dwp_test_1b.s: New source file.
	* testsuite/dwp_test_2.cc: New source file.
	* testsuite/dwp_test_2.s: New source file.
	* testsuite/dwp_test_2.sh: New source file.
	* testsuite/dwp_test_main.cc: New source file.
	* testsuite/dwp_test_main.s: New source file.
2012-10-24 02:32:15 +00:00
Walter Lee 5c0b3823c6 Add support for tilegx in gold.
* configure.ac (ENABLE_GOLD): support tilegx*
	* configure: rebuild
elfcpp:
	* tilegx.h: New file.
	* elfcpp.h: add EM_TILEGX.
gold:
	* tilegx.cc: New file.
	* Makefile.am (TARGETSOURCES): Add tilegx.cc
	(ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
	* configure.tgt: Add entries for tilegx*.
	* configure.ac: Likewise.
	* Makefile.in: Rebuild.
	* configure: Likewise.
	* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
	tilegx.
2012-09-15 17:11:28 +00:00
Cary Coutant d2d60eefc4 2012-09-06 Cary Coutant <ccoutant@google.com>
gold/
	* dwarf_reader.cc (Dwarf_die::read_attributes): Add
	DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
	(Dwarf_die::skip_attributes): Likewise.
	* object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
	* testsuite/gdb_index_test.cc (inline_func_1): New function.
	(main): Call it.
	* testsuite/gdb_index_test_comm.sh: Check index for inline function.
2012-09-07 20:14:10 +00:00
H.J. Lu 32ed457365 Add .got.plt output section statement
* testsuite/script_test_3.t: Add .got.plt output section
	statement.
	* testsuite/script_test_4.t: Likewise.
2012-09-06 04:46:18 +00:00
Alan Modra 864a1b5697 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
* configure: Regenerate.
	* testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
	(plugin_final_layout.stdout): Likewise.
	(memory_test): Set page sizes to 0x1000.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/discard_locals_test.sh: Add FIXME comment.
	* testsuite/justsyms_exec.c: Disable function test for powerpc64.
	* testsuite/pr14265.t: Add .got output section statement.
	* testsuite/script_test_2.t: Likewise.
	* testsuite/script_test_3.t: Likewise.
	* testsuite/script_test_4.t: Likewise.
	* testsuite/script_test_5.t: Likewise.
	* testsuite/script_test_6.t: Likewise.
	* testsuite/script_test_7.t: Likewise.
	* testsuite/script_test_9.t: Likewise.
2012-09-05 11:01:43 +00:00
Alan Modra 7404fe1b8d * object.h (Sized_relobj_file::emit_relocs): Delete.
(Sized_relobj_file::emit_relocs_reltype): Delete.
	* reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
	relocate_relocs for --emit-relocs.
	(Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
	* output.h: Update comment.
	(Output_segment::first_section): New function.
	(Output_segment::first_section_load_address): Use first_section.
	* output.cc (Output_segment::first_section): New function extracted..
	(Output_segment::first_section_load_address): ..from here.  Delete.
	* target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
	* target.h (Sized_target::relocate_for_relocatable): Likewise.
	* arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
	adjust call to target.h function.
	* i386.cc (Target_i386): Likewise.
	* sparc.cc (Target_sparc): Likewise.
	* x86_64.cc (Target_x86_64): Likewise.
	* powerpc.cc (Target_powerpc): Likewise.
	(Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
	first tls section has section symbol for optimised local dynamic
	output relocs.
	(Target_powerpc::Relocate::relocate): Correct local dynamic value.
	(Target_powerpc::relocate_relocs): Adjust relocs emitted for
	optimised tls code.
	* testsuite/testfile.cc (Target_test::relocate_for_relocatable):
	Rename to relocate_relocs.  Update error message.
2012-09-05 00:34:20 +00:00
Sriraman Tallam 16164a6b00 Patch adds support to allow plugins to map selected subset of sections to unique
segments.


2012-08-24  Sriraman Tallam  <tmsriram@google.com>

	* gold.cc (queue_middle_tasks): Call layout again when unique
	segments for sections is desired.
	* layout.cc (Layout::Layout): Initialize new members.
	(Layout::get_output_section_flags): New function.
	(Layout::choose_output_section): Call get_output_section_flags.
	(Layout::layout): Make output section for mapping to a unique segment.
	(Layout::insert_section_segment_map): New function.
	(Layout::attach_allocated_section_to_segment): Make unique segment for
	output sections marked so.
	(Layout::segment_precedes): Check for unique segments when sorting.
	* layout.h (Layout::Unique_segment_info): New struct.
	(Layout::Section_segment_map): New typedef.
	(Layout::insert_section_segment_map): New function.
	(Layout::get_output_section_flags): New function.
	(Layout::is_unique_segment_for_sections_specified): New function.
	(Layout::set_unique_segment_for_sections_specified): New function.
	(Layout::unique_segment_for_sections_specified_): New member.
	(Layout::section_segment_map_): New member.
	* object.cc (Sized_relobj_file<size, big_endian>::do_layout):
	Rename is_gc_pass_one to is_pass_one.
	Rename is_gc_pass_two to is_pass_two.
	Rename is_gc_or_icf to is_two_pass.
	Check for which pass based on whether symbols data is present.
	Make it two pass when unique segments for sections is desired.
	* output.cc (Output_section::Output_section): Initialize new
	members.
	* output.h (Output_section::is_unique_segment): New function.
	(Output_section::set_is_unique_segment): New function.
	(Output_section::is_unique_segment_): New member.
	(Output_section::extra_segment_flags): New function.
	(Output_section::set_extra_segment_flags): New function.
	(Output_section::extra_segment_flags_): New member.
	(Output_section::segment_alignment): New function.
	(Output_section::set_segment_alignment): New function.
	(Output_section::segment_alignment_): New member.
	(Output_segment::Output_segment): Initialize is_unique_segment_.
	(Output_segment::is_unique_segment): New function.
	(Output_segment::set_is_unique_segment): New function.
	(Output_segment::is_unique_segment_): New member.
	* plugin.cc (allow_unique_segment_for_sections): New function.
	(unique_segment_for_sections): New function.
	(Plugin::load): Add new functions to transfer vector.
	* Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
	* Makefile.in: Regenerate.
	* testsuite/plugin_final_layout.sh: Check if unique segment
	functionality works.
	* testsuite/plugin_section_order.c (onload): Check if new interfaces
	are available.
	(allow_unique_segment_for_sections): New global.
	(unique_segment_for_sections): New global.
	(claim_file_hook): Call allow_unique_segment_for_sections.
	(all_symbols_read_hook): Call unique_segment_for_sections.


2012-08-24  Sriraman Tallam  <tmsriram@google.com>

	* plugin-api.h (ld_plugin_allow_unique_segment_for_sections):
	New interface.
	(ld_plugin_unique_segment_for_sections): New interface.
	(LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val.
	(LDPT_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val.
	(tv_allow_unique_segment_for_sections): New member.
	(tv_unique_segment_for_sections): New member.
2012-08-24 18:35:35 +00:00
Nick Clifton b9b2ae8bbf PR ld/14265
* script-sections.cc (Sections_element::output_section_name): Add
	keep return parameter.
	(Output_section_element::match_name): Add keep return parameter.
	Return the value of the keep_ member.
	* script-sections.h (class Output_section): Update
	output_section_name prototype.
	* layout.cc (Layout::keep_input_section): New public member
	function.
	(Layout::choose_output_section): Pass keep parameter to
	output_section_name.
	* layout.h (class Layout): Add keep_input_section.
	* object.cc (Sized_relobj_file::do_layout): Check for kept input
	sections.
	* testsuite/Makefile.am: Add a test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/pr14265.c: Source file for the test.
	* testsuite/pr14265.t: Linker script for the test.
	* testsuite/pr14265.sh: Shell script for the test.

	* ld-gc/gc.exp: Add a new test.
	* ld-gc/pr14265.c: Source file for the new test.
	* ld-gc/pr14265.t: Linker script for the new test.
	* ld-gc/pr14265.d: Expected symbol dump.
2012-08-14 08:31:57 +00:00
Cary Coutant f1415016b6 2012-07-18 Cary Coutant <ccoutant@google.com>
PR gold/14344
	* configure.ac: Add check for -gpubnames support.
	* configure: Regenerate.
	* testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
	support; force -gno-pubnames.
	(gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
	support.
	(gdb_index_test_4): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gdb_index_test_1.sh: Refactor code into common file.
	* testsuite/gdb_index_test_2.sh: Likewise.
	* testsuite/gdb_index_test_3.sh: Don't look for space after colon.
	* testsuite/gdb_index_test_4.sh: New script.
	* testsuite/gdb_index_test_comm.sh: New script with common code;
	don't look for space after colon.
2012-07-19 00:19:35 +00:00