public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* dwarf2 and linker relaxation problem
@ 2005-09-01 16:36 Dmitry Diky
  2005-09-01 17:48 ` Ian Lance Taylor
  0 siblings, 1 reply; 23+ messages in thread
From: Dmitry Diky @ 2005-09-01 16:36 UTC (permalink / raw)
  To: binutils

Fellows,
I am experiencing some problems with keeping dwarf2 info intact after linker 
relaxation. So, if linker relax section, the line info references are shifted 
by the number of deleted bytes. 
Is there any example which shows how to fix this problem?

Thanks,

Dmitry.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-01 16:36 dwarf2 and linker relaxation problem Dmitry Diky
@ 2005-09-01 17:48 ` Ian Lance Taylor
  2005-09-01 23:30   ` Jim Blandy
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-01 17:48 UTC (permalink / raw)
  To: ddiky; +Cc: binutils

Dmitry Diky <ddiky@alarity.com> writes:

> I am experiencing some problems with keeping dwarf2 info intact after linker 
> relaxation. So, if linker relax section, the line info references are shifted 
> by the number of deleted bytes. 
> Is there any example which shows how to fix this problem?

I believe this works on the SH.  See sh_elf_relax_delete_bytes in
elf32-sh.c.

Ian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-01 17:48 ` Ian Lance Taylor
@ 2005-09-01 23:30   ` Jim Blandy
  2005-09-02  2:51     ` Ian Lance Taylor
  0 siblings, 1 reply; 23+ messages in thread
From: Jim Blandy @ 2005-09-01 23:30 UTC (permalink / raw)
  To: binutils; +Cc: ddiky


Ian Lance Taylor <ian@airs.com> writes:
> Dmitry Diky <ddiky@alarity.com> writes:
>
>> I am experiencing some problems with keeping dwarf2 info intact after linker 
>> relaxation. So, if linker relax section, the line info references are shifted 
>> by the number of deleted bytes. 
>> Is there any example which shows how to fix this problem?
>
> I believe this works on the SH.  See sh_elf_relax_delete_bytes in
> elf32-sh.c.

Which part of that affects the .debug_line sections?

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-01 23:30   ` Jim Blandy
@ 2005-09-02  2:51     ` Ian Lance Taylor
  2005-09-02  7:44       ` Dmitry Diky
  2005-09-06 19:32       ` Jim Blandy
  0 siblings, 2 replies; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-02  2:51 UTC (permalink / raw)
  To: Jim Blandy; +Cc: binutils, ddiky

Jim Blandy <jimb@redhat.com> writes:

> Ian Lance Taylor <ian@airs.com> writes:
> > Dmitry Diky <ddiky@alarity.com> writes:
> >
> >> I am experiencing some problems with keeping dwarf2 info intact after linker 
> >> relaxation. So, if linker relax section, the line info references are shifted 
> >> by the number of deleted bytes. 
> >> Is there any example which shows how to fix this problem?
> >
> > I believe this works on the SH.  See sh_elf_relax_delete_bytes in
> > elf32-sh.c.
> 
> Which part of that affects the .debug_line sections?

The part that handles the R_SH_SWITCH* relocs.

Not that I've checked it, but that's the right place to look.

Ian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  2:51     ` Ian Lance Taylor
@ 2005-09-02  7:44       ` Dmitry Diky
  2005-09-02  8:43         ` Nick Clifton
                           ` (2 more replies)
  2005-09-06 19:32       ` Jim Blandy
  1 sibling, 3 replies; 23+ messages in thread
From: Dmitry Diky @ 2005-09-02  7:44 UTC (permalink / raw)
  To: binutils, jimb

Ian,

Thanks for this.

> The part that handles the R_SH_SWITCH* relocs.

I checked this twice and it seems that this approach does not work for me.
As I see from .debug_info and .debug_line sections contents they have no 
symbols referenced by .text (for example) section content.
So, the question is - how to hook on 'something' in dw2 sections to adjust 
relaxed references?

Dmitry.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  7:44       ` Dmitry Diky
@ 2005-09-02  8:43         ` Nick Clifton
  2005-09-02  9:28           ` Dmitry Diky
  2005-09-02 16:52         ` Hans-Peter Nilsson
  2005-09-02 17:23         ` Ian Lance Taylor
  2 siblings, 1 reply; 23+ messages in thread
