| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2016-06-28 Igor Kudrin <ikudrin@accesssoftek.com>
gold/
PR gold/18098
* script-c.h (Sort_wildcard): Add SORT_WILDCARD_BY_INIT_PRIORITY.
* script-sections.cc (Input_section_sorter::get_init_priority): New method.
(Input_section_sorter::operator()): Handle SORT_WILDCARD_BY_INIT_PRIORITY.
(Output_section_element_input::print): Likewise.
* script.cc (script_keyword_parsecodes): Add entry SORT_BY_INIT_PRIORITY.
* yyscript.y (SORT_BY_INIT_PRIORITY): New token.
(wildcard_section): Handle SORT_BY_INIT_PRIORITY.
* testsuite/Makefile.am (script_test_14): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/script_test_14.s: New test source file.
* testsuite/script_test_14.sh: New test script.
* testsuite/script_test_14.t: New test linker script.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes INCLUDE directives in script files, so that when
an INCLUDE appears inside a sections block, section commands block,
or memory def block, the contents are parsed in the appropriate
context.
gold/
PR gold/18048
* script-c.h (script_include_directive): Add first_token parameter.
* script.cc (script_include_directive): Add first_token parameter, and
pass it to read_script_file.
* yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
(PARSING_MEMORY_DEF): New tokens.
(top): Add new productions for INCLUDE files.
(file_cmd): Replace file_or_sections_cmd with copy of its productions.
Pass PARSING_LINKER_SCRIPT to script_include_directive.
(section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
(section_cmd): Pass PARSING_SECTION_CMDS.
(file_or_sections_cmd): Remove.
(memory_def): Pass PARSING_MEMORY_DEF.
* testsuite/Makefile.am (memory_test_2): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/memory_test_inc.t: New script file.
* testsuite/memory_test_inc_1.t.src: New script file.
* testsuite/memory_test_inc_2.t.src: New script file.
* testsuite/memory_test_inc_3.t.src: New script file.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* expression.cc (script_exp_function_origin)
(script_exp_function_length): Move from here to ...
* script.cc: ... here.
(script_set_section_region, script_add_memory)
(script_parse_memory_attr, script_include_directive): New
functions.
* script-sections.cc
(class Memory_region): New class.
(class Output_section_definition): Add set_memory_region,
set_section_vma, set_section_lma and get_section_name methods.
(class Script_Sections): Add add_memory_region,
find_memory_region, find_memory_region_origin,
find_memory_region_length and set_memory_region methods.
Have set_section_addresses method walk the list of set memory
regions.
Extend the print methos to display memory regions.
* script-sections.h: Add prototypes for new methods.
Add enum for MEMORY region attributes.
* yyscript.y: Add support for parsing MEMORY regions.
* script-c.h: Add prototypes for new functions.
* testsuite/Makefile.am: Add test of MEMORY region functionality.
* testsuite/Makefile.in: Regenerate.
* testsuite/memory_test.sh: New script.
* testsuite/memory_test.s: New assembler source file.
* testsuite/memory_test.t: New linker script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
typename and following asterisk. Remove whitespace between
function name and opening parenthesis.
* archive.h: Likewise.
* arm.cc: Likewise.
* attributes.cc: Likewise.
* attributes.h: Likewise.
* common.cc: Likewise.
* copy-relocs.cc: Likewise.
* dirsearch.h: Likewise.
* dynobj.cc: Likewise.
* ehframe.cc: Likewise.
* ehframe.h: Likewise.
* expression.cc: Likewise.
* fileread.cc: Likewise.
* fileread.h: Likewise.
* gc.h: Likewise.
* gold-threads.cc: Likewise.
* gold.cc: Likewise.
* i386.cc: Likewise.
* icf.h: Likewise.
* incremental-dump.cc: Likewise.
* incremental.cc: Likewise.
* layout.cc: Likewise.
* layout.h: Likewise.
* main.cc: Likewise.
* merge.cc: Likewise.
* merge.h: Likewise.
* object.cc: Likewise.
* object.h: Likewise.
* options.cc: Likewise.
* options.h: Likewise.
* output.cc: Likewise.
* output.h: Likewise.
* plugin.cc: Likewise.
* plugin.h: Likewise.
* powerpc.cc: Likewise.
* reloc.cc: Likewise.
* script-c.h: Likewise.
* script-sections.cc: Likewise.
* script.cc: Likewise.
* stringpool.cc: Likewise.
* symtab.cc: Likewise.
* symtab.h: Likewise.
* target.cc: Likewise.
* timer.cc: Likewise.
* timer.h: Likewise.
* version.cc: Likewise.
* x86_64.cc: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* script.cc (Script_options::Script_options): Initialize
symbol_definitions_ and symbol_references_.
(Script_options::add_symbol_assignment): Update
symbol_definitions_ and symbol_references_.
(Script_options::add_symbol_reference): New function.
(script_symbol): New function.
* script.h (class Script_options): Add symbol_definitions_ and
symbol_references_ fields.
(Script_options::referenced_const_iterator): New type.
(Script_options::referenced_begin): New function.
(Script_options::referenced_end): New function.
(Script_options::is_referenced): New function.
(Script_options::any_unreferenced): New function.
* script-c.h (script_symbol): Declare.
* yyscript.y (exp): Call script_symbol.
* symtab.cc: Include "script.h".
(Symbol_table::gc_mark_undef_symbols): Add layout parameter.
Change all callers. Check symbols referenced by scripts.
(Symbol_table::add_undefined_symbols_from_command_line): Add
layout parameter. Change all callers.
(Symbol_table::do_add_undefined_symbols_from_command_line):
Likewise. Break out loop body. Check symbols referenced by
scripts.
(Symbol_table::add_undefined_symbol_from_command_line): New
function broken out of
do_add_undefined_symbols_from_command_line.
* symtab.h (class Symbol_table): Update declarations.
* archive.cc: Include "layout.h".
(Archive::should_include_member): Add layout parameter. Change
all callers. Check for symbol mentioned in expression.
* archive.h (class Archive): Update declaration.
* object.cc (Sized_relobj::do_should_include_member): Add layout
parameter.
* object.h (Object::should_include_member): Add layout parameter.
Change all callers.
(Object::do_should_include_member): Add layout parameter.
(class Sized_relobj): Update declaration.
* dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
parameter.
* dynobj.h (class Sized_dynobj): Update declaration.
* plugin.cc (Sized_pluginobj::do_should_include_member): Add
layout parameter.
* plugin.h (class Sized_pluginobj): Update declaration.
|
|
|
|
|
|
|
| |
the '-' character. Treat these as libraries.
* script.cc (script_add_library): New function. Adds a library
specified by "-l<name>" found in an input script.
* script-c.h: Add prototype for script_add_library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* layout.cc (Layout::choose_output_section): Handle script section
types.
(Layout::make_output_section_for_script): Add section type parameter.
Handle script section types.
* layout.h (Layout::make_output_section_for_script): Add section
type parameter.
* output.cc (Output_section::Output_section): Initialize data member
is_noload_.
(Output_section::do_reset_address_and_file_offset): Do not set address
to 0 if section is a NOLOAD section.
* output.h (Output_section::is_noload): New method.
(Output_section::set_is_noload): Ditto.
(Output_section::is_noload_): New data member.
* script-c.h (Script_section_type): New enum type.
(struct Parser_output_section_header): Add new file section_type.
* script-sections.cc (Sections_element::output_section_name): Add
parameter for returning script section type.
(Output_section_definition::output_section_name): Ditto.
(Output_section_definition::section_type)P; New method.
(Output_section_definiton::script_section_type_name): Ditto.
(Output_section_definition::script_section_type_): New data member.
(Output_section_definition::Output_section_definition): Initialize
data member Output_section_definition::script_section_type_.
(Output_section_definition::create_sections): Pass script section type
to Layout::make_output_section_for_script.
(Output_section_definition::output_section_name): Return script
section type to caller.
(Output_section_definition::set_section_address): Do not advance
dot value and load address if section type is NOLOAD. Set address
of NOLOAD sections regardless of section flags.
(Output_section_definition::print): Print section type if it is
not SCRIPT_SECTION_TYPE_NONE.
(Output_section_definition::section_type): New method.
(Output_section_definition::script_section_type_name): Ditto.
(Script_sections::output_section_name): Add new parameter
PSECTION_TYPE for returning script section type. Pass it to
section elements. Handle discard sections.
(Sort_output_sections::operator()): Handle NOLOAD sections.
* script-sections.h (Script_sections::Section_type): New enum type.
(Script_sections::output_section_name): Add a new parameter for
returning script section type.
* script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
INFO and NOLOAD.
* yyscript.y (union): Add new field SECTION_TYPE.
(COPY, DSECT, INFO, NOLOAD): New tokens.
(opt_address_and_section_type): Change type to output_section_header.
(section_type): New non-terminal
(section_header): Handle section type.
(opt_address_and_section_type): Return section type value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* expression.cc (class Segment_start_expression): New class definition.
(Segment_start_expression::value): New method definition.
(script_exp_function_segment_start): Return a new
Segment_start_expression.
* gold/script-c.h (script_saw_segment_start_expression): New function
prototype.
* script-sections.cc (Script_sections::Script_sections): Initialize
SAW_SEGMENT_START_EXPRESSION_ to false.
(Script_sections::set_section_addresses): Use -Ttext, -Tdata
and -Tbbs options to specify section addresses if given in
command line and no SEGMENT_START expression is seen in a script.
* script-sections.h (Script_sections::saw_segment_start_expression,
Script_sections::set_saw_segment_start_expression): New method
definition.
(Script_sections::saw_segment_start_expression_): New data member
declaration.
* script.cc (script_saw_segment_start_expression): New function.
* yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
* testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
script_test_7.sh and script_test_8.sh.
(check_DATA): Add script_test_6.stdout, script_test_7.stdout and
script_test_8.stdout.
(MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
(script_test_6, script_test_6.stdout, script_test_7,
script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
* Makefile.in: Regenerate.
* testsuite/script_test_6.sh: New file.
* testsuite/script_test_6.t: Same.
* testsuite/script_test_7.sh: Same.
* testsuite/script_test_7.t: Same.
* testsuite/script_test_8.sh: Same.
|
|
|
|
|
|
|
|
|
|
|
| |
* yyscript.y: Parse TARGET.
* script.cc (script_set_target): New function.
* script-c.h (script_set_target): Declare.
* options.cc (General_options::string_to_object_format): Rename
from string_to_object_format in anonymous namespace. Change
callers.
* options.h (class General_options): Declare
string_to_object_format.
|
|
|
|
|
|
| |
(extern_name_list, extern_name_list_body): New nonterminals.
* script.cc (script_add_extern): Define.
* script-c.h (script_add_extern): Declare.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Read_symbols::requeue): New function.
(Read_symbols::do_read_symbols): If make_elf_object fails because
the target type is not configured, and the file was searched for,
issue a warning and retry with the next directory.
(Add_symbols::run): If the file has an incompatible format, and
it was searched for, requeue the Read_symbols task. On error,
release the object.
* readsyms.h (class Read_symbols): Add dirindex_ field. Add
dirindex parameter to constructor. Change all callers. Declare
incompatible_warning and requeue.
(class Add_symbols): Add dirpath_, dirindex_, mapfile_,
input_argument_ and input_group_ fields. Add them to
constructor. Change all callers.
(class Read_script): Add dirindex_ field. Add it to constructor.
Change all callers.
* archive.cc (Archive::setup): Remove input_objects parameter.
Change all callers.
(Archive::get_file_and_offset): Likewise.
(Archive::read_all_symbols): Likewise.
(Archive::read_symbols): Likewise.
(Archive::get_elf_object_for_member): Remove input_objects
parameter. Add punconfigured parameter. Change all callers.
(Archive::add_symbols): Change return type to bool. Check return
value of include_member.
(Archive::include_all_members): Likewise.
(Archive::include_member): Change return type to bool. Return
false if first included object has incompatible target. Set
included_member_ field.
(Add_archive_symbols::run): If add_symbols returns false, requeue
Read_symbols task.
* archive.h (class Archive): Add included_member_ field.
Initialize it in constructor. Add input_file and searched_for
methods. Update declarations.
(class Add_archive_symbols): Add dirpath_, dirindex_, and
input_argument_ fields. Add them to constructor. Change all
callers.
* script.cc: Include "target-select.h".
(class Parser_closure): Add skip_on_incompatible_target_ and
found_incompatible_target_ fields. Add
skip_on_incompatible_target parameter to constructor. Change all
callers. Add methods skip_on_incompatible_target,
clear_skip_on_incompatible_target, found_incompatible_target, and
set_found_incompatible_target.
(read_input_script): Add dirindex parameter. Change all callers.
If parser finds an incompatible target, requeue Read_symbols
task.
(script_set_symbol): Clear skip_on_incompatible_target in
closure.
(script_add_assertion, script_parse_option): Likewise.
(script_start_sections, script_add_phdr): Likewise.
(script_check_output_format): New function.
* script.h (read_input_script): Update declaration.
* script-c.h (script_check_output_format): Declare.
* yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
(ignore_cmd): Remove OUTPUT_FORMAT.
* fileread.cc (Input_file::Input_file): Add explicit this.
(Input_file::will_search_for): New function.
(Input_file::open): Add pindex parameter. Change all callers.
* fileread.h (class Input_file): Add input_file_argument method.
Declare will_search_for. Update declarations.
* object.cc (make_elf_object): Add punconfigured parameter.
Change all callers.
* object.h (class Object): Make input_file public. Add
searched_for method.
(make_elf_object): Update declaration.
* dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
restart search.
* dirsearch.h (class Dirsearch): Update declaration.
* options.h (class General_options): Add --warn-search-mismatch.
* parameters.cc (Parameters::is_compatible_target): New function.
* parameters.h (class Parameters): Declare is_compatible_target.
* workqueue.cc (Workqueue::add_blocker): New function.
* workqueue.h (class Workqueue): Declare add_blocker.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
script items.
|
| |
|
|
|
|
| |
scripts, and handle extern "C++" in the middle of a block.
|
|
|
|
| |
scripts.
|
| |
|
| |
|
| |
|
| |
|
|
|