mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-28 01:50:48 +00:00
* incremental.cc (Incremental_inputs::report_command_line): Ignore
--incremental-patch option. * layout.cc (Free_list::allocate): Extend allocation beyond original end if enabled. (Layout::make_output_section): Mark sections that should get patch space. * options.cc (parse_percent): New function. * options.h (parse_percent): New function. (DEFINE_percent): New macro. (General_options): Add --incremental-patch option. * output.cc (Output_section::Output_section): Initialize new data members. (Output_section::add_input_section): Print section name when out of patch space. (Output_section::add_output_section_data): Likewise. (Output_section::set_final_data_size): Add patch space when doing --incremental-full. (Output_section::do_reset_address_and_file_offset): Remove patch space. (Output_segment::set_section_list_addresses): Print debug output only if --incremental-update. * output.h (Output_section::set_is_patch_space_allowed): New function. (Output_section::is_patch_space_allowed_): New data member. (Output_section::patch_space_): New data member. * parameters.cc (Parameters::incremental_full): New function. * parameters.h (Parameters::incremental_full): New function * testsuite/Makefile.am (incremental_test_2): Add test for --incremental-patch option. * testsuite/Makefile.in: Regenerate. * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments. (t18): Remove function body.
This commit is contained in:
@@ -168,6 +168,11 @@ Free_list::allocate(off_t len, uint64_t align, off_t minoff)
|
||||
off_t start = p->start_ > minoff ? p->start_ : minoff;
|
||||
start = align_address(start, align);
|
||||
off_t end = start + len;
|
||||
if (end > p->end_ && p->end_ == this->length_ && this->extend_)
|
||||
{
|
||||
this->length_ = end;
|
||||
p->end_ = end;
|
||||
}
|
||||
if (end <= p->end_)
|
||||
{
|
||||
if (p->start_ + 3 >= start && p->end_ <= end + 3)
|
||||
@@ -186,6 +191,12 @@ Free_list::allocate(off_t len, uint64_t align, off_t minoff)
|
||||
return start;
|
||||
}
|
||||
}
|
||||
if (this->extend_)
|
||||
{
|
||||
off_t start = align_address(this->length_, align);
|
||||
this->length_ = start + len;
|
||||
return start;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1413,6 +1424,21 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type,
|
||||
&& strcmp(name + strlen(name) - 3, "str") == 0)
|
||||
this->have_stabstr_section_ = true;
|
||||
|
||||
// During a full incremental link, we add patch space to most
|
||||
// PROGBITS and NOBITS sections. Flag those that may be
|
||||
// arbitrarily padded.
|
||||
if ((type == elfcpp::SHT_PROGBITS || type == elfcpp::SHT_NOBITS)
|
||||
&& order != ORDER_INTERP
|
||||
&& order != ORDER_INIT
|
||||
&& order != ORDER_PLT
|
||||
&& order != ORDER_FINI
|
||||
&& order != ORDER_RELRO_LAST
|
||||
&& order != ORDER_NON_RELRO_FIRST
|
||||
&& strcmp(name, ".ctors") != 0
|
||||
&& strcmp(name, ".dtors") != 0
|
||||
&& strcmp(name, ".jcr") != 0)
|
||||
os->set_is_patch_space_allowed();
|
||||
|
||||
// If we have already attached the sections to segments, then we
|
||||
// need to attach this one now. This happens for sections created
|
||||
// directly by the linker.
|
||||
|
||||
Reference in New Issue
Block a user