Commit Graph

65 Commits

Author SHA1 Message Date
Ian Lance Taylor e6188289b9 * script-sections.cc (Script_sections::create_segments): Use
header_size_adjustment even when there is enough room for the
	headers.
	* testsuite/script_test_4.sh: New file.
	* testsuite/script_test_4.t: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
	(check_DATA): Add script_test_4.stdout.
	(MOSTLYCLEANFILES): Likewise.
	(script_test_4): New target.
	(script_test_4.stdout): New target.
	* testsuite/Makefile.in: Rebuild.
2008-04-15 22:50:37 +00:00
Cary Coutant c2b45e22d5 2008-04-11 Cary Coutant <ccoutant@google.com>
Add support for TLS descriptors for i386 and x86_64.
	* i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
	(Target_i386::Relocate::tls_desc_gd_to_le): New function.
	(Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
	GOT_TYPE_TLS_DESC.
	(Target_i386::got_mod_index_entry): Remove unnecessary code.
	(Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
	R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
	relocations.
	(Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
	Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
	Fix problem with initial-exec relocations.
	(Target_i386::Relocate::relocate_tls): Likewise.
	(Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
	relaxation.
	* output.cc (Output_data_dynamic::Dynamic_entry::write): Add
	support for section-plus-offset dynamic table entries.
	* output.h (Output_data_dynamic::add_section_plus_offset): New function.
	(Output_data_dynamic::Dynamic_entry): Add support for
	section-plus-offset dynamic table entries.
	(Output_data_dynamic::Classification): Likewise.
	(Output_data_dynamic::classification_): Renamed offset_.
	* x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
	(Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
	(Target_x86_64::make_plt_section): New function.
	(Target_x86_64::reserve_tlsdesc_entries): New function.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
	(Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
	(Output_data_plt_x86_64::has_tlsdesc_entry): New function.
	(Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
	(Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
	(Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
	(Output_data_plt_x86_64::set_final_data_size): Move out of line;
	add extra PLT entry for TLS descriptors.
	(Output_data_plt_x86_64::got_): New field.
	(Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
	fields.
	(Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
	descriptors.
	(Target_x86_64::make_plt_entry): Factor out make_plt_section.
	(Target_x86_64::got_mod_index_entry): Remove unnecessary code.
	(Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
	R_386_TLS_DESC_CALL relocations.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::do_finalize_sections): Add dynamic table entries
	for TLS descriptors.
	(Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
	Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
	(Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
	GD-to-IE relaxation.
	* configure.ac: Export new conditional variables TLS_GNU2_DIALECT
	and TLS_DESCRIPTORS.
	* Makefile.in: Rebuild.
	* configure: Rebuild.
	* testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
	(tls_test_shared2.so): New target.
	(tls_shared_gd_to_ie_test_SOURCES): New variable.
	(tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
	(tls_shared_gd_to_ie_test_LDFLAGS): New variable.
	(tls_shared_gd_to_ie_test_LDADD): New variable.
	(tls_shared_gnu2_gd_to_ie_test): New target.
	(tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
	New targets.
	(tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
	(ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
	(tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
	(tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
	(tls_shared_gnu2_test): New target.
	(tls_test_gnu2_shared.so): New target.
	(tls_shared_gnu2_test_SOURCES): New variable.
	(tls_shared_gnu2_test_DEPENDENCIES): New variable.
	(tls_shared_gnu2_test_LDFLAGS): New variable.
	(tls_shared_gnu2_test_LDADD): New variable.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/Makefile.
2008-04-11 21:24:30 +00:00
Ian Lance Taylor 83bfb6b776 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
justsyms.t.
	* testsuite/Makefile.in: Rebuild.

	* testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
	long.
	* testsuite/script_test_2.cc (main): Adjust test.
2008-04-11 20:44:52 +00:00
Ian Lance Taylor 2cefc35727 PR gold/5996
* script-sections.cc (Sections_element::allocate_to_segment): Add
	orphan parameter.
	(Output_section_definition::allocate_to_segment): Likewise.
	(Orphan_output_section::allocate_to_segment): Likewise.
	(Script_sections::attach_sections_using_phdrs_clause): Don't
	propagate non-PT_LOAD segments to orphan sections.
	* testsuite/Makefile.am (script_test_3.stdout): Generate using
	readelf rather than objdump.
	* testsuite/script_test_3.sh: Adjust accordingly.  Test that
	.interp section and PT_INTERP segment are the same size.
	* testsuite/Makefile.in: Rebuild.
2008-04-10 01:02:46 +00:00
Ian Lance Taylor 99a37bfda0 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
aliases for symbols defined in the same object.
	* testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
	(weak_alias_test_SOURCES): New variable.
	(weak_alias_test_DEPENDENCIES): New variable.
	(weak_alias_test_LDFLAGS): New variable.
	(weak_alias_test_LDADD): New variable.
	(weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
	(weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
	(weak_alias_test_3.o): New target.
	(weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
	* testsuite/weak_alias_test_main.cc: New file.
	* testsuite/weak_alias_test_1.cc: New file.
	* testsuite/weak_alias_test_2.cc: New file.
	* testsuite/weak_alias_test_3.cc: New file.
2008-04-09 22:45:08 +00:00
Ian Lance Taylor 7fcd025698 * configure.ac: Export new conditional variable HAVE_ZLIB.
* testsuite/Makefile.am (flagstest_o_specialfile): Condition
	on HAVE_ZLIB.
	(flagstest_o_specialfile_and_compress_debug_sections): Likewise.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-04-08 14:33:35 +00:00
Ian Lance Taylor 6835af537e * configure.ac: Don't test for objdump, c++filt, or readelf.
* testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
	conditionals.
	(TEST_READELF): New variable.
	(TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
	(check_PROGRAMS): Add two_file_strip_test.
	(two_file_strip_test): New target.
	(check_PROGRAMS): Add two_file_same_shared_strip_test.
	(two_file_same_shared_strip_test_SOURCES): New variable.
	(two_file_same_shared_strip_test_DEPENDENCIES): New variable.
	(two_file_same_shared_strip_test_LDFLAGS): New variable.
	(two_file_same_shared_strip_test_LDADD): New variable.
	(two_file_shared_strip.so): New target.
	(ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
	(ver_test_5.syms, ver_test_7.syms): Likewise.
	(ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
	(strip_test_3.stdout): Use TEST_OBJDUMP.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-04-07 22:16:03 +00:00
Cary Coutant 86925eef33 2008-04-04 Cary Coutant <ccoutant@google.com>
* symtab.h (Symbol::is_weak_undefined): New function.
	(Symbol::is_strong_undefined): New function.
	(Symbol::is_absolute): New function.
	(Symbol::needs_plt_entry): Exclude weak undefined symbols.
	(Symbol::needs_dynamic_reloc): Exclude weak undefined and
	absolute symbols.
	* testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
	(weak_undef_test): New target.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/weak_undef_file1.cc: New file.
	* testsuite/weak_undef_file2.cc: New file.
	* testsuite/weak_undef_test.cc: New file.
2008-04-04 17:24:47 +00:00
Ian Lance Taylor 126f3ece27 * compressed_output.h (class Output_compressed_section): Use
unsigned buffer.
	* compressed_output.cc (zlib_compress): Use unsigned buffers,
	add zlib header.
	(zlib_compressed_suffix): Removed.
	(Output_compressed_section::set_final_data_size): Use unsigned
	buffers.
	* testsuite/Makefile.am (flagstest_compress_debug_sections):
	Fix linker invocation.
	(flagstest_o_specialfile_and_compress_debug_sections):
	Likewise.
	* testsuite/Makefile.in: Regenerated.
2008-04-03 14:18:37 +00:00
Ian Lance Taylor 686c8caf41 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
version symbol to be local.
	* testsuite/ver_test_4.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
	(check_DATA): Add ver_test_4.syms.
	(ver_test_4.syms): New target.
	* testsuite/Makefile.in: Rebuild.
2008-03-29 08:39:26 +00:00
Ian Lance Taylor 479f65031f * symtab.cc (Symbol_table::add_from_object): If we don't use the
new symbol when resolving, don't call set_is_default.
	* testsuite/ver_test_7.cc: New file.
	* testsuite/ver_test_7.sh: New file.
	* testsuite/Makefile.am (ver_test_7.so): New target.
	(ver_test_7.o): New target.
	(check_SCRIPTS): Add ver_test_7.sh.
	(check_DATA): Add ver_test_7.syms.
	(ver_test_7.syms): New target.
2008-03-29 07:19:02 +00:00
Ian Lance Taylor 2fd322316e * layout.cc (Layout::layout): If we see an input section with a
name that needs sorting, set the must_sort flag for the output
	section.
	(Layout::make_output_section): If the name of the output section
	indicates that it might	require sorting, set the may_sort flag.
	* output.h (Output_section::may_sort_attached_input_sections): New
	function.
	(Output_section::set_may_sort_attached_input_sections): New
	function.
	(Output_section::must_sort_attached_input_sections): New
	function.
	(Output_section::set_must_sort_attached_input_sections): New
	function.
	(class Output_section): Declare Input_section_sort_entry.  Define
	Input_section_sort_compare.  Declare
	sort_attached_input_sections.  Add new fields:
	may_sort_attached_input_sections_,
	must_sort_attached_input_sections_,
	attached_input_sections_are_sorted_.
	* output.cc (Output_section::Output_section): Initialize new
	fields.
	(Output_section::add_input_section): Add an entry to
	input_sections_ if may_sort or must_sort are true.
	(Output_section::set_final_data_size): Call
	sort_attached_input_sections if necessary.
	(Output_section::Input_section_sort_entry): Define new class.
	(Output_section::Input_section_sort_compare::operator()): New
	function.
	(Output_section::sort_attached_input_sections): New function.
	* configure.ac: Check whether the compiler supports constructor
	priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
	* testsuite/initpri1.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
	CONSTRUCTOR_PRIORITY.
	(initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
	(initpri1_LDFLAGS): New variable.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-03-28 22:42:34 +00:00
Ian Lance Taylor 49bdd526ab * common.cc (Sort_commons::operator): Correct sorting algorithm.
* testsuite/common_test_1.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
	(common_test_1_SOURCES): New variable.
	(common_test_1_DEPENDENCIES): New variable.
	(common_test_1_LDFLAGS): New variable.
2008-03-27 19:57:41 +00:00
Ian Lance Taylor 18e6b24e63 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
and commons_ correctly when NAME/VERSION does not override
	NAME/NULL.
	* testsuite/ver_test_6.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
	(ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
	(ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2008-03-27 18:19:09 +00:00
Ian Lance Taylor 5871526fc2 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
of an undefined symbol from a version script.
	* testsuite/Makefile.am (ver_test_5.so): New target.
	(ver_test_5.o): New target.
	(check_SCRIPTS): Add ver_test_5.sh.
	(check_DATA): Add ver_test_5.syms.
	(ver_test_5.syms): New target.
	* testsuite/ver_test_5.cc: New file.
	* testsuite/ver_test_5.script: New file.
	* testsuite/ver_test_5.sh: New file.
	* Makefile.in, testsuite/Makefile.in: Rebuild.
2008-03-27 06:11:57 +00:00
Ian Lance Taylor be3e620119 Don't get confused about whether a symbol is the default version if we
see a later reference to it.  Add tests for this case.
2008-03-14 05:57:19 +00:00
Ian Lance Taylor bc644c6cfc Add support for --format binary for input files. 2008-02-08 07:06:58 +00:00
Ian Lance Taylor 88dd47ac00 Implement --just-symbols, including -R FILE. Fix symbol values when
doing a relocatable link.
2008-02-07 01:51:25 +00:00
Ian Lance Taylor 6a74a71947 Initial -r support. 2008-02-06 08:13:50 +00:00
Ian Lance Taylor 1c4f3631bd Implement PHDRS. 2008-02-04 22:54:31 +00:00
Ian Lance Taylor 7cc77b5a09 Fully implement SECTIONS clause. 2008-02-04 05:46:12 +00:00
Ian Lance Taylor 03e8f2b225 From Cary Coutant: Fix a case in which code takes the address of a
function and also calls it directly.
2008-02-01 00:39:10 +00:00
Ian Lance Taylor 0700cf329e From Cary Coutant: Fix mixing PIC and non-PIC relocs in the same
shared library.
2008-01-23 07:15:59 +00:00
Ian Lance Taylor 494e05f440 Parse a SECTIONS clause in a linker script. 2008-01-23 01:31:13 +00:00
Ian Lance Taylor 091244672e From Andrew Chatham and Craig Silverstein: Add support for version
scripts.
2008-01-15 23:41:28 +00:00
Ian Lance Taylor e5756efb6d Support assignments and expressions in linker scripts. 2008-01-09 19:57:45 +00:00
Ian Lance Taylor 99f8facac9 From Cary Coutant: Fix handling of versioned symbols, add some tests. 2007-12-21 23:31:19 +00:00
Ian Lance Taylor 0e470e5c90 Add some missing dependencies for the new linker. 2007-12-14 05:27:45 +00:00
Ian Lance Taylor c03c769248 From Cary Coutant: Test TLS initial-exec model. 2007-12-11 23:33:11 +00:00
Ian Lance Taylor 351a80002a From Craig Silverstein: Reorganize testsuite Makefile.am. 2007-12-06 17:07:24 +00:00
Ian Lance Taylor 7bf1f8020f From Cary Coutant: More support for generating shared libraries. 2007-12-06 05:55:50 +00:00
Ian Lance Taylor 43771f7638 From Craig Silverstein: Test some flags. 2007-12-05 01:10:16 +00:00
Ian Lance Taylor be00d4e7ff More -fPIC options. 2007-12-01 06:53:32 +00:00
Ian Lance Taylor 763277c3c4 Add missing space. 2007-12-01 06:51:45 +00:00
Ian Lance Taylor c92003e082 Compile shared library code with -fPIC. Also, alphabetize. 2007-12-01 06:50:09 +00:00
Ian Lance Taylor 9a0910c33e From Craig Silverstein: Add support for compressing .debug_str section. 2007-11-30 00:35:27 +00:00
Ian Lance Taylor 79e052eafd From Craig Silverstein: Better handling of ODR violations which are
not in a function.
2007-11-28 18:01:06 +00:00
Ian Lance Taylor eb01e199fd If generating a .err file fails, remove it. 2007-11-14 18:37:00 +00:00
Ian Lance Taylor 9a2d698415 Add heuristics for undefined symbol warnings. 2007-11-14 16:53:25 +00:00
Ian Lance Taylor 3e6fe5ae73 Comment out undef_symbol.err for now. 2007-11-14 15:24:08 +00:00
Ian Lance Taylor 1ce71f59c7 Default to --allow-shlib-undefined for now. 2007-11-14 09:39:13 +00:00
Ian Lance Taylor e2827e5f52 Warn about undefined references in shared libraries if we have seen
all the DT_NEEDED entries for that library.
2007-11-14 07:34:53 +00:00
Ian Lance Taylor a55ce7febf From Craig Silverstein: Rework debug info code a bit, add option for
ODR violations, add test case.
2007-11-14 01:03:01 +00:00
Ian Lance Taylor 386c048c7a Correct handling of GOT references in a regular object. 2007-11-12 17:51:55 +00:00
Ian Lance Taylor d12348b848 From Craig Silverstein: Clean up make rules for debug_msg. 2007-11-09 23:35:19 +00:00
Ian Lance Taylor f0323c2f68 From Craig Silverstein: Add test for debug messages. 2007-11-09 23:19:11 +00:00
Ian Lance Taylor fa99aa0984 Use AC_GNU_SOURCE. 2007-10-24 18:11:23 +00:00
Ian Lance Taylor fe9a4c1201 Add infrastructure for threading support. 2007-10-17 06:24:50 +00:00
Ian Lance Taylor a360aedd0f From Craig Silverstein: check that we get environ right. 2007-10-16 23:09:45 +00:00
Ian Lance Taylor 097ec620e1 Only run static TLS tests on glibc 2.4 or later. 2007-10-14 03:57:22 +00:00