[PATCH] [AArch64] fix PR22408: clang no longer bootstraps itself on AArch64 linux
Kristof Beyls
kristof.beyls at arm.com
Mon Feb 16 12:02:02 PST 2015
Hi t.p.northover,
This patch fixes PR22408.
As is described at http://llvm.org/bugs/show_bug.cgi?id=22408, the GNU linkers
ld.bfd and ld.gold currently only support a subset of the whole range of AArch64
ELF TLS relocations. Furthermore, they assume that some of the code sequences to
access thread-local variables are produced in a very specific sequence.
When the sequence is not as the linker expects, it can silently mis-relaxe/mis-optimize
the instructions.
Even if that wouldn't be the case, it's good to produce the exact sequence,
as that ensures that linkers can perform optimizing relaxations.
This patch:
* implements support for 16MiB TLS area size instead of 4GiB TLS area size.
Ideally clang would grow an -mtls-size option to allow support for both,
but that's not part of this patch.
* by default doesn't produce local dynamic access patterns, as even modern
ld.bfd and ld.gold linkers do not support the associated relocations.
An option (-aarch64-elf-ldtls-generation) is added to enable generation of
local dynamic code sequence, but is off by default.
Alternatively, I think that LLVM could fixup the local dynamic fixups
itself, instead of producing relocations leaving the work for the linker,
but that didn't seem straightforward to do.
* makes sure that the exact expected code sequence for local dynamic and
general dynamic accesses is produced, by making use of a new pseudo instruction.
The patch also removes two (AArch64ISD::TLSDESC_BLR, AArch64ISD::TLSDESC_CALL)
pre-existing AArch64-specific pseudo SDNode instructions
that are superseded by the new one (TLSDESC_CALLSEQ).
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7677
Files:
lib/Target/AArch64/AArch64AsmPrinter.cpp
lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/AArch64/AArch64ISelLowering.h
lib/Target/AArch64/AArch64InstrInfo.td
lib/Target/AArch64/AArch64MCInstLower.cpp
lib/Target/AArch64/Utils/AArch64BaseInfo.h
test/CodeGen/AArch64/arm64-tls-dynamics.ll
test/CodeGen/AArch64/arm64-tls-execs.ll
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7677.20044.patch
Type: text/x-patch
Size: 34799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150216/b07411e5/attachment.bin>
More information about the llvm-commits
mailing list