Relocations to use when eliding plts
H.J. Lu
hjl.tools@gmail.com
Thu May 28 13:05:00 GMT 2015
On Wed, May 27, 2015 at 1:03 PM, Richard Henderson <rth@redhat.com> wrote:
> There's one problem with the couple of patches that I've seen go by wrt eliding
> PLTs with -z now, and relaxing inlined PLTs (aka -fno-plt):
>
> They're currently using the same relocations used by data, and thus the linker
> and dynamic linker must ensure that pointer equality is maintained. Which
> results in branch-to-branch-(to-branch) situations.
>
Your test exposed a linker bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=18458
I checked in this patch to fix it.
--
H.J.
--
When pointer equality needed, we can't replace PLT relocations with
GOT relocations for -z now. This patch checks if pointer equality is
needed before converting PLT relocations to GOT relocations.
bfd/
PR binutils/18458
* elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
for now binding only if pointer equality isn't needed.
(elf_i386_allocate_dynrelocs): Use .plt.got section for now
binding only if pointer equality isn't needed.
* elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
section for now binding only if pointer equality isn't needed.
(elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
binding only if pointer equality isn't needed.
ld/testsuite/
PR binutils/18458
* ld-elf/shared.exp (build_tests): Build libpr18458a.so and
libpr18458b.so.
(run_tests): Run pr18458 test.
* ld-elf/pr18458a.c: New file.
* ld-elf/pr18458b.c: Likewise.
* ld-elf/pr18458c.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Convert-PLT-reloc-only-if-pointer-equality-isn-t-nee.patch
Type: text/x-patch
Size: 6464 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150528/15b97ccf/attachment.bin>
More information about the Libc-alpha
mailing list