Commit Graph

339 Commits

Author SHA1 Message Date
Ian Lance Taylor 624f881062 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
addend parameter.  Change caller.  Handle merge sections.
	(Output_reloc<SHT_REL>::symbol_value): Change parameter type from
	Address to Addend.  Don't add in the result of
	local_section_offset, pass down the addend and use the returned
	value.
	* output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
	Update declarations of local_section_offset and symbol_value.
	* testsuite/two_file_test_1.cc (t18): New function.
	* testsuite/two_file_test_2.cc (f18): New function.
	* testsuite/two_file_test_main.cc (main): Call t18.
	* testsuite/two_file_test.h (t18, f18): Declare.
2008-04-07 22:46:17 +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 ab794b6bda * output.cc
(Output_section::Input_section_sort_entry::has_priority): New
	function.
	(Output_section::Input_section_sort_entry::match_file_name): New
	function.
	(Output_section::Input_section_sort_entry::match_section_name):
	Remove.
	(Output_section::Input_section_sort_entry::match_section_name_prefix):
	Remove.
	(Output_section::Input_section_sort_entry::match_section_file):
	Remove.
	(Output_section::Input_section_sort_compare::operator()): Rewrite
	using new Input_section_sort_entry functions.  Sort crtbegin and
	crtend first.  Sort sections with no priority before sections with
	a priority.
	* testsuite/initpri1.c (d3): Check j != 4.
	(cd5): New constructor/destructor function.
	(main): Check j != 2.
2008-03-29 08:09:55 +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 04bf70729d PR gold/5986
Fix problems building gold with gcc 4.3.0.
	* gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
	(gold_error_at_location, gold_warning_at_location): Use it.
	* configure.ac: Check whether we can compile and use a template
	function with a printf attribute.
	* x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
	when jumping over bytes.
	* object.cc: Instantiate Object::read_section_data.
	* debug.h: Include <cstring>
	* dwarf_reader.cc: Include <algorithm>
	* main.cc: Include <cstring>.
	* options.cc: Include <cstring>.
	* output.cc: Include <cstring>.
	* script.cc: Include <cstring>.
	* script.h: Include <string>.
	* symtab.cc: Include <cstring> and <algorithm>.
	* target-select.cc: Include <cstring>.
	* version.cc: Include <string>.
	* testsuite/testmain.cc: Include <cstdlib>.
	* configure, config.in: Rebuild.
2008-03-26 23:36:46 +00:00
Ian Lance Taylor e96caa7910 * options.cc (options::help): Print list of supported targets.
* target-select.h: Include <vector>.
	(class Target_selector): Make machine_, size_, and is_big_endian_
	fields const.  Add bfd_name_ and instantiated_target_ fields.
	(Target_selector::Target_selector): Add bfd_name parameter.
	(Target_selector::recognize): Make non-virtual, call
	do_recognize.
	(Target_selector::recognize_by_name): Make non-virtual, call
	do_recognize_by_name.
	(Target_selector::supported_names): New function.
	(Target_selector::bfd_name): New function.
	(Target_selector::do_instantiate_target): New pure virtual
	function.
	(Target_selector::do_recognize): New virtual function.
	(Target_selector::do_recognize_by_name): New virtual function.
	(Target_selector::instantiate_target): New private function.
	(supported_target_names): Declare.
	* target-select.cc (Target_selector::Target_selector): Update for
	new parameter and fields.
	(select_target_by_name): Check that the name matches before
	calling recognize_by_name.
	(supported_target_names): New function.
	* i386.cc (class Target_selector_i386): Update Target_selector
	constructor call.  Remove recognize and recognize_by_name.  Add
	do_instantiate_target.
	* x86_64.cc (class Target_selector_x86_64): Likewise.
	* testsuite/testfile.cc (class Target_selector_test): Update for
	changes to Target_selector.
