mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 19:50:13 +08:00
2010-09-09 Rafael Espindola <espindola@google.com>
* layout.cc (Layout::attach_allocated_section_to_segment): Don't put sections with different PF_X flags in the same segment. (Layout::find_first_load_seg): Search all segments to find the first one. * options.h (rosegment): New.
This commit is contained in:
@ -1,4 +1,12 @@
|
|||||||
2010-09-03 Rafael Espindola <espindola@google.com>
|
2010-09-09 Rafael Espindola <espindola@google.com>
|
||||||
|
|
||||||
|
* layout.cc (Layout::attach_allocated_section_to_segment): Don't put
|
||||||
|
sections with different PF_X flags in the same segment.
|
||||||
|
(Layout::find_first_load_seg): Search all segments to find the first
|
||||||
|
one.
|
||||||
|
* options.h (rosegment): New.
|
||||||
|
|
||||||
|
2010-09-08 Rafael Espindola <espindola@google.com>
|
||||||
|
|
||||||
* layout.cc (Layout::set_segment_offsets): Always advance to a new page.
|
* layout.cc (Layout::set_segment_offsets): Always advance to a new page.
|
||||||
|
|
||||||
|
@ -1171,10 +1171,11 @@ Layout::attach_allocated_section_to_segment(Output_section* os)
|
|||||||
bool is_address_set = parameters->options().section_start(os->name(), &addr);
|
bool is_address_set = parameters->options().section_start(os->name(), &addr);
|
||||||
|
|
||||||
// In general the only thing we really care about for PT_LOAD
|
// In general the only thing we really care about for PT_LOAD
|
||||||
// segments is whether or not they are writable, so that is how we
|
// segments is whether or not they are writable or executable,
|
||||||
// search for them. Large data sections also go into their own
|
// so that is how we search for them.
|
||||||
// PT_LOAD segment. People who need segments sorted on some other
|
// Large data sections also go into their own PT_LOAD segment.
|
||||||
// basis will have to use a linker script.
|
// People who need segments sorted on some other basis will
|
||||||
|
// have to use a linker script.
|
||||||
|
|
||||||
Segment_list::const_iterator p;
|
Segment_list::const_iterator p;
|
||||||
for (p = this->segment_list_.begin();
|
for (p = this->segment_list_.begin();
|
||||||
@ -1186,6 +1187,9 @@ Layout::attach_allocated_section_to_segment(Output_section* os)
|
|||||||
if (!parameters->options().omagic()
|
if (!parameters->options().omagic()
|
||||||
&& ((*p)->flags() & elfcpp::PF_W) != (seg_flags & elfcpp::PF_W))
|
&& ((*p)->flags() & elfcpp::PF_W) != (seg_flags & elfcpp::PF_W))
|
||||||
continue;
|
continue;
|
||||||
|
if (parameters->options().rosegment()
|
||||||
|
&& ((*p)->flags() & elfcpp::PF_X) != (seg_flags & elfcpp::PF_X))
|
||||||
|
continue;
|
||||||
// If -Tbss was specified, we need to separate the data and BSS
|
// If -Tbss was specified, we need to separate the data and BSS
|
||||||
// segments.
|
// segments.
|
||||||
if (parameters->options().user_set_Tbss())
|
if (parameters->options().user_set_Tbss())
|
||||||
@ -1454,6 +1458,7 @@ Layout::define_group_signatures(Symbol_table* symtab)
|
|||||||
Output_segment*
|
Output_segment*
|
||||||
Layout::find_first_load_seg()
|
Layout::find_first_load_seg()
|
||||||
{
|
{
|
||||||
|
Output_segment* best = NULL;
|
||||||
for (Segment_list::const_iterator p = this->segment_list_.begin();
|
for (Segment_list::const_iterator p = this->segment_list_.begin();
|
||||||
p != this->segment_list_.end();
|
p != this->segment_list_.end();
|
||||||
++p)
|
++p)
|
||||||
@ -1462,8 +1467,13 @@ Layout::find_first_load_seg()
|
|||||||
&& ((*p)->flags() & elfcpp::PF_R) != 0
|
&& ((*p)->flags() & elfcpp::PF_R) != 0
|
||||||
&& (parameters->options().omagic()
|
&& (parameters->options().omagic()
|
||||||
|| ((*p)->flags() & elfcpp::PF_W) == 0))
|
|| ((*p)->flags() & elfcpp::PF_W) == 0))
|
||||||
return *p;
|
{
|
||||||
|
if (best == NULL || this->segment_precedes(*p, best))
|
||||||
|
best = *p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (best != NULL)
|
||||||
|
return best;
|
||||||
|
|
||||||
gold_assert(!this->script_options_->saw_phdrs_clause());
|
gold_assert(!this->script_options_->saw_phdrs_clause());
|
||||||
|
|
||||||
|
@ -808,6 +808,10 @@ class General_options
|
|||||||
N_(" Only search directories specified on the command line."),
|
N_(" Only search directories specified on the command line."),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
DEFINE_bool(rosegment, options::TWO_DASHES, '\0', false,
|
||||||
|
N_(" Put read-only non-executable sections in their own segment"),
|
||||||
|
NULL);
|
||||||
|
|
||||||
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
|
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
|
||||||
N_("Ignored for compatibility"), N_("EMULATION"));
|
N_("Ignored for compatibility"), N_("EMULATION"));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user