This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: LTO vs. default section alignment vs. relocatable links.
- From: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 01 Feb 2011 22:53:20 +0000
- Subject: Re: LTO vs. default section alignment vs. relocatable links.
- References: <4D487ED3.6010304@gmail.com> <20110201215548.GR9489@bubble.grove.modra.org>
On 01/02/2011 21:55, Alan Modra wrote:
> On Tue, Feb 01, 2011 at 09:44:51PM +0000, Dave Korn wrote:
>> Hi all,
>>
>> LTO IR sections need to have 1-byte alignment, and that is how we get them
>> from GAS. So far so good, but when we do a -r link of two object files, the
>> placement of the LTO sections is handle by orphan handling, since there aren't
>> any LTO section output statements in any of the default linker scripts (yet).
>>
>> In practice, this leads (at least on i686-pc-cygwin) to the sections being
>> placed after .rodata, and they get the default section alignment. That causes
>> their sizes to be rounded up to 4 with padding, which fatally confuses the
>> zlib decompressor in lto1 when we come to stream them back in later.
>
> This is a PE specific problem, isnt it?
>
> /* All sections in an executable must be aligned to a page boundary. */
> address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
> os = lang_insert_orphan (s, secname, constraint, after, place, address,
> &add_child);
>
> Fixable right there..
That's where I was looking, but I didn't know if ELF wouldn't also do the
same thing. Since HJ says it doesn't, that's definitely the right place to
fix it.
cheers,
DaveK