From: Nick Clifton @ 2005-09-02  8:43 UTC (permalink / raw)
  To: ddiky; +Cc: binutils, jimb

Hi Dmitry,

> So, the question is - how to hook on 'something' in dw2 sections to adjust 
> relaxed references?

Why not do what sh_elf_relax_delete_bytes() does ?  Scan through the 
sections attached to the bfd and look for dwarf2 sections which might 
contain references into the relaxed section ?

Cheers
   Nick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  8:43         ` Nick Clifton
@ 2005-09-02  9:28           ` Dmitry Diky
  2005-09-02  9:35             ` Dmitry Diky
  2005-09-02  9:58             ` Nick Clifton
  0 siblings, 2 replies; 23+ messages in thread
From: Dmitry Diky @ 2005-09-02  9:28 UTC (permalink / raw)
  To: binutils; +Cc: Nick Clifton, binutils, jimb

Hi Nick,
> Why not do what sh_elf_relax_delete_bytes() does ?  Scan through the
> sections attached to the bfd and look for dwarf2 sections which might
> contain references into the relaxed section ?

Yes, I do this. But it seems that dwarf2 sections do not contain any 
references into relaxed sections. Well, yes, it does contain a reference to 
'.text' , but i cannot find any references to, say, linenumbers.

Cheers,
Dmitry.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  9:28           ` Dmitry Diky
@ 2005-09-02  9:35             ` Dmitry Diky
  2005-09-02  9:58             ` Nick Clifton
  1 sibling, 0 replies; 23+ messages in thread
From: Dmitry Diky @ 2005-09-02  9:35 UTC (permalink / raw)
  To: binutils; +Cc: Nick Clifton, binutils, jimb

Hi Nick,
> Why not do what sh_elf_relax_delete_bytes() does ?  Scan through the
> sections attached to the bfd and look for dwarf2 sections which might
> contain references into the relaxed section ?

Yes, I do this. But it seems that dwarf2 sections do not contain any 
references into relaxed sections. Well, yes, it does contain a reference to 
'.text' , but i cannot find any references to, say, linenumbers.

Cheers,
Dmitry.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  9:28           ` Dmitry Diky
  2005-09-02  9:35             ` Dmitry Diky
@ 2005-09-02  9:58             ` Nick Clifton
  2005-09-02 11:17               ` Nick Clifton
  1 sibling, 1 reply; 23+ messages in thread
From: Nick Clifton @ 2005-09-02  9:58 UTC (permalink / raw)
  To: ddiky; +Cc: binutils, binutils, jimb

Hi Dmitry,

> Yes, I do this. But it seems that dwarf2 sections do not contain any 
> references into relaxed sections. Well, yes, it does contain a reference to 
> '.text' , but i cannot find any references to, say, linenumbers.

I think that you may have to parse the contents of the dwarf2 sections 
in order to locate the address-to-linenumber references and then adjust 
them by hand.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  9:58             ` Nick Clifton
@ 2005-09-02 11:17               ` Nick Clifton
  0 siblings, 0 replies; 23+ messages in thread
From: Nick Clifton @ 2005-09-02 11:17 UTC (permalink / raw)
  To: ddiky; +Cc: binutils, binutils, jimb

Hi Dmitry,

> Yes, I do this. But it seems that dwarf2 sections do not contain any 
> references into relaxed sections. Well, yes, it does contain a reference to 
> '.text' , but i cannot find any references to, say, linenumbers.

I think that you may have to parse the contents of the dwarf2 sections 
in order to locate the address-to-linenumber references and then adjust 
them by hand.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  7:44       ` Dmitry Diky
  2005-09-02  8:43         ` Nick Clifton
@ 2005-09-02 16:52         ` Hans-Peter Nilsson
  2005-09-02 17:02           ` Dmitry Diky
  2005-09-02 17:23         ` Ian Lance Taylor
  2 siblings, 1 reply; 23+ messages in thread
From: Hans-Peter Nilsson @ 2005-09-02 16:52 UTC (permalink / raw)
  To: Dmitry Diky; +Cc: binutils

On Fri, 2 Sep 2005, Dmitry Diky wrote:
> So, the question is - how to hook on 'something' in dw2 sections to adjust
> relaxed references?

