LTO vs. default section alignment vs. relocatable links.

Alan Modra amodra@gmail.com
Tue Feb 1 21:56:00 GMT 2011


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..

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list