[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOT
From: |
maskray at google dot com |
Subject: |
[Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt) |
Date: |
Sun, 14 Jul 2019 00:39:48 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=24784
--- Comment #5 from Fangrui Song <maskray at google dot com> ---
I don't see how this bug is "invalid". I've already worked around the bug in
clang, but I hope this hack can be deleted in a few years.
> g++ -fno-plt -fpic a.cc -Wa,-mrelax-relocations=no -fuse-ld=bfd
I mentioned the combination of -fno-plt and -Wa,-mrelax-relocations=no doesn't
work. So we have 3 resolutions:
1. Ignore it.
gcc -fno-plt -fpic -Wa,-mrelax-relocations=no has the linker error
2. Document in Chapter 11 Alternate Code Sequences For Security of x86-64
psABI,
call *__tls_get_addr@GOTPCREL(%rip)
must use R_X86_64_GOTPCRELX.
This kinda justifies 1., though it is not obvious why R_X86_64_GOTPCREL can't
be used.
3. One line change to bfd/elf-x86-64.c:elf_x86_64_check_tls_transition
- return r_type == R_X86_64_GOTPCRELX; // It should allow R_X86_64_GOTPCREL
+ return r_type == R_X86_64_GOTPCREL || r_type == R_X86_64_GOTPCRELX;
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9b3777ae068e67e08b27914abbab11297f1f8d1b
With 3, the `gcc -fno-plt -fpic -Wa,-mrelax-relocations=no` issue can be fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/24784] New: elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), maskray at google dot com, 2019/07/07
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), hjl.tools at gmail dot com, 2019/07/12
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), maskray at google dot com, 2019/07/12
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), maskray at google dot com, 2019/07/12
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), hjl.tools at gmail dot com, 2019/07/13
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt),
maskray at google dot com <=
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), hjl.tools at gmail dot com, 2019/07/15
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), maskray at google dot com, 2019/07/16
- [Bug ld/24784] elf_x86_64_check_tls_transition should allow R_X86_64_GOTPCREL (-fno-plt), hjl.tools at gmail dot com, 2019/07/16