This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Aligning .text segments
- From: Cary Coutant <ccoutant at google dot com>
- To: Nicholas Clifton <nickc at redhat dot com>
- Cc: K Jski <bielsk1 at vt dot edu>, Binutils <binutils at sourceware dot org>
- Date: Tue, 23 Dec 2014 10:35:54 -0800
- Subject: Re: Aligning .text segments
- Authentication-results: sourceware.org; auth=none
- References: <CAH=yU0a2YO7R-opvtu-zCNkWBhTDwhVcNywOwFkpC7ZSQ=DPsQ at mail dot gmail dot com> <54992BE4 dot 3090704 at redhat dot com>
> 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