This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to control segments ?
- From: Sterling Augustine <sterling at tensilica dot com>
- To: binutils at sourceware dot org
- Cc: dongphuong2410 at yahoo dot com
- Date: Tue, 02 Dec 2008 09:14:06 -0800
- Subject: Re: How to control segments ?
- References: <1228208609.15508.ezmlm@sourceware.org>
> I've asked this question on the gcc-mailing list,
> and one adviced me to use "linker relaxation". But
> I don't know how to implement linker relaxation
> in Binutils.
> Could you give me some hints for this ?
This is somewhat similar to the Xtensa feature of assembler longcalls
and linker optimization.
It works like this:
In the assembler a short-call with destination not provably in range
(eg, in a different section) is changed to a constant-load, long-call.
These long-call sequences are marked by a relocation.
The linker, when it finally has knowledge of everything's address, then
scans through the marked long-calls, switching everything in range back
to a nop + short-call. Finally, some of these nops are removed (that
part is very tricky due to .align and .org and related. Do that part last.)
Have a look at gas/config/tc-xtensa.c. And then at bfd/elf32xtensa.c.
Search for longcalls.
Hope this helps.
Sterling