This is the mail archive of the binutils@sources.redhat.com 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: Fix ld/418


Hi Alan,

Alan Modra <amodra@bigpond.net.au> writes:
> 	* elf-bfd.h (struct eh_cie_fde): Add need_relative and
> 	need_lsda_relative.
> 	* elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Set
> 	need_relative or need_lsda_relative if we are processing an
> 	offset for a reloc on a FDE initial loc or LSDA field
> 	respectively.
> 	(_bfd_elf_write_section_eh_frame): Test need_relative and
> 	need_lsda_relative in place of corresponding make_* field
> 	when deciding to use pc-relative encodings.
>
> BTW, I haven't tested this very well yet, just binutils testsuite runs
> and checking that this cures the testcase.  I intend to build gcc and
> glibc overnight, and verify that it doesn't cause regressions before
> committing.

Sorry if I'm duplicating another report, but this patch breaks the frame
info on MIPS targets such as mips-sgi-irix6.5.  need_lsda_relative is only
set for FDEs:

  /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need
     for run-time relocation against LSDA field.  */
  if (sec_info->entry[mid].make_lsda_relative
      && ! sec_info->entry[mid].cie
      && (offset == (sec_info->entry[mid].offset + 8
		     + sec_info->entry[mid].lsda_offset)))
    {
      sec_info->entry[mid].need_lsda_relative = 1;
      return (bfd_vma) -2;
    }

and never for CIEs.  We'll therefore not update the CIE LSDA encoding
to match the new pc-relative LSDA fields.

You can duplicate this by configuring for mips-sgi-irix6.5 and doing:

    ./gas/as-new foo.s -o foo.o
    ./ld/ld-new foo.o -o foo.so -shared
    ./binutils/readelf -wf foo.so

00000000 00000018 00000000 CIE
  Version:               1
  Augmentation:          "zPL"
  Code alignment factor: 1
  Data alignment factor: 4
  Return address column: 31
  Augmentation data:     00 00 00 00 00 00
                                        ^^
                       DW_EH_absptr, should be DW_EH_pcrel

  DW_CFA_def_cfa: r29 ofs 0
  DW_CFA_nop
  DW_CFA_nop

0000001c 00000028 00000020 FDE cie=00000000 pc=5ffe04f0..5ffe05cc
  Augmentation data:     00 00 00 1b
                         ^^^^^^^^^^^
                         now PC-relative

  DW_CFA_advance_loc: 4 to 5ffe04f4
  DW_CFA_def_cfa_offset: 64
  DW_CFA_advance_loc: 16 to 5ffe0504
  DW_CFA_offset_extended_sf: r16 at cfa-32
  DW_CFA_offset_extended_sf: r28 at cfa-24
  DW_CFA_offset_extended_sf: r30 at cfa-16
  DW_CFA_offset_extended_sf: r31 at cfa-8
  DW_CFA_advance_loc: 4 to 5ffe0508
  DW_CFA_def_cfa: r30 ofs 64
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

Richard

Attachment: foo.s
Description: Binary data


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