Maybe it's obvious, but I'd check that the assembler doesn't
resolve PC-relative references (i.e. make sure that it emits
relocs for them) when linker relaxation is wanted, for
applicable cases.

brgds, H-P

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 16:52         ` Hans-Peter Nilsson
@ 2005-09-02 17:02           ` Dmitry Diky
  2005-09-02 18:42             ` Hans-Peter Nilsson
  0 siblings, 1 reply; 23+ messages in thread
From: Dmitry Diky @ 2005-09-02 17:02 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

I do not delete any relocations until linker.
The linker itself does not reloc much in debug sections.
That's why I'm puzzled.

Dmitry.

On Friday 02 September 2005 20:04, Hans-Peter Nilsson wrote:
> On Fri, 2 Sep 2005, Dmitry Diky wrote:
> > So, the question is - how to hook on 'something' in dw2 sections to
> > adjust relaxed references?
>
> Maybe it's obvious, but I'd check that the assembler doesn't
> resolve PC-relative references (i.e. make sure that it emits
> relocs for them) when linker relaxation is wanted, for
> applicable cases.
>
> brgds, H-P

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  7:44       ` Dmitry Diky
  2005-09-02  8:43         ` Nick Clifton
  2005-09-02 16:52         ` Hans-Peter Nilsson
@ 2005-09-02 17:23         ` Ian Lance Taylor
  2 siblings, 0 replies; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-02 17:23 UTC (permalink / raw)
  To: ddiky; +Cc: binutils, jimb

Dmitry Diky <ddiky@alarity.com> writes:

> > The part that handles the R_SH_SWITCH* relocs.
> 
> I checked this twice and it seems that this approach does not work for me.
> As I see from .debug_info and .debug_line sections contents they have no 
> symbols referenced by .text (for example) section content.
> So, the question is - how to hook on 'something' in dw2 sections to adjust 
> relaxed references?

The SH assembler explicitly emits relocs which are only required for
relaxation.  For example, for
    .word foo - bar
it will emit a reloc, even when the value can be resolved in the
assembler.  This exposes the information to the relaxation code.

Ian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 17:02           ` Dmitry Diky
@ 2005-09-02 18:42             ` Hans-Peter Nilsson
  2005-09-02 18:53               ` Dmitry Diky
  2005-09-02 21:27               ` Richard Henderson
  0 siblings, 2 replies; 23+ messages in thread
From: Hans-Peter Nilsson @ 2005-09-02 18:42 UTC (permalink / raw)
  To: Dmitry Diky; +Cc: binutils

On Fri, 2 Sep 2005, Dmitry Diky wrote:
> I do not delete any relocations until linker.

I don't know how to put it clearer than with Ian's example.  If
the assembler doesn't emit a relocation for those expressions,
linker relaxation will not work, unless the linker actually
parses the format of the data in that section.

> The linker itself does not reloc much in debug sections.

Seems like a clue that the assembler didn't emit relocations
where it must, for linker relaxation.

brgds, H-P

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 18:42             ` Hans-Peter Nilsson
@ 2005-09-02 18:53               ` Dmitry Diky
  2005-09-02 19:21                 ` Ian Lance Taylor
  2005-09-02 21:27               ` Richard Henderson
  1 sibling, 1 reply; 23+ messages in thread
From: Dmitry Diky @ 2005-09-02 18:53 UTC (permalink / raw)
  To: binutils

That's right.

> Seems like a clue that the assembler didn't emit relocations
> where it must, for linker relaxation.

But when I want to emit a debug info for relaxable fragment I just call 
	dwarf2_emit_insn(0);
Then I call frag_var(...), etc.
I do not relax in assembler cause it may be a source of some error and relax 
in linker. In there I adjust any symbols referenced into relaxable sections 
and I do not see any symbols addresses into relaxable section from debug 
section. So then question is: how to force dwarf2 debug info make a footprint 
in debuggable section?

Thanks,
Dmitry.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 18:53               ` Dmitry Diky
@ 2005-09-02 19:21                 ` Ian Lance Taylor
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-02 19:21 UTC (permalink / raw)
  To: ddiky; +Cc: binutils

Dmitry Diky <ddiky@alarity.com> writes:

> That's right.
> 
> > Seems like a clue that the assembler didn't emit relocations
> > where it must, for linker relaxation.
> 
> But when I want to emit a debug info for relaxable fragment I just call 
> 	dwarf2_emit_insn(0);
> Then I call frag_var(...), etc.
> I do not relax in assembler cause it may be a source of some error and relax 
> in linker. In there I adjust any symbols referenced into relaxable sections 
> and I do not see any symbols addresses into relaxable section from debug 
> section. So then question is: how to force dwarf2 debug info make a footprint 
> in debuggable section?

Look at gas/tc-sh.[ch].  In particular TC_FORCE_RELOCATION_SUB_LOCAL
and TC_FORCE_RELOCATION_LOCAL.  And in general any use of the global
variable sh_relax.

Ian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 18:42             ` Hans-Peter Nilsson
  2005-09-02 18:53               ` Dmitry Diky
@ 2005-09-02 21:27               ` Richard Henderson
  2005-09-03  4:35                 ` Ian Lance Taylor
  1 sibling, 1 reply; 23+ messages in thread
From: Richard Henderson @ 2005-09-02 21:27 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Dmitry Diky, binutils

On Fri, Sep 02, 2005 at 01:09:27PM -0400, Hans-Peter Nilsson wrote:
> Seems like a clue that the assembler didn't emit relocations
> where it must, for linker relaxation.

There are no relocations possible here.  The linker will have to
completely parse and re-emit the .debug_line section, the 
.debug_frame section, and the .eh_frame section.

Which is why several targets do *not* delete instructions during
relaxation, and instead only replace with nops.


r~

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02 21:27               ` Richard Henderson
@ 2005-09-03  4:35                 ` Ian Lance Taylor
  2005-09-05 21:47                   ` Dmitry Diky
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-03  4:35 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Hans-Peter Nilsson, Dmitry Diky, binutils

