aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.h
AgeCommit message (Collapse)AuthorFilesLines
2008-04-19 * object.cc (Xindex::initialize_symtab_xindex): New function.Ian Lance Taylor1-5/+29
(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-15 * layout.cc (Layout::Layout): Initialize sections_are_attached_.Ian Lance Taylor1-8/+10
(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.
2008-04-09 * layout.h (class Layout): Add added_eh_frame_data_ field.Ian Lance Taylor1-0/+2
* 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.
2008-03-25 * options.h (class General_options): Define build_id option.Ian Lance Taylor1-0/+15
* layout.h (class Layout): Declare write_build_id, create_note, create_build_id. Add build_id_note_ member. * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>, "libiberty.h", "md5.h", "sha1.h". (Layout::Layout): Initialize eh_frame_data_, eh_frame_hdr_section_, and build_id_note_. (Layout::finalize): Call create_build_id. (Layout::create_note): New function, broken out of Layout::create_gold_note. (Layout::create_gold_note): Call create_note. (Layout::create_build_id): New function. (Layout::write_build_id): New function. (Close_task_runner::run): Call write_build_id.
2008-03-12Combine read-only .eh_frame sections with read-write .eh_frameIan Lance Taylor1-0/+4
sections.
2008-03-11If we a section with no flags followed by a section with the same nameIan Lance Taylor1-0/+8
with flags, put them in the same output section.
2008-02-29Remove gcc 3.2 compatibility hacks.Ian Lance Taylor1-2/+1
2008-02-28Don't check assertions until symbols are finalized. Create an outputIan Lance Taylor1-0/+9
section if the script uses a data statement with no input sections. Don't create a loadable segment for the headers if there is no room.
2008-02-28From Craig Silverstein: Have Parameters point to General_options.Ian Lance Taylor1-2/+4
2008-02-07Support --oformat binary.Ian Lance Taylor1-2/+9
2008-02-06Fix group signature handling for relocatable link, add bootstrapIan Lance Taylor1-0/+25
relocatable test.
2008-02-06Initial -r support.Ian Lance Taylor1-0/+28
2008-02-04Implement SIZEOF_HEADERS, section constraints, other minor linkerIan Lance Taylor1-0/+4
script items.
2008-02-04Fully implement the SECTIONS clause.Ian Lance Taylor1-6/+30
2008-01-26Don't pass around the target in order to define symbols; get it fromIan Lance Taylor1-6/+6
the parameters instead.
2008-01-09Support assignments and expressions in linker scripts.Ian Lance Taylor1-10/+18
2008-01-06Add support for -e and for ENTRY in linker scripts.Ian Lance Taylor1-0/+9
2008-01-02Reduce the number of system calls. Use readv instead of pread. DoIan Lance Taylor1-2/+1
better handling of cached views.
2007-12-14Rewrite workqueue. This version eliminates the master thread, andIan Lance Taylor1-28/+34
reduces the amount of locking required to find a new thread to run.
2007-12-11From Cary Coutant: Set DF_STATIC_TLS as appropriate.Ian Lance Taylor1-0/+12
2007-12-06From Cary Coutant: More support for generating shared libraries.Ian Lance Taylor1-1/+11
2007-12-05Stringpool stats. Also make Symbol_table support functions inline.Ian Lance Taylor1-0/+4
2007-12-01Compress all debug sections.Ian Lance Taylor1-6/+0
2007-11-30From Craig Silverstein: Add support for compressing .debug_str section.Ian Lance Taylor1-2/+18
2007-11-29Clean up setting address and section offset.Ian Lance Taylor1-5/+7
2007-11-22Add threading support.Ian Lance Taylor1-0/+16
2007-11-15From Cary Coutant: Count textrel with output sections rather thanIan Lance Taylor1-7/+0
setting a flag as we add each reloc in the target code.
2007-11-14From Cary Coutant: Improve i386 shared library TLS support.Ian Lance Taylor1-0/+7
2007-11-14Add heuristics for undefined symbol warnings.Ian Lance Taylor1-4/+5
2007-11-09Generate a complete exception frame header. Discard duplicateIan Lance Taylor1-13/+117
exception frame information.
2007-11-07From Craig Silverstein and Cary Coutant: fix assignment of sectionIan Lance Taylor1-3/+8
indexes to sections which are not associated with segments.
2007-10-27From Cary Coutant: Set offsets of sections with data before finalizingIan Lance Taylor1-1/+1
local symbols.
2007-10-23Add support for PT_GNU_STACK.Ian Lance Taylor1-1/+21
2007-10-22Fix versions of copied symbols.Ian Lance Taylor1-0/+2
2007-10-12Add --stats option to print runtime and memory usage statistics.Ian Lance Taylor1-0/+7
2007-10-09Create a note section with the version of gold.Ian Lance Taylor1-0/+4
2007-09-26Put size and endianness in parameters.Ian Lance Taylor1-10/+6
2007-09-26Add basic exception frame header, plus test.Ian Lance Taylor1-0/+9
2007-09-22Add licensing text to every source file.Ian Lance Taylor1-0/+20
2007-09-22Define __start and __stop symbols.Ian Lance Taylor1-0/+4
2006-12-06gcc 3.2.2 and 4.1.0 portability hacks.Ian Lance Taylor1-1/+2
2006-12-06Generate version information.Ian Lance Taylor1-2/+20
2006-12-01Can now dynamically link hello, world.Ian Lance Taylor1-10/+40
2006-11-29Hash tables, dynamic section, i386 PLT, gold_assert.Ian Lance Taylor1-13/+31
2006-11-14More dynamic object support, initial scripting support.Ian Lance Taylor1-9/+21
2006-11-07Rework stringpool and hash tables so that we always generate the sameIan Lance Taylor1-3/+3
output regardless of randomize_va_space.
2006-11-06Split Object into Dynobj and Relobj, incorporate elfcpp swapping changes.Ian Lance Taylor1-1/+1
2006-11-03Can now do a full static link of hello, world in C or C++Ian Lance Taylor1-14/+52
2006-10-20Framework for relocation scanning. Implement simple static TLSIan Lance Taylor1-37/+25
relocations.
2006-10-06Lay out object file sections when we add the symbols to the symbolIan Lance Taylor1-5/+3
table.