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: dwarf2 and linker relaxation problem


Jim Blandy <jimb@redhat.com> writes:

> These days the assembler produces .debug_line sections that use the
> Dwarf special opcodes:
> 
>     $ readelf -wl bfd/archive.o
>     ...
>      Line Number Statements:
>       Extended opcode 2: set Address to 0x0
>       Advance Line by 161 to 162
>       Copy
>       Special opcode 92: advance Address by 6 to 0x6 and Line by 3 to 165
>       Advance PC by constant 17 to 0x17
>       Special opcode 62: advance Address by 4 to 0x1b and Line by 1 to 166
>       Advance PC by constant 17 to 0x2c
>     ...
>     $
> 
> If the linker changes the length of an instruction between 0 and 6,
> say, then that Dwarf special opcode needs to be changed.  I don't see
> how any existing SH reloc could be shoehorned into fixing that.  And
> then, since the special opcodes only have limited ranges, a relaxation
> could require you to switch from a special opcode to something more
> general, like a DW_LNS_advance_pc.
> 
> This is why, as Richard says, in order to do relaxation in the
> presence of modern Dwarf line info, the linker needs to read the line
> number info, do the relaxations while adjusting the machine / source
> mapping as needed, and then re-emit the line number info.
> 
> I didn't see anything to do this in the BFD code --- thus my question.

I see.  I did forget about those kinds of things.  You're right, this
will require some extra relaxation code to handle DWARF line
information.

Or I suppose one could change the assembler to avoid using the special
opcodes when relaxing, and to always use an absolute address.

Sorry for the misdirection.

Ian


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