Fix ld/418
Richard Sandiford
rsandifo@redhat.com
Wed Oct 13 21:48:00 GMT 2004
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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.s
URL: <https://sourceware.org/pipermail/binutils/attachments/20041013/76e38405/attachment.ksh>
More information about the Binutils
mailing list