This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Gold] Question about the incorrect variable alignment if the alignment is greater than the page size
- From: Ian Lance Taylor <iant at google dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Tue, 4 Jun 2013 06:48:44 -0700
- Subject: Re: [Gold] Question about the incorrect variable alignment if the alignment is greater than the page size
- References: <CACysShirkNk_oLSTqSWZ9-YThCb_Gx=0jC-_KPh8ZwkWjxHJkQ at mail dot gmail dot com> <CAKOQZ8xzLRdszqZQHVDLbTHu-hE63_82WekbUrBORBXEVkrvjg at mail dot gmail dot com> <CACysShipP91d92W3AH7MaLRXrDBEQ1en07DGpCgHEb1dF1nizA at mail dot gmail dot com>
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