Richard Henderson <rth@redhat.com> writes:

> On Fri, Sep 02, 2005 at 01:09:27PM -0400, Hans-Peter Nilsson wrote:
> > Seems like a clue that the assembler didn't emit relocations
> > where it must, for linker relaxation.
> 
> There are no relocations possible here.  The linker will have to
> completely parse and re-emit the .debug_line section, the 
> .debug_frame section, and the .eh_frame section.

Well, no, relocations are possible, but you do generally need to
define new relocation types, and you need to force the assembler to
generate them.

SH ELF has nine relocation types which exist only for relaxation
purposes (R_SH_SWITCH8 through R_SH_LABEL).

Ian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-03  4:35                 ` Ian Lance Taylor
@ 2005-09-05 21:47                   ` Dmitry Diky
  0 siblings, 0 replies; 23+ messages in thread
From: Dmitry Diky @ 2005-09-05 21:47 UTC (permalink / raw)
  To: hp, binutils, rth

Ian,
I have checked sh_elf_relax_delete_bytes() in elf32-sh.c file.
It seems that relaxation does not touch .debug_line section at all, cause 
there are no references from .debug_line section into debuggable .text 
section. Also, as it seems to me, dwarf2 generator does not emit something 
like '.word .l1 - .l2' in executable section suitable for further relocation 
by linker. Am I correct?

Thanks,
Dmitry.

> > There are no relocations possible here.  The linker will have to
> > completely parse and re-emit the .debug_line section, the
> > .debug_frame section, and the .eh_frame section.
>
> Well, no, relocations are possible, but you do generally need to
> define new relocation types, and you need to force the assembler to
> generate them.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-02  2:51     ` Ian Lance Taylor
  2005-09-02  7:44       ` Dmitry Diky
@ 2005-09-06 19:32       ` Jim Blandy
  2005-09-06 20:15         ` Ian Lance Taylor
  1 sibling, 1 reply; 23+ messages in thread
From: Jim Blandy @ 2005-09-06 19:32 UTC (permalink / raw)
  To: binutils; +Cc: ddiky


