This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to control segments ?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]