Aligning .text segments

Cary Coutant ccoutant@google.com
Tue Dec 23 18:36:00 GMT 2014


> Also - this script is just a fragment - a full script would also need to
> specify the locations of other sections like .data, .bss and so on. Your
> best bet is to take the linker's builtin default script (shown when you run
> "gold --verbose") and modify that to suit your needs.

Gold doesn't use a default linker script, so gold --verbose won't
help. In gold, linker scripts are really meant for full-on embedded
applications where you really want full control over the placement of
everything, and you're responsible for making sure the script handles
all the various input sections that the linker might see. It's
possible that you could print BFD ld's default linker script and use
that with gold, but it seems like an extremely heavy-weight solution.

To set the alignment for individual functions, I think you'd be better
off using __attribute__ ((aligned (n))) in the source code.

-cary



More information about the Binutils mailing list