Relaxation and .debug_loc section

Bob Wilson bwilson@tensilica.com
Mon Jul 16 17:41:00 GMT 2007


Michael Eager wrote:
> There's no way to do that.   The offsets are simple expressions.
> The assembler converts them to integer values.

Getting the assembler to emit relocations is straightforward, but the default 
DWARF encoding for line numbers is not easily relaxable, at least if you have 
variable-size instructions.  The PC and line number offsets are encoded into a 
state machine, so that if the linker changes some offsets, it probably needs to 
reencode all the line number info.

Maybe there's some clever way out of that, but you might want to have a look at 
the DWARF2_USE_FIXED_ADVANCE_PC macro that I added for Xtensa.  It tells GAS to 
use DWARF's fixed_advance_pc opcodes -- they are not as compact as the default 
but you can put relocations on them so the linker can easily adjust them when 
relaxation changes offsets.

If you're ever able to contribute the code you wrote to have the linker do 
relaxation without all the relocations, I'd be quite interested to see it. 
We're just using lots of relocations for Xtensa, and so far it hasn't been an 
issue, but I'm curious to see how else you could do it.

--Bob



More information about the Binutils mailing list