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: RFH: MIPS ld breaking .eh_frame data ...


On Tue, Sep 26, 2006 at 08:43:46AM -0400, Daniel Jacobowitz wrote:
> > That is really needed as a first step.  The 4.1/4.2 change not only
> > broke MIPS, but all other ELF arches as well, glibc is broken by
> > this and dozens of other libraries.
> 
> He's done this already, I think.

All I saw http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00737.html,
but not actual patch.

>  But could you explain how glibc is
> "broken" by this?  I'm quite curious now.

A typical FDE looks like this:

00000548 0000002c 0000004c FDE cie=00000500 pc=00101fd0..00102077
  DW_CFA_set_loc: 00101e22
  DW_CFA_def_cfa_offset: 16
  DW_CFA_advance_loc: 2 to 00101e24
  DW_CFA_def_cfa_offset: 24
  DW_CFA_advance_loc: 1 to 00101e25
  DW_CFA_def_cfa_offset: 32
  DW_CFA_offset: r6 at cfa-32
  DW_CFA_offset: r12 at cfa-24
  DW_CFA_offset: r13 at cfa-16
  DW_CFA_advance_loc: 4 to 00101e29
  DW_CFA_def_cfa_offset: 40
  DW_CFA_advance_loc: 4 to 00101e2d
  DW_CFA_def_cfa_offset: 48
  DW_CFA_offset: r3 at cfa-40
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

0000000000101fd0 <free_derivation>:
  101fd0:       41 55                   push   %r13
  101fd2:       41 54                   push   %r12
  101fd4:       55                      push   %rbp
  101fd5:       48 89 fd                mov    %rdi,%rbp
  101fd8:       53                      push   %rbx
  101fd9:       48 83 ec 08             sub    $0x8,%rsp
  101fdd:       48 83 7f 18 00          cmpq   $0x0,0x18(%rdi)
  101fe2:       74 4e                   je     102032  <__start___libc_freeres_fn+0x62>
  101fe4:       45 31 ed                xor    %r13d,%r13d
...

while DW_CFA_set_loc was supposed to change to 00101fd2.
In this case (the more lucky) it just means that all the CFA
ops are executed for all instructions in the routine, so if
you e.g. are somewhere in the prologue, it will read saved
registers from stack slots where they haven't been saved already.
Now if there is some DW_CFA_restore somewhere among the insns
etc., the breakage won't be limited to the prologue.
Or if DW_CFA_set_loc happens to be larger than it ought to be
(though not sure how often that happens).

	Jakub


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