[gold commit] Aligning segments in gold
Cary Coutant
ccoutant@google.com
Mon Jan 26 01:48:00 GMT 2015
>> The patch below appears to fix it (the first chunk is the actual fix;
>> the second chunk is just cleanup). Could you test it out before I
>> commit?
>
> Seems OK here.
Thanks, I've committed the patch.
> BTW, you need to invest in a better email client, or
> turn off line wrap and whitespace changes in the one you're using..
> patching file gold/output.cc
> patch: **** malformed patch at line 42: Target* target,
Sorry, gmail. Attaching the patch as committed.
-cary
-------------- next part --------------
2015-01-23 Cary Coutant <ccoutant@google.com>
gold/
* output.cc (Output_segment::set_section_addresses): Fix calculation
of size of relro segment.
diff --git a/gold/output.cc b/gold/output.cc
index 9a51131..e9dd522 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -4311,8 +4311,8 @@ Output_segment::set_section_addresses(const Target* target,
else
{
// FIXME: This could be faster.
- (*p)->set_address_and_file_offset(addr + relro_size,
- off + relro_size);
+ (*p)->set_address_and_file_offset(relro_size,
+ relro_size);
relro_size += (*p)->data_size();
(*p)->reset_address_and_file_offset();
}
@@ -4332,11 +4332,12 @@ Output_segment::set_section_addresses(const Target* target,
// Align to offset N such that (N + RELRO_SIZE) % PAGE_ALIGN == 0.
uint64_t desired_align = page_align - (aligned_size % page_align);
- if (desired_align < *poff % page_align)
- *poff += page_align - *poff % page_align;
- *poff += desired_align - *poff % page_align;
- addr += *poff - orig_off;
- orig_off = *poff;
+ if (desired_align < off % page_align)
+ off += page_align;
+ off += desired_align - off % page_align;
+ addr += off - orig_off;
+ orig_off = off;
+ *poff = off;
}
if (!reset && this->are_addresses_set_)
More information about the Binutils
mailing list