Commit Graph

105 Commits

Author SHA1 Message Date
Ralf Wildenhues 81ecdfbb4d Regenerate tree using Autoconf 2.64 and Automake 1.11.
config/:
	* override.m4 (_GCC_AUTOCONF_VERSION): Bump to 2.64.

/:
	* configure: Regenerate.

etc/:
	* configure: Regenerate.

sim/common/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/iq2000/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/d10v/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/igen/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m32r/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/frv/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/:
	* avr/config.in: Regenerate.
	* avr/configure: Likewise.
	* configure: Likewise.
	* cris/config.in: Likewise.
	* cris/configure: Likewise.

sim/h8300/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mn10300/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/ppc/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/erc32/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/arm/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m68hc11/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/lm32/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/sh64/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/v850/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/cr16/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/moxie/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m32c/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mips/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mcore/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/testsuite/d10v-elf/:
	* configure: Regenerate.

sim/testsuite/:
	* configure: Regenerate.

sim/testsuite/frv-elf/:
	* configure: Regenerate.

sim/testsuite/m32r-elf/:
	* configure: Regenerate.

sim/testsuite/mips64el-elf/:
	* configure: Regenerate.

sim/sh/:
	* config.in: Regenerate.
	* configure: Likewise.

gold/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

gprof/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* gconfig.in: Likewise.

opcodes/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

gas/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.

ld/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

gdb/:
	* aclocal.m4: Regenerate.
	* config.in: Likewise.
	* configure: Likewise.
	* gnulib/Makefile.in: Likewise.

gdb/doc/:
	* configure: Regenerate.

gdb/gdbserver/:
	* aclocal.m4: Regenerate.
	* config.in: Likewise.
	* configure: Likewise.

gdb/testsuite/:
	* configure: Regenerate.
	* gdb.hp/configure: Likewise.
	* gdb.hp/gdb.aCC/configure: Likewise.
	* gdb.hp/gdb.base-hp/configure: Likewise.
	* gdb.hp/gdb.compat/configure: Likewise.
	* gdb.hp/gdb.defects/configure: Likewise.
	* gdb.hp/gdb.objdbg/configure: Likewise.
	* gdb.stabs/configure: Likewise.

binutils/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.

bfd/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

bfd/doc/:
	* Makefile.in: Regenerate.

readline/:
	* configure: Regenerate.

readline/examples/rlfe/:
	* configure: Regenerate.
2009-08-22 16:56:56 +00:00
Ralf Wildenhues c462b41bcd Minor fixes in sim, gold, gdb for Autoconf 2.64, Automake 1.11.
gold/:
	* Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

gdb/:
	* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS instead of
	AC_GNU_SOURCE, AC_AIX, AC_ISC_POSIX.

sim/common/:
	* aclocal.m4 (SIM_CHECK_MEMBER): Replace definition with
	definition of AC_CHECK_MEMBER.
2009-08-22 15:59:24 +00:00
Sriraman Tallam 48c187ced8 Sriraman Tallam <tmsriram@google.com>
* icf.cc (Icf::find_identical_sections): Unfold symbols that have
	been maked as --keep-unique.
	(Icf::unfold_section): New function.
	* icf.h (Icf::unfold_section): New function.
	* options.h (General_options::keep_unique): New option.
	* testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/icf_keep_unique_test.sh: New file.
	* testsuite/icf_keep_unique_test.cc: New file.
2009-08-12 19:03:16 +00:00
Cary Coutant 645afe0c5b PR 10471
* resolve.cc (Symbol_table::resolve): Check for references from
	dynamic objects to hidden and internal symbols.
	* testsuite/Makefile.am (hidden_test.sh): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/hidden_test.sh: New script.
	* testsuite/hidden_test_1.c: New test source.
	* testsuite/hidden_test_main.c: New test source.
