(Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
in the name/type/flags to section mapping. Don't call
allocate_output_section.
(Layout::choose_output_section): Change parameter from adjust_name
to is_input_section. Don't permit input sections after sections
are attached to segments. Don't call allocate_output_section.
(Layout::layout_eh_frame): Call update_flags_for_input_section,
not write_enable_output_section.
(Layout::make_output_section): Don't push to
unattached_section_list_ nor call attach_to_segment. Call
attach_section_to_segment if sections are attached.
(Layout::attach_sections_to_segments): New function.
(Layout::attach_section_to_segment): New function.
(Layout::attach_allocated_section_to_segment): Rename from
attach_to_segment. Remove flags parameter.
(Layout::allocate_output_section): Remove function.
(Layout::write_enable_output_section): Remove function.
* layout.h (class Layout): Update for above changes. Add new
field sections_are_attached_.
* output.h (Output_section::update_flags_for_input_section): New
function.
* output.cc (Output_section::add_input_section): Call
update_flags_for_input_section.
* gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
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.
* 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.
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.
* layout.cc (Layout::Layout): Initialize new field.
(Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
output section until we find a section we merged successfully.
* object.cc (Sized_relobj::check_eh_frame_flags): Don't require
that the size be non-zero.
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.
* 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.
parameters. Update for new key type to views_. Change all
callers.
(File_read::read): Adjust for byteshift in returned view.
(File_read::add_view): New function, broken out of
find_and_make_view.
(File_read::make_view): New function, broken out of
find_and_make_view.
(File_read::find_or_make_view): Add offset and aligned
parameters. Rewrite accordingly. Change all callers.
(File_read::get_view): Add offset and aligned parameters. Adjust
for byteshift in return value.
(File_read::get_lasting_view): Likewise.
* fileread.h (class File_read): Update declarations.
(class File_read::View): Add byteshift_ field. Add byteshift to
constructor. Add byteshift method.
* archive.h (Archive::clear_uncached_views): New function.
(Archive::get_view): Add aligned parameter. Change all callers.
* object.h (Object::get_view): Add aligned parameter. Change all
callers.
(Object::get_lasting_view): Likewise.
* fileread.cc (File_read::release): Don't call clear_views if
there are multiple objects.
* fileread.h (File_read::clear_uncached_views): New function.
* archive.cc (Add_archive_symbols::run): Call clear_uncached_views
on the archive.
Add thin archive support.
* archive.cc (Archive::armagt): New const.
(Archive::setup): Remove task parameter and calls to unlock.
(Archive::unlock_nested_archives): New function.
(Archive::read_header): Add nested_off parameter. Change
all callers.
(Archive::interpret_header): Likewise.
(Archive::include_all_members): Change to handle thin
archives.
(Archive::include_member): Likewise.
* archive.h (Archive::Archive): Add new parameters and
initializers.
(Archive::armagt): New const.
(Archive::setup): Remove task parameter.
(Archive::unlock_nested_archives): New function.
(Archive::read_header): Add nested_off parameter.
(Archive::interpret_header): Likewise.
(Archive::Nested_archive_table): New typedef.
(Archive::is_thin_archive_): New field.
(Archive::nested_archives_): New field.
(Archive::options_): New field.
(Archive::dirpath_): New field.
(Archive::task_): New field.
* readsyms.cc (Read_symbols::do_read_symbols): Add check
for thin archives. Pass additional parameters to
Archive::Archive. Unlock the archive file after calling
Archive::setup.
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.
(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.
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.
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.
* 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.
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.
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.
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.
* 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.