const bool check_sections = parameters->options().check_sections();
Output_segment* last_load_segment = NULL;
- bool was_readonly = false;
for (Segment_list::iterator p = this->segment_list_.begin();
p != this->segment_list_.end();
++p)
if (!are_addresses_set)
{
- // If the last segment was readonly, and this one is
- // not, then skip the address forward one page,
- // maintaining the same position within the page. This
- // lets us store both segments overlapping on a single
- // page in the file, but the loader will put them on
- // different pages in memory.
+ // Skip the address forward one page, maintaining the same
+ // position within the page. This lets us store both segments
+ // overlapping on a single page in the file, but the loader will
+ // put them on different pages in memory. We will revisit this
+ // decision once we know the size of the segment.
addr = align_address(addr, (*p)->maximum_alignment());
aligned_addr = addr;
- if (was_readonly && ((*p)->flags() & elfcpp::PF_W) != 0)
- {
- if ((addr & (abi_pagesize - 1)) != 0)
- addr = addr + abi_pagesize;
- }
+ if ((addr & (abi_pagesize - 1)) != 0)
+ addr = addr + abi_pagesize;
off = orig_off + ((addr - orig_addr) & (abi_pagesize - 1));
}
addr = new_addr;
- if (((*p)->flags() & elfcpp::PF_W) == 0)
- was_readonly = true;
-
// Implement --check-sections. We know that the segments
// are sorted by LMA.
if (check_sections && last_load_segment != NULL)