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,

You're going to hate me for this ;)

I've just had chance to try out the revised version of your patch.
It's causing problems on MIPS in situations where you link:

   ld first.o second.o -o foo.so -shared

and:

   - both first.o and second.o have .eh_frames

   - second.o's .eh_frame needs a dynamic relocation
     (such as for the personality routine)

   - the backend uses _bfd_elf_section_offset (and thus
     _bfd_elf_eh_frame_section_offset) when creating
     the dynamic relocation.

Before the patch, the input-section-to-output-section calculation
was local to _bfd_elf_write_section_eh_frame:

		  cie_offset = sec_info->entry[i].new_offset;
		  cie_offset += (sec_info->entry[i].sec->output_section->vma
				 + sec_info->entry[i].sec->output_offset
				 - sec->output_section->vma
				 - sec->output_offset);

so the sec_info offset fields were still relative to the
input section when the backend called _bfd_elf_section_offset.
They're now relative to the output section instead.

Should _bfd_elf_eh_frame_section_offset be modified to cope with
the adjusted offsets or should _bfd_elf_write_section_eh_frame
record the adjustments in a less destructive way?

FWIW, you can see the problem with the attached testcase.
Command lines:

      ./gas/as-new -KPIC test.s -o test.o
      ./ld/ld-new test.o test.o -o foo.so -shared

It fails on mips64-linux-gnu with:

./ld/ld-new: BFD 2.15.93 20041013 assertion fail .../bfd/elf-eh-frame.c:744
./ld/ld-new: BFD 2.15.93 20041013 assertion fail .../bfd/elf-eh-frame.c:744
./ld/ld-new: BFD 2.15.93 20041013 assertion fail .../bfd/elf-eh-frame.c:744

Richard

Attachment: test.s
Description: Text document


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