Ian Lance Taylor <ian@airs.com> writes:
> Jim Blandy <jimb@redhat.com> writes:
>> Ian Lance Taylor <ian@airs.com> writes:
>> > Dmitry Diky <ddiky@alarity.com> writes:
>> >> I am experiencing some problems with keeping dwarf2 info intact after linker 
>> >> relaxation. So, if linker relax section, the line info references are shifted 
>> >> by the number of deleted bytes. 
>> >> Is there any example which shows how to fix this problem?
>> >
>> > I believe this works on the SH.  See sh_elf_relax_delete_bytes in
>> > elf32-sh.c.
>> 
>> Which part of that affects the .debug_line sections?
>
> The part that handles the R_SH_SWITCH* relocs.
>
> Not that I've checked it, but that's the right place to look.

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.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-06 19:32       ` Jim Blandy
@ 2005-09-06 20:15         ` Ian Lance Taylor
  2005-09-07 11:39           ` Dmitry Diky
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Lance Taylor @ 2005-09-06 20:15 UTC (permalink / raw)
  To: Jim Blandy; +Cc: binutils, ddiky

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-06 20:15         ` Ian Lance Taylor
@ 2005-09-07 11:39           ` Dmitry Diky
  2005-09-07 18:11             ` Richard Henderson
  0 siblings, 1 reply; 23+ messages in thread
From: Dmitry Diky @ 2005-09-07 11:39 UTC (permalink / raw)
  To: binutils, jimb


> > 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.
>

So, it seems tha only one opcode/line advance should be changed in .debug_line 
in case of relaxation. Namely (for my target): 
  Special opcode 35: advance Address by 2 to 0x48140014 and Line by 2 to 18
  Special opcode 35: advance Address by 2 to 0x48140016 and Line by 2 to 20
  Special opcode 90: advance Address by 6 to 0x4814001c and Line by 1 to 21  
<- relaxed insn is here.
  Special opcode 34: advance Address by 2 to 0x4814001e and Line by 1 to 22
  Special opcode 34: advance Address by 2 to 0x48140020 and Line by 1 to 23
 
So, if the code 90 will be changed properly, everything should be Ok. Am I 
correct?

Cheers,
Dmitry.


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: dwarf2 and linker relaxation problem
  2005-09-07 11:39           ` Dmitry Diky
@ 2005-09-07 18:11             ` Richard Henderson
  0 siblings, 0 replies; 23+ messages in thread
From: Richard Henderson @ 2005-09-07 18:11 UTC (permalink / raw)
  To: Dmitry Diky; +Cc: binutils, jimb

On Wed, Sep 07, 2005 at 10:41:49AM +0400, Dmitry Diky wrote:
>   Special opcode 90: advance Address by 6 to 0x4814001c and Line by 1 to 21  
> <- relaxed insn is here.
>   Special opcode 34: advance Address by 2 to 0x4814001e and Line by 1 to 22
>  
> So, if the code 90 will be changed properly, everything should be Ok. Am I 
> correct?

From your picture I would have expected the following code 34 to change.

As long as the address displacement only decreases during relaxation, 
then you can find a replacement special opcode that will match the new
address displacement and the old line number displacement.

If your relaxation ever adds bytes, then the correction may need to add
new bytes to the .debug_line section to represent the change, at which
point you may have to re-encode the entire section.

If all of this is too difficult, then we can add an internal flag to the
assembler that limits the encoding of .debug_line to DW_LNS_fixed_advance_pc, 
which would involve a fixed length 16-bit displacement; presumably you
have a relocation for that.


r~

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2005-09-07 17:56 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-01 16:36 dwarf2 and linker relaxation problem Dmitry Diky
2005-09-01 17:48 ` Ian Lance Taylor
2005-09-01 23:30   ` Jim Blandy
2005-09-02  2:51     ` Ian Lance Taylor
2005-09-02  7:44       ` Dmitry Diky
2005-09-02  8:43         ` Nick Clifton
2005-09-02  9:28           ` Dmitry Diky
2005-09-02  9:35             ` Dmitry Diky
2005-09-02  9:58             ` Nick Clifton
2005-09-02 11:17               ` Nick Clifton
2005-09-02 16:52         ` Hans-Peter Nilsson
2005-09-02 17:02           ` Dmitry Diky
2005-09-02 18:42             ` Hans-Peter Nilsson
2005-09-02 18:53               ` Dmitry Diky
2005-09-02 19:21                 ` Ian Lance Taylor
2005-09-02 21:27               ` Richard Henderson
2005-09-03  4:35                 ` Ian Lance Taylor
2005-09-05 21:47                   ` Dmitry Diky
2005-09-02 17:23         ` Ian Lance Taylor
2005-09-06 19:32       ` Jim Blandy
2005-09-06 20:15         ` Ian Lance Taylor
2005-09-07 11:39           ` Dmitry Diky
2005-09-07 18:11             ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).