How to control segments ?

Sterling Augustine sterling@tensilica.com
Tue Dec 2 17:14:00 GMT 2008
 > 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



More information about the Binutils mailing list