+2008-11-05 Craig Silverstein <csilvers@google.com>
+
+ * 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-05 Craig Silverstein <csilvers@google.com>
+
+ * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
+ * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
+ (t11_last): Likewise.
+ * testsuite/ver_test_6.c (main): Likewise.
+
+2008-10-07 Cary Coutant <ccoutant@google.com>
+
+ * options.c (General_options::finalize): Add check for -static and
+ -shared.
+ * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
+ is not empty.
+
+2008-10-02 Cary Coutant <ccoutant@google.com>
+
+ * plugin.cc (make_sized_plugin_object): Fix conditional
+ compilation to work when not all targets are enabled.
+
+2008-09-29 Cary Coutant <ccoutant@google.com>
+
+ * 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.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/thin_archive_main.cc: New file.
+ * testsuite/thin_archive_test_1.cc: New file.
+ * testsuite/thin_archive_test_2.cc: New file.
+ * testsuite/thin_archive_test_3.cc: New file.
+ * testsuite/thin_archive_test_4.cc: New file.
+
+2008-09-29 Cary Coutant <ccoutant@google.com>
+
+ * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
+ * object.cc (Sized_relobj::do_layout): Use constant invalid_address
+ instead of -1U.
+ (Sized_relobj::do_finalize_local_symbols): Likewise.
+ (Sized_relobj::map_to_kept_section): Likewise.
+ * object.h (Sized_relobj::invalid_address): New constant.
+ (Sized_relobj::do_output_section_offset): Check for invalid_address
+ and return -1ULL.
+ * output.cc (Output_reloc::local_section_offset): Use constant
+ invalid_address instead of -1U.
+ (Output_reloc::get_address): Likewise.
+ (Output_section::output_address): Change -1U to -1ULL.
+ * output.h (Output_reloc::invalid_address): New constant.
+ * reloc.cc (Sized_relobj::write_sections): Use constant
+ invalid_address instead of -1U.
+ (Sized_relobj::relocate_sections): Likewise.
+ * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
+ values for merge sections.
+ * target-reloc.h (relocate_for_relocatable): Use constant
+ invalid_address instead of -1U.
+
+2008-09-19 Cary Coutant <ccoutant@google.com>
+
+ Add plugin functionality for link-time optimization (LTO).
+ * 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-16 Ian Lance Taylor <iant@google.com>
+
+ * 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.
+
+ * fileread.cc (make_view): Add casts to avoid warning.
+
+2008-09-16 Alexandre Oliva <aoliva@redhat.com>
+
+ * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
+ * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
+
+2008-09-16 Alexandre Oliva <aoliva@redhat.com>
+
+ * options.h (General_options::output_is_executable): New.
+ (General_options::output_is_pie): New.
+ * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
+ for shared libraries.
+ * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
+
+2008-09-11 Chris Demetriou <cgd@google.com>
+
+ * options.h (origin): New -z option.
+ * layout.cc (Layout:finish_dynamic_section): If "-z origin"
+ is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
+ in DT_FLAGS_1.
+
+2008-09-05 Cary Coutant <ccoutant@google.com>
+
+ * fileread.cc (File_read::make_view): Add check for attempt to map
+ beyond end of file.
+
+2008-09-05 Cary Coutant <ccoutant@google.com>
+
+ * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
+ explicit instantiations.
+
+2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
+
+ PR gold/6858
+ * options.cc (General_options::finalize): Allow undefined symbols
+ in shlibs if linking -shared.
+
+ PR gold/6859
+ * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
+ symbols as not needing a dynsym entry.
+
+2008-08-20 Craig Silverstein <csilvers@google.com>
+
+ * fileread.cc (File_read::open): Do not lock the file unless it
+ was successfully opened.
+
+2008-08-14 Cary Coutant <ccoutant@google.com>
+
+ * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
+ Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
+ * testsuite/tls_test.cc (struct int128): 128-bit struct
+ for testing TLS relocs with non-zero addend.
+ (v12): New TLS variable.
+ (t12): New test.
+ (t_last): Add check for v12.
+ * testsuite/tls_test.h (t12): New function.
+ * testsuite/tls_test_main.cc (thread_routine): Call new test.
+
+2008-08-13 Ian Lance Taylor <iant@google.com>
+
+ * 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-06 Cary Coutant <ccoutant@google.com>
+
+ * archive.cc (Archive::total_archives, Archive::total_members)
+ (Archive::total_members_loaded): New variables.
+ (Archive::setup): Add parameter. Add option to preread
+ archive symbols.
+ (Archive::read_armap): Add counter.
+ (Archive::get_file_and_offset): New function.
+ (Archive::get_elf_object_for_member): New function.
+ (Archive::read_all_symbols): New function.
+ (Archive::read_symbols): New function.
+ (Archive::add_symbols): Add counters.
+ (Archive::include_all_members): Use armap to find members if it's
+ already built.
+ (Archive::include_member): Skip reading symbols if already read.
+ Factored code into Archive::get_file_and_offset and
+ Archive::get_elf_object_for_member. Changed call to
+ Mapfile::report_include_archive_member.
+ (Archive::print_stats): New function.
+ * archive.h: Declare Object and Read_symbols_data classes.
+ (Archive::Archive): Add initializers for new members.
+ (Archive::setup): Add parameter.
+ (Archive::print_stats): New function.
+ (Archive::total_archives, Archive::total_members)
+ (Archive::total_members_loaded): New variables.
+ (Archive::get_file_and_offset): New function.
+ (Archive::get_elf_object_for_member): New function.
+ (Archive::read_all_symbols): New function.
+ (Archive::read_symbols): New function.
+ (Archive::Archive_member): New class.
+ (Archive::members_): New member.
+ (Archive::num_members_): New member.
+ * main.cc: Include archive.h.
+ (main): Call Archive::print_stats.
+ * mapfile.cc (Mapfile::report_include_archive_member): Delete
+ archive parameter; member_name is now the fully-decorated name.
+ * mapfile.h (Mapfile::report_include_archive_member): Likewise.
+ * options.h: (General_options): Add --preread-archive-symbols option.
+ * readsyms.cc (Read_symbols::do_read_symbols): Change call to
+ Archive::setup.
+
+2008-08-04 Ian Lance Taylor <iant@google.com>
+
+ * 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 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (POTFILES.in): Set LC_ALL=C.
+ * Makefile.in: Regenerate.
+ * po/POTFILES.in: Regenerate.
+
+2008-07-29 Ian Lance Taylor <iant@google.com>
+
+ * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
+ symbols before other symbols.
+ * testsuite/script_test_2.cc (test_addr): Declare.
+ (test_addr_alias): Declare.
+ (main): Check that test_addr and test_addr_alias have the right
+ values.
+ * testsuite/script_test_2.t: Define test_addr_alias and
+ test_addr.
+
+2008-07-24 Ian Lance Taylor <iant@google.com>
+
+ PR 5990
+ * descriptors.cc: New file.
+ * descriptors.h: New file.
+ * gold-threads.h (class Hold_optional_lock): New class.
+ * fileread.cc: Include "descriptors.h".
+ (File_read::~File_read): Release descriptor rather than closing
+ it.
+ (File_read::open) [file]: Call open_descriptor rather than open.
+ Set is_descriptor_opened_.
+ (File_read::open) [memory]: Assert that descriptor is not open.
+ (File_read::reopen_descriptor): New function.
+ (File_read::release): Release descriptor.
+ (File_read::do_read): Make non-const. Reopen descriptor.
+ (File_read::read): Make non-const.
+ (File_read::make_view): Reopen descriptor.
+ (File_read::do_readv): Likewise.
+ * fileread.h (class File_read): Add is_descriptor_opened_ field.
+ Update declarations.
+ * layout.cc: Include "descriptors.h".
+ (Layout::create_build_id): Use open_descriptor rather than open.
+ * output.cc: Include "descriptors.h".
+ (Output_file::open): Use open_descriptor rather than open.
+ * archive.cc (Archive::const_iterator): Change Archive to be
+ non-const.
+ (Archive::begin, Archive::end): Make non-const.
+ (Archive::count_members): Likewise.
+ * archive.h (class Archive): Update declarations.
+ * object.h (Object::read): Make non-const.
+ * Makefile.am (CCFILES): Add descriptors.cc.
+ (HFILES): Add descriptors.h.
+ * Makefile.in: Rebuild.
+
+ PR 6716
+ * gold.h: Always include <clocale>. Add Solaris workarounds
+ following code in binutils/sysdep.h.
+
+ PR 6048
+ * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
+ this->eh_frame_hdr_ is NULL before using it.
+
+ * dynobj.cc (Versions::Versions): Update comment.
+
+ * dynobj.cc (Versions::Versions): If there is an soname, use it as
+ the base version name.
+
+ * stringpool.cc (Stringpool_template::add_with_length): Set key to
+ array size plus one.
+ (Stringpool_template::set_string_offsets): Subtract one from key
+ before using it as an array index.
+ (Stringpool_template::get_offset_with_length): Likewise.
+ (Stringpool_template::write_to_buffer): Likewise.
+ * stringpool.h (Stringpool_template::get_offset_from_key):
+ Likewise.
+
+2008-07-23 Ian Lance Taylor <iant@google.com>
+
+ PR 6658
+ * object.h (Merged_symbol_value::value): Do our best to handle a
+ negative addend.
+
+ 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 Simon Baldwin <simonb@google.com>
+
+ * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
+ to zero for undefined symbols from dynamic libraries.
+
2008-07-23 Ian Lance Taylor <iant@google.com>
* symtab.cc (Symbol_table::resolve): Remove version parameter.