LTO vs. default section alignment vs. relocatable links.

Dave Korn dave.korn.cygwin@gmail.com
Tue Feb 1 22:27:00 GMT 2011


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



More information about the Binutils mailing list