aboutsummaryrefslogtreecommitdiff
path: root/gold/options.h
AgeCommit message (Collapse)AuthorFilesLines
2008-08-072008-08-06 Cary Coutant <ccoutant@google.com>Cary Coutant1-0/+2
* 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-07-22 * options.h (class General_options): Define --check-sections.Ian Lance Taylor1-0/+4
* layout.cc (Layout::set_segment_offsets): Handle --check-sections.
2008-07-22 * options.h (class General_options): Define -n/--nmagic andIan Lance Taylor1-0/+6
-N/--omagic. * options.cc (General_options::finalize): For -n/--nmagic or -N/--omagic, set -static. * layout.cc (Layout::attach_allocated_section_to_segment): If -N/--omagic, don't put read-only and read-write sections in different segments. (Layout::find_first_load_seg): If -N/--omagic, don't insist on finding a read-only segment. (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic, don't set the minimum segment alignment to the common page size, and don't set the file offset to the address modulo the page size. * script-sections.cc (Script_sections::create_segments): If -n/--omagic, don't put read-only and read-write sections in different segments.
2008-07-22 * cref.cc: New file.Ian Lance Taylor1-0/+4
* cref.h: New file. * options.h (class General_options): Add --print-symbol-counts. * main.cc (main): Issue defined symbol report if requested. * archive.cc (Archive::interpret_header): Make into a const member function. (Archive::add_symbols): Call Input_objects::archive_start and archive_stop. (Archive::const_iterator): Define new class. (Archive::begin, Archive::end): New functions. (Archive::include_all_members): Rewrite to use iterator. (Archive::count_members): New function. * archive.h (class Archive): Update declarations. (Archive::filename): New function. * object.cc: Include "cref.h". (Sized_relobj::Sized_relobj): Initialize defined_count_. (Sized_relobj::do_get_global_symbol_counts): New function. (Input_objects::add_object): Add object to cross-referencer. (Input_objects::archive_start): New function. (Input_objects::archive_stop): New function. (Input_objects::print_symbol_counts): New function. * object.h: Declare Cref and Archive. (Object::get_global_symbol_counts): New function. (Object::do_get_global_symbol_counts): New pure virtual function. (class Sized_relobj): Add defined_count_ field. Update declarations. (class Input_objects): Add cref_ field. Update constructor. Update declarations. * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and defined_count_. (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing symbol counts. (Sized_dynobj::do_get_global_symbol_counts): New function. * dynobj.h (class Sized_dynobj): Add fields symbols_ and defined_count_. Update declarations. Define Symbols typedef. * symtab.cc (Symbol_table::add_from_relobj): Add defined parameter. Change all callers. (Symbol_table::add_from_dynobj): Add sympointers and defined parameters. Change all callers. * symtab.h (class Symbol_table): Update declarations. * Makefile.am (CCFILES): Add cref.cc. (HFILES): Add cref.h. * Makefile.in: Rebuild.
2008-05-28elfcpp/:Ian Lance Taylor1-0/+2
* dwarf.h (enum DW_FORM): Define. gold/: * reduced_debug_output.cc: New file. * reduced_debug_output.h: New file. * options.h (class General_optoins): Add --strip-debug-non-line. * options.cc (General_options::finalize): Add strip_debug_non_line to the strip heirarchy. * layout.h (class Layout): Add debug_abbrev_ and debug_info_ fields. * layout.cc: Include "reduced_debug_output.h". (Layout::Layout): Initialize new fields. (line_only_debug_sections): New static array. (is_lines_only_debug_sections): New static inline function. (Layout::include_section): Handle --strip-debug-non-line. (Layout::make_output_section): If --strip-debug-non-line, build new output sections for .debug_abbrev and .debug_info. * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace gold. Warn about possible overflow. (read_signed_LEB_128): Likewise. * dwarf_reader.h: (read_unsigned_LEB_128): Declare. (read_signed_LEB_128): Declare. * Makefile.am (CCFILES): Add reduced_debug_output.cc. (HFILES): Add reduced_debug_output.h. * Makefile.in: Rebuild.
2008-05-21 * mapfile.cc: New file.Ian Lance Taylor1-0/+5
* mapfile.h: New file. * options.h (class General_options): Add -M/--print-map and -Map. * options.cc (General_options::finalize): Make -M equivalent to -Map -. * main.cc: Include <cstdio> and "mapfile.h". (main): Open mapfile if requested. * gold.cc (class Middle_runner): Add mapfile_ field. Update constructor. Change caller. (queue_initial_tasks): Add mapfile parameter. Change caller. (queue_middle_tasks): Likewise. * gold.h (queue_initial_tasks, queue_middle_tasks): Update declarations. * archive.cc: Include "mapfile.h". (Archive::add_symbols): Add mapfile parameter. Change all callers. Pass mapfile, symbol, and reason to include_member. (Archive::include_all_members): Add mapfile parameter. Change all callers. (Archive::include_member): Add mapfile, sym, and why parameters. Change all callers. Report inclusion to map file. * archive.h: Include "fileread.h". (class Archive): Update declarations. (Archive::file): New const method. (class Add_archive_symbols): Add mapfile_ field. Update constructor. Change all callers. * readsyms.h (class Read_symbols): Likewise. (class Finish_group): Likewise. (class Read_script): Likewise. * common.cc: Include "mapfile.h". (Symbol_table::allocate_commons): Add mapfile parameter. Change all callers. (Symbol_table::do_allocate_commons): Likewise. (Symbol_table::do_allocate_commons_list): Likewise. Report common symbol allocation to mapfile. * common.h (class Allocate_commons_task): Add mapfile_ field. Update constructor. Change all callers. * symtab.h (class Symbol_table): Update declarations. * layout.cc: Include "mapfile.h". (Layout_task_runner::run): Print information to mapfile. (Layout::create_gold_note): Change Output_data_fixed_space to Output_data_zero_fill. (Layout::create_build_id): Likewise. (Layout::print_to_mapfile): New function. * layout.h (class Layout_task_runner): Add mapfile_ field. Update constructor. Change caller. (class Layout): Declare print_to_mapfile. * output.cc (Output_section::Input_section::print_to_mapfile): New function. (Output_section::add_input_section): If producing a map, always add to input_sections_ list. (Output_section::do_print_to_mapfile): New function. (Output_segment::print_sections_to_mapfile): New function. (Output_segment::print_section_list_to_mapfile): New function. * output.h: Include "mapfile.h". (Output_data::print_to_mapfile): New function. (Output_data::do_print_to_mapfile): New virtual function. (Output_segment_headers::do_print_to_mapfile): New function. (Output_file_header::do_print_to_mapfile): New function. (Output_data_const::do_print_to_mapfile): New function. (class Output_data_const_buffer): Add map_name_ field. Update constructor. Change all callers. Add do_print_to_mapfile function. (class Output_data_fixed_space): Likewise. (class Output_data_space): Likewise. (class Output_data_zero_fill): New class. (Output_data_strtab::do_print_to_mapfile): New function. (Output_data_reloc_base::do_print_to_mapfile): New function. (Output_relocatable_relocs::do_print_to_mapfile): New function. (Output_data_group::do_print_to_mapfile): New function. (Output_data_got::do_print_to_mapfile): New function. (Output_data_dynamic::do_print_to_mapfile): New function. (Output_symtab_xindex::do_print_to_mapfile): New function. (class Output_section): Declare do_print_to_mapflie. Declare print_to_mapfile in Input_section. (class Output_segment): Declare new functions. * object.h (Sized_relobj::symbol_count): New function. * script-sections.cc (Output_section_element_dot_assignment::set_section_addresses): Change Output_data_fixed_space to Output_data_zero_fill. (Output_data_expression::do_print_to_mapfile): New function. * script.cc (read_input_script): Add mapfile parameter. Change all callers. * script.h (read_input_script): Update declaration. * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function. (Eh_frame::do_print_to_mapfile): New function. * merge.h (Output_merge_data::do_print_to_mapfile): New function. (Output_merge_string::do_print_to_mapfile): New function. * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New function. * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New function. * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New function. * Makefile.am (CCFILES): Add mapfile.cc. (HFILES): Add mapfile.h. * Makefile.in: Rebuild.
2008-05-20 * options.h (class General_options): Add -z relro.Ian Lance Taylor1-0/+3
* 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-07 PR 6049Ian Lance Taylor1-5/+16
* options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end functions. (class General_options): Remove existing --undefined, and add --no-undefined instead. Add new --undefined as synonym for -u. * archive.cc (Archive::add_symbols): Check whether symbol was named with -u. * gold.cc (queue_middle_tasks): Add -u symbols to symbol table. * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change all uses. Add IS_UNDEFINED. Update declarations to split different versions of init_base. Declare init_base_undefined. (Symbol::is_defined): Handle IS_UNDEFINED. (Symbol::is_undefined): Likewise. (Symbol::is_weak_undefined): Call is_undefined. (Symbol::is_absolute): Handle IS_CONSTANT. (class Sized_symbol): Update declarations to split different versions of init. Declare init_undefined. (class Symbol_table): Declare new functions. * symtab.cc (Symbol::init_base_object): Rename from init_base. Change all callers. (Symbol::init_base_output_data): Likewise. (Symbol::init_base_output_segment): Likewise. (Symbol::init_base_constant): Likewise. (Symbol::init_base_undefined): New function. (Sized_symbol::init_object): Rename from init. Change all callers. (Sized_symbol::init_output_data): Likewise. (Sized_symbol::init_output_segment): Likewise. (Sized_symbol::init_constant): Likewise. (Sized_symbol::init_undefined): New function. (Symbol_table::add_undefined_symbols_from_command_line): New function. (Symbol_table::do_add_undefined_symbols_from_command_line): New function. (Symbol::final_value_is_known): Handle IS_UNDEFINED. (Symbol::output_section): Likewise. (Symbol::set_output_section): Likewise. (Symbol_table::sized_finalize_symbol): Likewise. (Symbol_table::sized_write_globals): Likewise. * resolve.cc (Symbol_table::should_override): Likewise. (Symbol::override_base_with_special): Likewise.
2008-05-06 * options.h (DEFINE_var): Add set_user_set_##varname__.Ian Lance Taylor1-4/+59
(DEFINE_bool_alias): New macro. (class General_options): Define -Bstatic using DEFINE_bool_alias rather than DEFINE_special. Add --undefined as an alias for -z defs. * options.cc (General_options::parse_Bstatic): Remove.
2008-05-06 * options.h (class General_options): Add --fatal-warnings.Ian Lance Taylor1-0/+4
* main.cc (main): Implement --fatal-warnings. * errors.h (Errors::warning_count): New function.
2008-05-06 * options.h (class General_options): Add -Bsymbolic-functions.Ian Lance Taylor1-0/+3
* symtab.h (Symbol::is_preemptible): Check for -Bsymbolic-functions.
2008-05-062008-05-05 Ian Lance Taylor <iant@google.com>Ian Lance Taylor1-4/+9
* options.h (DEFINE_bool): For DASH_Z, create the negative option as noVARNAME rather than no-VARNAME. (class General_options): Add option -z combreloc. * output.h (class Output_reloc) [SHT_REL]: Declare compare and get_address. (Output_reloc::sort_before) [SHT_REL]: New function. (Output_reloc::sort_before) [SHT_RELA]: New function. (class Output_data_reloc_base): Add sort_relocs_ field. Define Sort_relocs_comparison. (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs parameter. Change all callers. (Output_data_reloc::Output_data_reloc) [both versions]: Add sort_relocs parameter. Change all callers. * output.cc (Output_reloc::get_address): New function, broken out of write_rel. (Output_reloc::write_rel): Call it. (Output_reloc::compare): New function. (Output_data_reloc_base::do_write): Optionally sort relocs.
2008-04-17 * errors.cc (Errors::info): New function.Cary Coutant1-17/+30
(gold_info): New function. * errors.h (Errors::info): New function. * gold.h (gold_info): New function. * object.cc (Input_objects::add_object): Print trace output. * options.cc (options::parse_set): New function. (General_options::parse_wrap): Deleted. (General_options::General_options): Deleted initializer. * options.h (options::String_set): New typedef. (options::parse_set): New function. (DEFINE_set): New macro. (General_options::wrap): Changed to use DEFINE_set. Changed callers of any_wrap_symbols and is_wrap_symbol. (General_options::trace, General_options::trace_symbol): New options. (General_options::any_wrap_symbols, General_options::is_wrap_symbol) (General_options::wrap_symbols_): Deleted. * symtab.cc (Symbol_table::add_from_object): Print trace output.
2008-04-17 * options.cc (General_options::parse_V): New function.David S. Miller1-0/+5
* options.h: Add entries for -V and -Qy.
2008-04-16elfcpp/David S. Miller1-0/+47
* elfcpp.h (DF_1_NOW, DF_1_GLOBAL, DF_1_GROUP, DF_1_NODELETE, DF_1_LOADFLTR, DF_1_INITFIRST, DF_1_NOOPEN, DF_1_ORIGIN, DF_1_DIRECT, DF_1_TRANS, DF_1_INTERPOSE, DF_1_NODEFLIB, DF_1_NODUMP, DF_1_CONLFAT): New enum constants. gold/ * options.h (DEFINE_enable): New macro. (new_dtags): New enable option. (initfirst, interpose, loadfltr, nodefaultlib, nodelete, nodlopen, nodump): New -z options. * layout.cc (Layout:finish_dynamic_section): If new dtags enabled, emit DT_RUNPATH. Also, emit a DT_FLAGS_1 containing any specified -z flags.
2008-04-11 * options.h (General_options): Add entries for '-Y' andIan Lance Taylor1-0/+7
'-relax'. * options.cc (General_options:finalize): If -Y was used, add those entries to the library path instead of the default "/lib" and "/usr/lib".
2008-04-09 * options.h (class General_options): Add --noinhibit-exec option.Ian Lance Taylor1-0/+3
* main.cc (main): Check --noinhibit-exec.
2008-04-09 * options.h (class General_options): Define --wrap as a specialIan Lance Taylor1-0/+18
option. Add wrap_symbols_ field. (General_options::any_wrap_symbols): New function. (General_options::is_wrap_symbol): New function. * options.cc (General_options::parse_wrap): New function. (General_options::General_options): Initialize wrap_symbols_. * symtab.cc (Symbol_table::wrap_symbol): New function. (Symbol_table::add_from_object): Handle --wrap. * symtab.h (class Symbol_table): Declare wrap_symbol. * target.h (Target::wrap_char): New function. (Target::Target_info): Add wrap_char field. * i386.cc (Target_i386::i386_info): Initialize wrap_char. * x86_64.cc (Target_x86_64::x86_64_info): Likewise. * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2008-03-25 * options.h (class General_options): Define build_id option.Ian Lance Taylor1-0/+4
* 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-24 * options.cc: Include "demangle.h".Ian Lance Taylor1-20/+61
(parse_optional_string): New function. (parse_long_option): Handle takes_optional_argument. (parse_short_option): Update dash_z initializer. Handle takes_optional_argument. (General_options::General_options): Initialize do_demangle_. (General_options::finalize): Set do_demangle_. Handle demangling style. * options.h (parse_optional_string): Declare. (struct One_option): Add optional_arg field. Update constructor. Update call constructor calls. Add takes_optional_argument function. (DEFINE_var): Add optional_arg__ parameter. Change all callers. (DEFINE_optional_string): Define. (General_options::demangle): Change from DEFINE_bool to DEFINE_optional_string. (General_options::no_demangle): New function. (General_options::do_demangle): New function. (General_options::set_do_demangle): New function. (General_options::execstack_status_): Move definition to end of class definition. (General_options::static_): Likewise. (General_options::do_demangle_): New field. * object.cc (big_endian>::get_symbol_location_info): Call Options::do_demangle, not Options::demangle. * symtab.cc (demangle): Likewise.
2008-03-22 * gold.h: Include <cstddef> and <sys/types.h>Ian Lance Taylor1-0/+1
* options.h: Include <cstring>.
2008-03-20From Craig Silverstein: implement -z defs.Ian Lance Taylor1-0/+3
2008-03-13From Craig Silverstein: Implement --debug=files to track file opens,Ian Lance Taylor1-1/+5
and implement --verbose as a synonym.
2008-03-07From Craig Silverstein: sort options into alphabetical order.Ian Lance Taylor1-29/+36
2008-03-07Recognize --hash-bucket-empty-fraction.Ian Lance Taylor1-1/+14
2008-03-06Use N_ for option help strings, and call gettext when printing them.Ian Lance Taylor1-70/+69
2008-03-06From Craig Silverstein: accept any string for input format, warn ifIan Lance Taylor1-5/+6
thread options when not supported.
2008-03-06Support --hash-style=gnu.Ian Lance Taylor1-0/+4
2008-03-04From Craig Silverstein: rework option handling to make it easier toIan Lance Taylor1-650/+588
add a new option.
2008-03-04From Craig Silverstein: rename some option functions in preparationIan Lance Taylor1-7/+11
for reworking option handling.
2008-02-28Support -d/--define-common.Ian Lance Taylor1-0/+22
2008-02-28From Craig Silverstein: Have Parameters point to General_options.Ian Lance Taylor1-0/+10
2008-02-27Implement -q/--emit-relocs.Ian Lance Taylor1-0/+10
2008-02-26From Craig Silverstein: rework handling of Script_options.Ian Lance Taylor1-27/+13
2008-02-26From Craig Silverstein: implement -z max-page-size and -zIan Lance Taylor1-0/+30
common-page-size.
2008-02-26From Craig Silverstein: rename option functions for future optionIan Lance Taylor1-72/+73
handling rewrite.
2008-02-13Implement -Tdata and -Tbss.Ian Lance Taylor1-5/+38
2008-02-13Support selecting target by name.Ian Lance Taylor1-1/+7
2008-02-08Add support for --format binary for input files.Ian Lance Taylor1-10/+21
2008-02-07Support --oformat binary.Ian Lance Taylor1-0/+18
2008-02-07Implement --just-symbols, including -R FILE. Fix symbol values whenIan Lance Taylor1-2/+24
doing a relocatable link.
2008-02-04Treat an empty directory argument as the current directory.Ian Lance Taylor1-1/+4
2008-01-15From Andrew Chatham and Craig Silverstein: Add support for versionIan Lance Taylor1-0/+5
scripts.
2008-01-09Support assignments and expressions in linker scripts.Ian Lance Taylor1-11/+29
2008-01-06Add support for -e and for ENTRY in linker scripts.Ian Lance Taylor1-0/+15
2008-01-04Add -h/-soname option.Ian Lance Taylor1-0/+10
2007-12-14Fix --thread-count-middle and --thread-count-final.Ian Lance Taylor1-2/+2
2007-12-08From Craig Silverstein: Fix error message, add this->.Ian Lance Taylor1-2/+2
2007-12-04From Craig Silverstein: Use gold_fatal in options.h, beef up value checks.Ian Lance Taylor1-14/+16
2007-11-30From Craig Silverstein: Add support for compressing .debug_str section.Ian Lance Taylor1-2/+34