2009-08-12 18:30:39 +00:00
Sriraman Tallam 2772106215 *** empty log message *** 2009-08-07 18:29:54 +00:00
Sriraman Tallam ef15dade89 *** empty log message *** 2009-08-05 20:51:56 +00:00
Ian Lance Taylor 8a5e3e08a6 * layout.cc (Layout::make_output_section): Call
Target::new_output_section.
	(Layout::attach_allocated_section_to_segment): Put large section
	sections in a separate load segment with the large segment flag
	set.
	(Layout::segment_precedes): Sort large data segments after other
	load segments.
	(align_file_offset): New static function.
	(Layout::set_segment_offsets): Use align_file_offset.
	* output.h (class Output_section): Add is_small_section_ and
	is_large_section_ fields.
	(Output_section::is_small_section): New function.
	(Output_section::set_is_small_section):  New function.
	(Output_section::is_large_section): New function.
	(Output_section::set_is_large_section): New function.
	(Output_section::is_large_data_section): New function.
	(class Output_segment): Add is_large_data_segment_ field.
	(Output_segment::is_large_data_segment): New function.
	(Output_segment::set_is_large_data_segment): New function.
	* output.cc (Output_section::Output_section): Initialize new
	fields.
	(Output_segment::Output_segment): Likewise.
	(Output_segment::add_output_section): Add assertion that large
	data sections always go in large data segments.  Force small data
	sections to the end of the list of data sections.  Force small BSS
	sections to the start of the list of BSS sections.  For large BSS
	sections to the end of the list of BSS sections.
	* symtab.h (class Symbol): Declare is_common_shndx.
	(Symbol::is_defined): Check Symbol::is_common_shndx.
	(Symbol::is_common): Likewise.
	(class Symbol_table): Define enum Commons_section_type.  Update
	declarations.  Add small_commons_ and large_commons_ fields.
	* symtab.cc (Symbol::is_common_shndx): New function.
	(Symbol_table::Symbol_table): Initialize new fields.
	(Symbol_table::add_from_object): Put small and large common
	symbols in the right list.
	(Symbol_table::sized_finalized_symbol): Check
	Symbol::is_common_shndx.
	(Symbol_table::sized_write_globals): Likewise.
	* common.cc (Symbol_table::do_allocate_commons): Allocate new
	common symbol lists.  Don't call do_allocate_commons_list if the
	list is empty.
	(Symbol_table::do_allocate_commons_list): Remove is_tls
	parameter.  Add comons_section_type parameter.  Change all
	callers.  Handle small and large common symbols.
	* object.cc (Sized_relobj::do_finalize_local_symbols): Check
	Symbol::is_common_shndx.
	* resolve.cc (symbol_to_bits): Likewise.
	* target.h (Target::small_common_shndx): New function.
	(Target::small_common_section_flags): New function.
	(Target::large_common_shndx): New function.
	(Target::large_common_section_flags): New function.
	(Target::new_output_section): New function.
	(Target::Target_info): Add small_common_shndx, large_common_shndx,
	small_common_section_flags, and large_common_section_flags
	fields.
	(Target::do_new_output_section): New virtual function.
	* arm.cc (Target_arm::arm_info): Initialize new fields.
	* i386.cc (Target_i386::i386_info): Likewise.
	* powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
	Likewise.
	* sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	(Target_x86_64::do_new_output_section): New function.
	* configure.ac: Define conditional MCMODEL_MEDIUM.
	* testsuite/Makefile.am (check_PROGRAMS): Add large.
	(large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
	(large_LDFLAGS): Define.
	* testsuite/large.c: New file.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Initialize new fields.
	* configure, testsuite/Makefile.in: Rebuild.
2009-06-22 06:51:53 +00:00
Doug Kwan bb04269c74 2009-06-05 Doug Kwan <dougkwan@google.com>
* Makefile.am (CCFILES): Add target.cc.
	* Makefile.in: Regenerate.
	* i386.cc (class Target_i386): Define new virtual method to
	override do_is_local_label_name in parent.
	* object.cc (Sized_relobj::do_count_local_symbols): Discard
	local symbols if --discard-locals or -X is given.
	* options.h (class General_options): Declare new options
	'--discard-locals' and '-X' for discarding locals.
	* target.h (class Target): Define new methods is_local_label_name.
	Declare new virtual method do_is_local_label_name.
	* target.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
	(check_SCRIPTS): Add discard_locals_test.sh.
	(check_DATA): Add discard_local_tests.syms.
	(discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
	(discard_local_tests.syms, discard_locals_test.o): New make rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/discard_locals_test.c: New file.
	* testsuite/discard_locals_test.sh: Same.
2009-06-05 21:32:57 +00:00
Doug Kwan 805bb01c4b 2009-06-05 Doug Kwan <dougkwan@google.com>
* object.cc (Sized_relobj::Sized_relobj): Initialize
	discarded_eh_frame_shndx_ to -1U.
	(Sized_relobj::do_layout): Record index of a discard .eh_frame
	section.
	(Sized_relobj::do_count_local_symbols): Skip local symbols in
	a discarded .eh_frame section.
	(Sized_relobj::do_finalize_local_symbols): Ditto.
	* object.h (class Sized_relobj): Declare new member
	discarded_eh_frame_shndx_.
	* testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
	(local_labels_test.o, local_labels_test): New rules.
	* testsuite/Makefile.in: Regenerate.
2009-06-05 18:16:31 +00:00
Doug Kwan 2fdd743f6d 2009-05-26 Doug Kwan <dougkwan@google.com>
* options.cc (General_options::parse_exclude_libs).  Fix a comment.
        (General_options::check_excluded_libs): Strip off directories in
        archive name before matching like GNU ld does.
        * testsuite/Makefile.am (MOSTLYCLEANFILES,
        exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
        (exclude_libs_test_LDFLAGS): Add linker option
        -Wl,--exclude-libs,libexclude_libs_test_3
        (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
        an explicit archive without using -l.
        (alt/libexclude_libs_test_3.a): New make rule.
        * testsuite/Makefile.in: Regenerate.
        * testsuite/exclude_libs_test.c : Declare lib3_default().
        (main): Call it.
        * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
        * exclude_libs_test_3.c: New file.
2009-05-26 22:52:56 +00:00
Sriraman Tallam 4daadc0d02 * testsuite/Makefile.am: Add -ffunction-sections to compile
gc_comdat_test files.  Add -Wl,--gc-sections to build
	gc_comdat_test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_comdat_test.sh: Fix the condition around grep.
2009-05-22 20:27:52 +00:00
Sriraman Tallam 531813adfc * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
kept comdat section was garbage collected.
	* testsuite/Makefile.am: Add test gc_comdat_test.sh.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_comdat_test.sh: New file.
	* testsuite/gc_comdat_test_1.cc: New file.
	* testsuite/gc_comdat_test_2.cc: New file.
2009-05-22 18:31:22 +00:00
Cary Coutant 6551490093 2009-05-19 Doug Kwan <dougkwan@google.com>
* archive.cc (Archive::Archive): Move constructor from archive.h
	to here.  Initialize no_export_.
	(Archive::get_elf_object_for_member): Set no_export flag of object.
	* archive.h (Archive::Archive): Move constructor body to
	archive.cc.
	(Archive::no_export): New method.
	(Archive::no_export_): New field.
	* object.h (Object::Object): Initialize no_export_ to false.
	(Object::no_export, Object::set_no_export): New methods.
	(Object::no_export_): New field.
	* options.cc (General_options::parse_exclude_libs): New method.
	(General_options::check_excluded_libs) Same.
	* options.h (exclude_libs): New option.
	(General_options::check_excluded_libs): New method declaration.
	(General_options::excluded_libs_): New field.
	* symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
	default or protected visibility if an object has no-export flag set.
	testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
	(check_SCRIPTS): Add exclude_libs_test.sh.
	(check_DATA): Add exclude_libs_test.syms.
	(MOSTLYCLEANFILES): Add exclude_libs_test.syms,
	libexclude_libs_test_1.a and libexclude_libs_test_2.a.
	(exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
	exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
	(exclude_libs_test.syms, libexclude_libs_test_1.a,
	libexclude_libs_test_2.a): New rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/exclude_libs_test.c: New file.
	* testsuite/exclude_libs_test.sh: Ditto.
	* testsuite/exclude_libs_test_1.c: Ditto.
	* testsuite/exclude_libs_test_2.c: Ditto.
2009-05-19 22:14:17 +00:00
Ian Lance Taylor 9c5b8369ab * archive.cc (Archive::add_symbols): Check for a version attached
to the symbol name in the archive map.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
	(ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
	(ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
	(ver_test_11.a): New target.
	* testsuite/Makefile.in: Rebuild.
2009-03-18 05:09:52 +00:00
Ian Lance Taylor 031cdbed18 PR 9918
* target-reloc.h (relocate_section): Pass output_section to
	relocate.
	* i386.cc (Target_i386::should_apply_static_reloc): Add
	output_section parameter.  Change all callers.
	(Target_i386::Relocate::relocate): Add output_section parameter.
	* x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
	* sparc.cc (Target_sparc::Relocate::relocate): Likewise.
	* powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
	* testsuite/two_file_shared.sh: New script.
	* testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
	(check_DATA): Add two_file_shared.dbg.
	(two_file_shared.dbg): New target.
	* testsuite/Makefile.in: Rebuild.
2009-03-04 06:46:27 +00:00
Ian Lance Taylor 0602e05a84 PR 9836
* symtab.cc (Symbol_table::add_from_object): If the visibility is
	hidden or internal, force the symbol to be local.
	* resolve.cc (Symbol::override_visibility): Define.
	(Symbol::override_base): Use override_visibility.
	(Symbol_table::resolve): Likewise.
	(Symbol::override_base_with_special): Likewise.
	(Symbol_table::override_with_special): If the visibility is hidden
	or internal, force the symbol to be local.
	* symtab.h (class Symbol): Add set_visibility and
	override_visibility.
	* testsuite/ver_test_1.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
	(check_DATA): Add ver_test_1.syms.
	(ver_test_1.syms): New target.
	* testsuite/Makefile.in: Rebuild.
2009-02-27 19:57:46 +00:00
Cary Coutant 401a9a7392 * layout.cc (Layout::choose_output_section): Don't rename sections
when using a linker script that has a SECTIONS clause.
	* Makefile.in: Regenerate.

	* testsuite/Makefile.am (script_test_5.sh): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/script_test_5.cc: New file.
	* testsuite/script_test_5.sh: New file.
	* testsuite/script_test_5.t: New file.
2009-02-25 19:05:21 +00:00
Cary Coutant 0f7c0701ba * archive.cc (Archive::get_elf_object_for_member): Remove call
to File_read::claim_for_plugin.
	* descriptors.cc (Descriptors::open): Remove reference to
	is_claimed.
	(Descriptors::claim_for_plugin): Remove.
	* descriptors.h (Descriptors::claim_for_plugin): Remove.
	(Descriptors::is_claimed): Remove.
	(claim_descriptor_for_plugin): Remove.
	* fileread.cc (File_read::claim_for_plugin): Remove.
	* fileread.h (File_read::claim_for_plugin): Remove.
	(File_read::descriptor): Reopen descriptor if necessary.
	* plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
	(Plugin_manager::all_symbols_read): Add task parameter. Change
	all callers.
	(Plugin_manager::get_input_file): New function.
	(Plugin_manager::release_input_file): New function.
	(Pluginobj::Pluginobj): Add filesize parameter and initialize
	corresponding data member.
	(Sized_pluginobj::Sized_pluginobj): Add filesize parameter
	and pass to base constructor. Change all callers.
	(get_input_file, release_input_file): New functions.
	(make_sized_plugin_object): Add filesize parameter. Change all callers.
	* plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
	(Plugin_manager::all_symbols_read): Add task parameter.
	(Plugin_manager::get_input_file): New function.
	(Plugin_manager::release_input_file): New function.
	(Plugin_manager::task_): New data member.
	(Pluginobj::Pluginobj): Add filesize parameter.
	(Pluginobj::filename): New function.
	(Pluginobj::descriptor): New function.
	(Pluginobj::filesize): New function.
	(Pluginobj::filesize_): New data member.
	(Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
	* readsyms.cc (Read_symbols::do_read_symbols): Remove call to
	File_read::claim_for_plugin; use Object::unlock to unlock the file.

	* testsuite/Makefile.am (plugin_test_4): New test case for plugins
	with archive libraries.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (struct sym_info): New type.
	(get_input_file, release_input_file): New static variables.
	(onload): Capture new transfer vector entries.
	(claim_file_hook): Stop reading at end of file according to filesize.
	Factor out parsing of readelf output into separate function.
	(all_symbols_read_hook): Exercise get_input_file and release_input_file
	APIs and get the source file name from the symbol table.  Convert
	source file name to corresponding object file name.  Print info
	message when adding new input files.
	(parse_readelf_line): New function.
	* testsuite/plugin_test_1.sh: Add checks for new info messages.
	* testsuite/plugin_test_2.sh: Likewise.
	* testsuite/plugin_test_3.sh: Likewise.
	* testsuite/plugin_test_4.sh: New test case.
2009-01-15 01:29:25 +00:00
Cary Coutant d66a9eb3f0 * plugin.cc (is_visible_from_outside): New function.
(Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
	so we don't return "IR only" status for exported symbols or -r links.

	* testsuite/Makefile.am (plugin_test_3): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test_3.sh: New file.
2008-12-23 23:46:55 +00:00
Cary Coutant abc8dcbad2 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
vector.
	(Plugin_manager::claim_file): Create plugin object even if
	plugin did not call the add_symbols callback.
	(Plugin_obj::get_symbol_resolution_info): Guard against plugin
	asking for more symbols than were added.
	* testsuite/Makefile.am (plugin_test_1): Add test case with
	no global symbols.
	(empty.syms): New target.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (claim_file_hook): Add new debug
	message. Don't call add_symbols if no globals.
	(all_symbols_read_hook): Don't provide replacement for empty
	claimed file.
2008-12-16 19:19:16 +00:00
Cary Coutant 4674ecfcf4 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
* options.cc (General_options::parse_plugin_opt): New.
	(General_options::add_plugin): The argument now is just the filename.
	(General_options::add_plugin_option): New.
	* options.h (plugin_opt): New.
	(add_plugin): Change argument name.
	(add_plugin_option): New.
	* plugin.cc (Plugin::load): Don't parse the plugin option.
	* plugin.h (Plugin::Plugin): Rename argument. Init filename_.
	(Plugin::add_option): New.
	(Plugin::args_): Change type.
	(Plugin::filename_): New.
	(Plugin_manager::add_plugin_option): New.
	* testsuite/Makefile.am (plugin_test_1): Use new syntax.
	* testsuite/Makefile.in: Regenerate.
2008-12-05 21:34:54 +00:00
Craig Silverstein c82fbeee59 * options.cc (General_options::parse_dynamic_list): New function.
* options.h (General_options): New flags dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
	(General_options::in_dynamic_list): New function.
	* script.cc (Lex::Mode): New enum DYNAMIC_LIST.
	(Lex::can_start_name): Add support for DYNAMIC_LIST mode.
	(Lex::can_continue_name): Likewise.
	(yylex): Likewise.
	(read_script_file): New parameter script_options.
	(read_dynamic_list): New function.
	(Script_options::define_dynamic_list): New function.
	(dynamic_list_keyword_parsecodes): New variable.
	(dynamic_list_keywords): New variable.
	* script.h (Script_options::define_dynamic_list): New function
	prototype.
	(read_dynamic_list): New function prototype.
	* symtab.cc (strprefix): New macro.
	(Symbol::should_add_dynsym_entry): Support dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.
	* yyscript.y (PARSING_DYNAMIC_LIST): New token.
	(dynamic_list_expr): New rule.
	(dynamic_list_nodes): Likewise.
	(dynamic_list_node): Likewise.
	* testsuite/Makefile.am (dynamic_list): New test.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/dynamic_list.t: New file.
	* testsuite/dynamic_list.sh: New file.
2008-11-06 07:23:31 +00:00
Cary Coutant fbd8a2572e * archive.cc (Archive::get_file_and_offset): Use filename instead
of name to get library path.
	(Archive::include_member): Unlock external member of a thin archive.

	* testsuite/Makefile.am (TEST_AR): New variable.
	(thin_archive_test_1): New test.
	(thin_archive_test_2): New test.
2008-09-29 21:23:02 +00:00
Cary Coutant 89fc34211b Add plugin functionality for link-time optimization (LTO).
include/:
	* plugin-api.h: New file.

gold/:
	* configure.ac (plugins): Add --enable-plugins option.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.am (LIBDL): New variable.
	(CCFILES): Add plugin.cc.
	(HFILES): Add plugin.h.
	(ldadd_var): Add LIBDL.
	* Makefile.in: Regenerate.

	* archive.cc: Include "plugin.h".
	(Archive::setup): Don't preread archive symbols when using a plugin.
	(Archive::get_file_and_offset): Add memsize parameter.  Change callers.
	(Archive::get_elf_object_for_member): Call plugin hooks for claiming
	files.
	(Archive::include_member): Add symbols from plugin objects.
	* archive.h (Archive::get_file_and_offset): Add memsize parameter.
	* descriptors.cc (Descriptors::open): Check for file descriptors
	abandoned by plugins.
	(Descriptors::claim_for_plugin): New function.
	* descriptors.h (Descriptors::claim_for_plugin): New function.
	(Open_descriptor::is_claimed): New field.
	(claim_descriptor_for_plugin): New function.
	* fileread.cc (File_read::claim_for_plugin): New function.
	* fileread.h (File_read::claim_for_plugin): New function.
	(File_read::descriptor): New function.
	* gold.cc: Include "plugin.h".
	(queue_initial_tasks): Add task to call plugin hooks for generating
	new object files.
	* main.cc: Include "plugin.h".
	(main): Load plugin libraries.
	* object.h (Pluginobj): Declare.
	(Object::pluginobj): New function.
	(Object::do_pluginobj): New function.
	(Object::set_target): New function.
	* options.cc: Include "plugin.h".
	(General_options::parse_plugin): New function.
	(General_options::General_options): Initialize plugins_ field.
	(General_options::add_plugin): New function.
	* options.h (Plugin_manager): Declare.
	(General_options): Add --plugin option.
	(General_options::has_plugins): New function.
	(General_options::plugins): New function.
	(General_options::add_plugin): New function.
	(General_options::plugins_): New field.
	* plugin.cc: New file.
	* plugin.h: New file.
	* readsyms.cc: Include "plugin.h".
	(Read_symbols::do_read_symbols): Check for archive before checking
	for ELF file.  Call plugin hooks to claim files.
	* resolve.cc (Symbol_table::resolve): Record when symbol is referenced
	from a real object file; force override when processing replacement
	files.
	* symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
	(Symbol::init_base_object): Likewise.
	(Symbol::init_base_output_data): Likewise.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): Likewise.
	(Symbol::output_section): Assert that object is not a plugin.
	(Symbol_table::add_from_pluginobj): New function.
	(Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
	undefined.
	(Symbol_table::sized_write_globals): Likewise.
	(Symbol_table::add_from_pluginobj): Instantiate template.
	* symtab.h (Sized_pluginobj): Declare.
	(Symbol::in_real_elf): New function.
	(Symbol::set_in_real_elf): New function.
	(Symbol::in_real_elf_): New field.
	(Symbol_table::add_from_pluginobj): New function.

	* testsuite/Makefile.am (AM_CFLAGS): New variable.
	(LIBDL): New variable.
	(LDADD): Add LIBDL.
	(check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
	(check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
	(check_DATA): Add plugin_test_1.err and plugin_test_2.err.
	(MOSTLYCLEANFILES): Likewise.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c: New file.
	* testsuite/plugin_test_1.sh: New file.
	* testsuite/plugin_test_2.sh: New file.
2008-09-19 22:54:57 +00:00
Ian Lance Taylor 9c2d0ef98a * target-reloc.h (relocate_section): Check whether a symbol is
defined by the ABI before reporting an undefined symbol error.
	* target.h (Target::is_defined_by_abi): Make parameter const.
	(Target::do_is_defined_by_abi): Likewise.
	* i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
	* powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
	* sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
	* x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
	* testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
	* testsuite/Makefile.in: Rebuild.
2008-09-16 17:23:37 +00:00
Ian Lance Taylor 2d924fd9eb * layout.cc (Layout::attach_allocated_section_to_segment): Don't
set tls_segment_ or relro_segment_.
	(Layout::make_output_segment): Set tls_segment_ and relro_segment_
	when appropriate.
	* output.h (Output_section::clear_is_relro): New function.
	* output.cc (Output_segment::add_output_section): Handle SHF_TLS
	sections specially even when output_data_ is empty.
	(Output_segment::maximum_alignment): When first section is relro,
	only force alignment for PT_LOAD segments.
	* script.cc (script_data_segment_align): New function.
	(script_data_segment_relro_end): New function.
	* script-c.h (script_data_segment_align): Declare.
	(script_data_segment_relro_end): Declare.
	* script-sections.h (class Script_sections): Declare
	data_segment_align and data_segment_relro_end.  Add fields
	segment_align_index_ and saw_relro_end_.
	* script-sections.cc (class Sections_element): Add set_is_relro
	virtual function.  Add new bool* parameter to place_orphan_here.
	Add get_output_section virtual function.
	(class Output_section_definition): Add set_is_relro.  Add new
	bool* parameter to place_orphan_here.  Add get_output_section.
	Add is_relro_ field.
	(Output_section_definition::Output_section_definition): Initialize
	evaluated_address_, evaluated_load_address, evaluated_addralign_,
	and is_relro_ fields.
	(Output_section_definition::place_orphan_here): Add is_relro
	parameter.
	(Output_section_definition::set_section_addresses): Set relro for
	output section.
	(Output_section_definition::alternate_constraint): Likewise.
	(class Orphan_output_section): Add new bool* parameter to
	place_orphan_here.  Add get_output_section.
	(Orphan_output_section::place_orphan_here): Add is_relro
	parameter.
	(Script_sections::Script_sections): Initialize
	data_segment_align_index_ and saw_relro_end_.
	(Script_sections::data_segment_align): New function.
	(Script_sections::data_segment_relro_end): New function.
	(Script_sections::place_orphan): Set or clear is_relro.
	(Script_sections::set_section_addresses): Force alignment of first
	TLS section.
	* yyscript.y (exp): Call script_data_segment_align and
	script_data_segment_relro_end.
	* testsuite/relro_script_test.t: New file.
	* testsuite/relro_test.cc (using_script): Declare.
	(t1, t2): Test using_script.
	* testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
	(relro_script_test_SOURCES): Define.
	(relro_script_test_DEPENDENCIES): Define.
	(relro_script_test_LDFLAGS): Define.
	(relro_script_test_LDADD): Define.
	(relro_script_test.so): New target.
	* testsuite/Makefile.in: Rebuild.
2008-08-13 07:37:46 +00:00
Ian Lance Taylor de4c45bd54 * symtab.h (Symbol::use_plt_offset): New function.
* i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
	* powerpc.cc (Relocate::relocate): Likewise.
	* sparc.cc (Relocate::relocate): Likewise.
	* x86_64.cc (Relocate::relocate): Likewise.
	* testsuite/weak_plt.sh: New test.
	* testsuite/weak_plt_main.cc: New test.
	* testsuite/weak_plt_shared.cc: New test.
	* testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
	(check_PROGRAMS): Add weak_plt.
	(check_DATA): Add weak_plt_shared.so.
	(weak_plt_main_pic.o, weak_plt): New targets.
	(weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
	* testsuite/Makefile.in: Rebuild.

	* testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
	gcctestdir/ld.
	(weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
	* testsuite/Makefile.in: Rebuild.
2008-08-04 22:22:13 +00:00
Ian Lance Taylor 057ead2231 PR 6647
* script.cc (Version_script_info::get_versions): Don't add empty
	version tag to return value.
	(Version_script_info::get_symbol_version_helper): Change return
	type to bool.  Add pversion parameter.  Change all callers.
	(script_register_vers_node): Don't require a non-NULL tag.
	* script.h (class Version_script_info): Update declarations.
	(Version_script_info::get_symbol_version): Change return type to
	bool.  Add version parameter.  Change all callers.
	* symtab.cc (Sized_symbol::add_from_relobj): Rework version
	handling.  Handle an empty version from a version script.
	(Symbol_table::define_special_symbol): Likewise.
	* testsuite/ver_test_10.script: New file.
	* testsuite/ver_test_10.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
	(check_DATA): Add ver_test_10.syms.
	(ver_test_10.syms, ver_test_10.so): New target.
	* testsuite/Makefile.in: Rebuild.
2008-07-23 23:44:02 +00:00
Ian Lance Taylor 95d14cd31e * symtab.cc (Symbol_table::resolve): Remove version parameter.
Change all callers.
	* symtab.h (class Symbol_table): Update declaration.
	* testsuite/ver_test_9.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
	(ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
	(ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
	(ver_test_9.so, ver_test_9.o): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-07-23 14:36:09 +00:00
Chris Demetriou 1d1f116d7e 2008-07-20 Chris Demetriou <cgd@google.com>
* configure.ac (gold_cv_c_random_seed): New configured variable.
        (RANDOM_SEED_CFLAGS): New substituted variable.
        * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
        * configure: Rebuild.
        * Makefile.in: Likewise.
        * testsuite/Makefile.in: Likewise.
2008-07-21 05:55:27 +00:00
Ian Lance Taylor f34787f832 * output.h (Output_section::Input_section): Initialize p2align_ to
zero for Output_section_data constructors.
	(Output_section::Input_section::addralign): If not an input
	section, return the alignment of the Output_section_data.
	* testsuite/copy_test.cc: New file.
	* testsuite/copy_test_1.cc: New file.
	* testsuite/copy_test_2.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
	(copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
	(copy_test_LDFLAGS, copy_test_LDADD): New variables.
	(copy_test_1_pic.o, copy_test_1.so): New targets.
	(copy_test_2_pic.o, copy_test_2.so): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-06-18 04:39:41 +00:00
Ian Lance Taylor 9f1d377b33 * options.h (class General_options): Add -z relro.
* layout.cc (Layout::Layout): Initialize relro_segment_.
	(Layout::add_output_section_data): Return the output section.
	(Layout::make_output_section): Rcognize relro sections and mark
	them appropriately.
	(Layout::attach_allocated_section_to_segment): Put relro sections
	in a PT_GNU_RELRO segment.
	(Layout::create_initial_dynamic_sections): Mark the .dynamic
	section as relro.
	(Layout::segment_precedes): Sort PT_GNU_RELRO segments after
	PT_TLS segments.
	(Layout::linkonce_mapping): Map d.rel.ro.local to
	.data.rel.ro.local.
	(Layout::output_section_name): Us .data.rel.ro.local for any
	section which begins with that.
	* layout.h (class Layout): Update add_output_section_data
	declaration.  Add relro_segment_ field.
	* output.cc (Output_section::Output_section): Initialize is_relro_
	and is_relro_local_ fields.
	(Output_segment::add_output_section): Group relro sections.
	(Output_segment::is_first_section_relro): New function.
	(Output_segment::maximum_alignment): If there is a relro section,
	align the segment to the common page size.
	(Output_segment::set_section_addresses): Track whether we are
	looking at relro sections.  If the last section is a relro
	section, align to the common page size.
	(Output_segment::set_section_list_addresses): Add in_relro
	parameter.  Change all callers.  Align to the page size when
	moving from relro to non-relro section.
	(Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
	segment.
	* output.h (class Output_section): Add is_relro_ and
	is_relro_local_ fields.
	(Output_section::is_relro): New function.
	(Output_section::set_is_relro): New function.
	(Output_section::is_relro_local): New function.
	(Output_section::set_is_relro_local): New function.
	(class Output_segment): Update declarations.
	* i386.cc (Target_i386::got_section): Mark .got section as relro.
	* sparc.cc (Target_sparc::got_section): Likewise.
	* x86_64.cc (Target_x86_64::got_section): Likewise.
	* testsuite/relro_test_main.cc: New file.
	* testsuite/relro_test.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
	(relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
	(relro_test_LDFLAGS, relro_test_LDADD): New variables.
	(relro_test.so, relro_test_pic.o): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-05-20 04:00:47 +00:00
Ian Lance Taylor 75517b77b5 * symtab.c (Symbol::init_base_output_data): Add version
parameter.  Change all callers.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): Likewise.
	(Sized_symbol::init_output_data): Likewise.
	(Sized_symbol::init_output_segment): Likewise.
	(Sized_symbol::init_constant): Likewise.
	(Sized_symbol::init_undefined): Likewise.
	(Symbol_table::do_define_in_output_data): If the new symbol has a
	version, mark it as the default.
	(Symbol_table::do_define_in_output_segment): Likewise.
	(Symbol_table::do_define_as_constant): Likewise.
	* symtab.h (class Symbol): Update declarations.
	(class Sized_symbol): Likewise.
	* resolve.cc (Symbol::override_version): New function.
	(Symbol::override_base: Call override_version.
	(Symbol::override_base_with_special): Likewise.
	* testsuite/ver_script_8.script: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
	(ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
	(ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
	(ver_test_8_1.so, ver_test_8_2.so): New targets.
2008-05-08 18:44:33 +00:00
Ian Lance Taylor 8bdcdf2c77 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
symbol, change it to have default visibility.
	* testsuite/protected_1.cc: New file.
	* testsuite/protected_2.cc: New file.
	* testsuite/protected_3.cc: New file.
	* testsuite/protected_main_1.cc: New file.
	* testsuite/protected_main_2.cc: New file.
	* testsuite/protected_main_3.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
	(protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
	(protected_1_LDFLAGS, protected_1_LDADD): Define.
	(protected_1.so): New target.
	(protected_1_pic.o, protected_2_pic.o): New targets.
	(protected_3_pic.o): New target.
	(check_PROGRAMS): Add protected_2.
	(protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
	(protected_2_LDFLAGS, protected_2_LDADD): Define.
	* testsuite/Makefile.in: Rebuild.
2008-05-06 22:24:26 +00:00
Ian Lance Taylor 7bc3e21a1e * testsuite/Makefile.am (many_sections_r_test): New target.
(many_sections_r_test_SOURCES): Remove.
	(many_sections_r_test_DEPENDENCIES): Remove.
	(many_sections_r_test_LDFLAGS): Remove.
	(many_sections_r_test_LDADD): Remove.
2008-04-19 19:43:13 +00:00
Ian Lance Taylor 4c94d6ae7b * testsuite/Makefile.am (many_sections_check.h): Only check one in
every thousand variables.
	* testsuite/Makefile.in: Rebuild.
2008-04-19 19:15:36 +00:00
Ian Lance Taylor d491d34e93 * object.cc (Xindex::initialize_symtab_xindex): New function.
(Xindex::read_symtab_xindex): New function.
	(Xindex::sym_xindex_to_shndx): New function.
	(Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
	available.
	(Sized_relobj::do_initialize_xindex): New function.
	(Sized_relobj::do_read_symbols): Adjust section links.
	(Sized_relobj::symbol_section_and_value): Add is_ordinary
	parameter.  Change all callers.
	(Sized_relobj::include_section_group): Adjust section links and
	symbol section indexes.
	(Sized_relobj::do_layout): Adjust section links.
	(Sized_relobj::do_count_local_symbols): Adjust section links and
	symbol section indexes.
	(Sized_relobj::do_finalize_local_symbols): Distinguish between
	ordinary and special symbols.
	(Sized_relobj::write_local_symbols): Add symtab_xindex and
	dynsym_xindex parameters.  Change all callers.  Adjust section
	links.  Use SHN_XINDEX when needed.
	(Sized_relobj::get_symbol_location_info): Adjust section links.
	Don't get fooled by special symbols.
	* object.h (class Xindex): Define.
	(class Object): Add xindex_ parameter.  Declare virtual functoin
	do_initialize_xindex.
	(Object::adjust_sym_shndx): New function.
	(Object::set_xindex): New protected function.
	(class Symbol_value): Add is_ordinary_shndx_ field.
	(Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
	(Symbol_value::value): Assert ordinary section.
	(Symbol_value::initialize_input_to_output_map): Likewise.
	(Symbol_value::set_input_shndx): Add is_ordinary parameter.
	Change all callers.
	(Symbol_value::input_shndx): Add is_ordinary parameter.  Change
	all callers.
	(class Sized_relobj): Update declarations.
	(Sized_relobj::local_symbol_input_shndx): Add is_ordinary
	parameter.  Change all callers.
	(Sized_relobj::adjust_shndx): New function.
	* dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
	field.
	(Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
	parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
	for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
	(Sized_dynobj::read_dynsym_section): Adjust section links.
	(Sized_dynobj::read_dynamic): Likewise.
	(Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
	section links.
	(Sized_dynobj::do_initialize_xindex): New function.
	* dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
	do_initialize_xindex.
	(Sized_dynobj::adjust_shndx): New function.
	* layout.cc (Layout::Layout): Initialize symtab_xindex_ and
	dynsym_xindex_ fields.
	(Layout::finalize): Add a call to set_section_indexes before
	creating the symtab sections.
	(Layout::set_section_indexes): Don't do anything if the section
	already has a section index.
	(Layout::create_symtab_sections): Add shnum parameter.  Change
	caller.  Create .symtab_shndx section if needed.
	(Layout::create_shdrs): Add shstrtab_section parameter.  Change
	caller.
	(Layout::allocated_output_section_count): New function.
	(Layout::create_dynamic_symtab): Create .dynsym_shndx section if
	needed.
	* layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
	fields.  Update declarations.
	(Layout::symtab_xindex): New function.
	(Layout::dynsym_xindex): New function.
	(class Write_symbols_task): Add layout_ field.
	(Write_symbols_task::Write_symbols_task): Add layout parameter.
	Change caller.
	* output.cc (Output_section_headers::Output_section_headers): Add
	shstrtab_section parameter.  Change all callers.
	(Output_section_headers::do_sized_write): Store overflow values
	for section count and section string table section index in
	section header zero.
	(Output_file_header::do_sized_write): Check for overflow of
	section count and section string table section index.
	(Output_symtab_xindex::do_write): New function.
	(Output_symtab_xindex::endian_do_write): New function.
	* output.h (class Output_section_headers): Add shstrtab_section_.
	Update declarations.
	(class Output_symtab_xindex): Define.
	(Output_section::has_out_shndx): New function.
	* symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
	field.
	(Symbol::init_base): Add st_shndx and is_ordinary parameters.
	Change all callers.
	(Sized_symbol::init): Likewise.
	(Symbol::output_section): Check for ordinary symbol.
	(Symbol_table::add_from_object): Remove orig_sym parameter.  Add
	st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
	callers.
	(Symbol_table::add_from_relobj): Add symndx_offset parameter.
	Change all callers.  Simplify handling of symbols from sections
	not included in the link.
	(Symbol_table::add_from_dynobj): Handle ordinary symbol
	distinction.
	(Weak_alias_sorter::operator()): Assert that symbols are
	ordinary.
	(Symbol_table::sized_finalize_symbol): Handle ordinary symbol
	distinction.
	(Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
	parameters.  Change all callers.
	(Symbol_table::sized_write_globals): Likewise.  Handle ordinary
	symbol distinction.  Use SHN_XINDEX when needed.
	(Symbol_table::write_section_symbol): Add symtab_xindex
	parameter.  Change all callers.
	(Symbol_table::sized_write_section_symbol): Likewise.  Use
	SHN_XINDEX when needed.
	* symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
	declarations.
	(Symbol::shndx): Add is_ordinary parameter.  Change all callers.
	(Symbol::is_defined): Check is_ordinary.
	(Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
	(Symbol::is_absolute, Symbol::is_common): Likewise.
	(class Sized_symbol): Update declarations.
	(class Symbol_table): Update declarations.
	* resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
	parameters.  Change all callers.
	(Sized_symbol::override): Likewise.
	(Symbol_table::override): Likewise.
	(symbol_to_bits): Add is_ordinary parameter.  Change all callers.
	(Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
	is_ordinary, and orig_st_shndx parameters.  Change all callers.
	* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
	to be in an ordinary section.
	* dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
	object and is_ordinary parameters.  Change all callers.
	(Sized_dwarf_line_info::read_relocs): Add object parameter.
	Change all callers.  Don't add undefined or non-ordinary symbols
	to reloc_map_.
	(Sized_dwarf_line_info::read_line_mappings): Add object parameter.
	Change all callers.
	* dwarf_reader.h (class Sized_dwarf_line_info): Update
	declarations.
	* ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
	* reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
	(Sized_relobj::relocate_sections): Likewise.
	* target-reloc.h (scan_relocs): Adjust section symbol index.
	(scan_relocatable_relocs): Likewise.
	* i386.cc (Scan::local): Check for ordinary symbols.
	* sparc.cc (Scan::local): Likewise.
	* x86_64.cc (Scan::local): Likewise.
	* testsuite/binary_unittest.cc (Sized_binary_test): Update calls
	to symbol_section_and_value.
	* testsuite/many_sections_test.cc: New file.
	* testsuite/Makefile.am (BUILT_SOURCES): Define.
	(check_PROGRAMS): Add many_sections_test.
	(many_sections_test_SOURCES): Define.
	(many_sections_test_DEPENDENCIES): Define.
	(many_sections_test_LDFLAGS): Define.
	(BUILT_SOURCES): Add many_sections_define.h.
	(many_sections_define.h): New target.
	(BUILT_SOURCES): Add many_sections_check.h.
	(many_sections_check.h): New target.
	(check_PROGRAMS): Add many_sections_r_test.
	(many_sections_r_test_SOURCES): Define.
	(many_sections_r_test_DEPENDENCIES): Define.
	(many_sections_r_test_LDFLAGS): Define.
	(many_sections_r_test_LDADD): Define.
	(many_sections_r_test.o): New target.
	* testsuite/Makefile.in: Rebuild.
2008-04-19 18:30:58 +00:00
Ian Lance Taylor 155a0dd763 * common.cc (Symbol_table::allocate_commons): Remove options
parameter.  Change caller.
	(Symbol_table::do_allocate_commons): Remove options parameter.
	Change caller.  Just call do_allocate_commons_list twice.
	(Symbol_table::do_allocate_commons_list): New function, broken out
	of do_allocate_commons.
	* common.h (class Allocate_commons_task): Remove options_ field.
	Update constructor.
	* symtab.cc (Symbol_table::Symbol_table): Initialize
	tls_commons_.
	(Symbol_table::add_from_object): Put TLS common symbols on
	tls_commons_ list.
	(Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
	which are IN_OUTPUT_DATA.
	* symtab.h (class Symbol_table): Add tls_commons_ field.  Update
	allocate_commons and do_allocate_commons declarations.  Declare
	do_allocate_commons_list.
	* gold.cc (queue_middle_tasks): Update creation of
	Allocate_commons_task to not pass options.
	* testsuite/Makefile.am (INCLUDES): Add -I.. .
	(TLS_TEST_C_FLAGS): New variable.
	(tls_test_c_pic.o): New target.
	(tls_test_shared.so): Link in tls_test_c_pic.o.
	(tls_test_c_pic_ie.o): New target.
	(tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
	(tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
	(tls_test_c.o): New target.
	(tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
	(tls_pic_test_LDADD): Likewise.
	(tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
	(tls_shared_gd_to_ie_test_LDADD): Likewise.
	(tls_test_c_gnu2.o): New target.
	(tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
	tls_test_c_gnu2.o.
	(tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
	(tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
	(tls_test_shared_nonpic.so): Link in tls_test_c.o.
	* testsuite/tls_test.cc: Include "config.h".
	(t_last): Call t11_last.
	* testsuite/tls_test.h (t11, t11_last): Declare.
	* testsuite/tls_test_c.c: New file.
	* testsuite/tls_test_main.cc (thread_routine): Call t11.
	* configure.ac: Check for OpenMP support.
	* configure, config.in, Makefile.in: Rebuild.
	* testsuite/Makefile.in: Rebuild.
2008-04-17 07:12:00 +00:00
Cary Coutant f3c69fcab1 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
(Symbol::needs_plt_entry): Allow weak undefined symbols.
	(Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
	building shared libraries.
	* testsuite/Makefile.am (weak_undef_nonpic_test): New target.
	(weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
	(weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/weak_undef.h: New file.
	* testsuite/weak_undef_file1.cc: Add extra test cases.
	* testsuite/weak_undef_file2.cc: Likewise.
	* testsuite/weak_undef_test.cc: Likewise.
2008-04-17 00:14:36 +00:00
Ian Lance Taylor 4f4995b628 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild. 2008-04-16 18:55:15 +00:00
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