Relaxation and .debug_loc section

Michael Eager
Sun Jul 15 02:45:00 GMT 2007

Daniel Jacobowitz wrote:
> On Sat, Jul 14, 2007 at 08:59:41AM -0700, Michael Eager wrote:
>> Andreas Schwab wrote:
>>> Michael Eager <> writes:
>>>> When the relaxation pass shrinks the code, these offsets
>>>> point to the wrong locations.  I've looked through other
>>>> targets to see if there is anything which looks like it
>>>> fixes up the .debug_loc section after relaxation, but
>>>> I haven't found anything.
>>> I think if you want to do linker relaxing you have to tell the assembler
>>> not to resolve such relocations.
>> There's no way to do that.   The offsets are simple expressions.
>> The assembler converts them to integer values.
> I'm pretty sure there is.  Did you look at the macros Alan suggested?
> It looks like only Xtensa relaxes debug info sections, juudging from
> the TC_LINKRELAX_FIXUP definition.

.debug_info section has relocations.  .debug_loc doesn't.
It's not hard to fix up the .debug_info references.

In any event, I've written code which fixes the .debug_loc offsets
without generating additional relocation entries.

Unfortunately, it's in a proprietary target.  I don't currently
have permission to submit patches to the open source repository.
I have an agreement in principle to submit the target in the future,
unless, of course, the current discussion about GPLv2 vs GPLv3
licensing on the GCC mailing list has the fallout of the client
deciding otherwise.

Michael Eager
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

More information about the Binutils mailing list