diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-06-24 19:48:51 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-06-24 19:48:51 +0000 |
commit | 9c547ec3ac2440e1d81af5d465e1db1d5e28e43e (patch) | |
tree | 7bf396b5e00ba6c0276aa6deff32566652b38809 /gold/output.cc | |
parent | 554585003d351dea8db3181866b89ebc9bf2f66c (diff) | |
download | binutils-9c547ec3ac2440e1d81af5d465e1db1d5e28e43e.zip binutils-9c547ec3ac2440e1d81af5d465e1db1d5e28e43e.tar.gz binutils-9c547ec3ac2440e1d81af5d465e1db1d5e28e43e.tar.bz2 |
PR 10156
* layout.cc (Layout::choose_output_section): If we find an
existing section, update the flags.
(Layout::create_notes): New function, broken out of
Layout::finalize.
(Layout::finalize): Don't create note sections.
(Layout::create_note): Don't crash if linker script discards
section.
(Layout::create_gold_note): Likewise.
(Layout::create_build_id): Likewise. Don't set
after_input_sections on the section.
(Layout::create_executable_stack_info): Remove target parameter.
Change caller.
* layout.h (class Layout): Declare create_notes. Update
declaration of create_executable_stack_info.
* gold.cc (queue_middle_tasks): Call create_notes.
* output.cc (Output_section::update_flags_for_input_section): Move
here from output.h. If SHF_ALLOC flag is newly set, mark address
invalid.
* output.h (Output_data::mark_address_invalid): New function.
(class Output_section): Only declare, not define,
update_flags_for_input_section. Remove set_flags.
Diffstat (limited to 'gold/output.cc')
-rw-r--r-- | gold/output.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gold/output.cc b/gold/output.cc index 911a49a..64fcb37 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -1995,6 +1995,24 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx, return true; } +// Update the output section flags based on input section flags. + +void +Output_section::update_flags_for_input_section(elfcpp::Elf_Xword flags) +{ + // If we created the section with SHF_ALLOC clear, we set the + // address. If we are now setting the SHF_ALLOC flag, we need to + // undo that. + if ((this->flags_ & elfcpp::SHF_ALLOC) == 0 + && (flags & elfcpp::SHF_ALLOC) != 0) + this->mark_address_invalid(); + + this->flags_ |= (flags + & (elfcpp::SHF_WRITE + | elfcpp::SHF_ALLOC + | elfcpp::SHF_EXECINSTR)); +} + // Given an address OFFSET relative to the start of input section // SHNDX in OBJECT, return whether this address is being included in // the final link. This should only be called if SHNDX in OBJECT has |