[Gold] Question about the incorrect variable alignment if the alignment is greater than the page size
Ian Lance Taylor
iant@google.com
Tue Jun 4 13:48:00 GMT 2013
On Tue, Jun 4, 2013 at 6:22 AM, Alexander Ivchenko <aivchenk@gmail.com> wrote:
> The attached patch fixes the problem. Also includes a testcase.
> All make check-gold test passes for me on x86_64-unknown-linux-gnu.
> - off = align_file_offset(off, addr, abi_pagesize);
> + {
> + // Taking care of the case when the maximum segment alignment
> + // is larger than the page size.
> + uint64_t align = ((*p)->maximum_alignment() < abi_pagesize
> + ? abi_pagesize
> + : (*p)->maximum_alignment());
> + off = align_file_offset(off, addr, align);
> + }
This is C++. It should work to simply do
off = align_file_offset(off, addr, std::max(abi_pagesize,
(*p)->maximum_alignment()));
In the test, I recommend that rather than using
large_symbol_alignment.sh you just write your main function to verify
that the symbols are correctly aligned. And put a space between the
right parenthesis and "int".
Thanks.
Ian
More information about the Binutils
mailing list