2008-03-25 21:39:01 +00:00
Ian Lance Taylor 96a2b4e4bf Make sure the start and size of the TLS segment are aligned. 2008-03-19 21:41:38 +00:00
Ian Lance Taylor d1f003c610 Fix handling of RELA relative relocs against local symbols in merge
sections.
2008-03-16 23:51:19 +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 ebdbb4583d Update copyright years. Update language files. 2008-03-13 21:04:21 +00:00
Ian Lance Taylor 8851eccaec From Craig Silverstein: Have Parameters point to General_options. 2008-02-28 00:18:24 +00:00
Ian Lance Taylor a5dc070655 From Craig Silverstein: rework handling of Script_options. 2008-02-26 22:48:08 +00:00
Ian Lance Taylor 0daa6f62c8 Support selecting target by name. 2008-02-13 02:44:50 +00:00
Ian Lance Taylor 33a3a15316 Force different sections to different pages for better results on
x86_64 Linux.
2008-02-12 00:15:40 +00:00
Ian Lance Taylor 03df6b3280 Fix precedence error, avoid signed/unsignd warning. 2008-02-12 00:13:39 +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 a445fddf82 Fully implement the SECTIONS clause. 2008-02-04 05:43:05 +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 55a934330a Originally from Craig Silverstein, with changes: support using a
version script to force symbols to be local.
2008-01-24 00:15:00 +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 106002249a From Craig Silverstein: Handle quoted strings differently in version
scripts, and handle extern "C++" in the middle of a block.
2008-01-18 23:35:09 +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 06a9731e8a Correct contributor name on new tests, remove #if 0 code. 2007-12-22 00:50:43 +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 fe8718a463 Convert more instances of off_t to be 32-bit types. 2007-12-20 21:21:24 +00:00
Ian Lance Taylor 17a1d0a9b2 Rewrite workqueue. This version eliminates the master thread, and
reduces the amount of locking required to find a new thread to run.
2007-12-14 19:00:21 +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 dd8670e56c From Craig Silverstein: Quote the symbol name in the ODR violation
message to avoid a gcc collect2 demangling bug.
2007-11-17 02:49:22 +00:00
Ian Lance Taylor 78f156961e From Craig Silverstein: Report output file name with ODR violation
warning message.
2007-11-14 18:44:58 +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 730cdc88f7 Generate a complete exception frame header. Discard duplicate
exception frame information.
2007-11-09 07:00:15 +00:00
Ian Lance Taylor fa99aa0984 Use AC_GNU_SOURCE. 2007-10-24 18:11:23 +00:00
Ian Lance Taylor 35cdfc9a87 Add support for PT_GNU_STACK. 2007-10-23 05:05:48 +00:00
Ian Lance Taylor 28ef317915 Add wide string constant test. 2007-10-19 23:38:40 +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 0c5e9c22aa From Craig Silverstein: implement -Ttext. 2007-10-16 22:38:36 +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
Ian Lance Taylor 8261e3bfa5 From Craig Silverstein: TLS test cleanups. 2007-10-14 03:23:38 +00:00
Ian Lance Taylor e03748586c From Craig Silverstein: expand the TLS test to a second file, to test
IE to LE conversion.
2007-10-12 17:32:20 +00:00
Ian Lance Taylor e982104129 Make TLS test fail more reliably. 2007-10-08 07:24:21 +00:00
Ian Lance Taylor f958d5fc53 Test merging of string constants. 2007-10-07 17:20:18 +00:00
Ian Lance Taylor 6eee141ff6 Add a TLS test case. 2007-10-07 17:10:10 +00:00
Ian Lance Taylor ad2d6943a4 Full support for --sysroot. 2007-10-04 05:49:04 +00:00
Ian Lance Taylor 6340166c8b Parameterize object_unittest to work for whatever target types are
supported.
2007-10-03 00:34:49 +00:00
Ian Lance Taylor 63402fe413 From Craig Silverstein: don't run function pointer non-PIC tests when
they won't work.
2007-10-02 22:45:07 +00:00
Ian Lance Taylor 6df6da4a61 Clean up target handling--only build required files, warn about
unsupported targets.
2007-09-30 23:41:32 +00:00
Ian Lance Taylor 3151305a47 Add basic exception frame header, plus test. 2007-09-26 05:44:38 +00:00
Ian Lance Taylor 82dcae9de0 Rework File_read interface. Get file size. Use pread when
available.
2007-09-25 06:43:17 +00:00
Ian Lance Taylor 3bd52c2885 Add two file test. 2007-09-23 05:35:51 +00:00
Ian Lance Taylor cb615bc189 Add static version of constructor test. 2007-09-23 03:25:29 +00:00
Ian Lance Taylor d50266522c Add constructor test. 2007-09-23 03:18:42 +00:00
Ian Lance Taylor d98a37563c Correct comment. 2007-09-22 23:37:35 +00:00
Ian Lance Taylor 56ba9a23db Rename t1 to basic_test, add static tests. 2007-09-22 23:36:01 +00:00
Ian Lance Taylor 22dc1b094d Add standalone test case. 2007-09-22 22:44:33 +00:00
Ian Lance Taylor 6cb15b7f89 Add licensing text to every source file. 2007-09-22 21:02:10 +00:00
Ian Lance Taylor 537b5f51e5 Add bootstrap test. 2007-09-22 20:11:12 +00:00
Ian Lance Taylor be9d5a933e Update for have_code_fill field. 2007-09-21 06:25:35 +00:00
Ian Lance Taylor 5a6f7e2db5 Added a testsuite. More support for COPY relocations. 2006-11-30 23:52:50 +00:00