[ARM] Use hardware TLS register in Thumb2 mode when -mtp=cp15 is passed
authorArd Biesheuvel <ardb@google.com>
Wed, 27 Oct 2021 23:27:00 +0000 (16:27 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 27 Oct 2021 23:42:11 +0000 (16:42 -0700)
commitd7e089f2d6a5cd5f283a90ab29241d20d4fc3ed1
treea56983c115e8ea72b4de6112dc7cf34f3a06a440
parent33427fdb7b52b79ce5e25b7e14e0f1a44d876bd2
[ARM] Use hardware TLS register in Thumb2 mode when -mtp=cp15 is passed

In ARM mode, passing -mtp=cp15 forces the use of an inline MRC system register read to move the thread pointer value into a register.

Currently, in Thumb2 mode, -mtp=cp15 is ignored, and a call to the __aeabi_read_tp helper is emitted instead.

This is inconsistent, and breaks the Linux/ARM build for Thumb2 targets, as the Linux kernel does not provide an implementation of __aeabi_read_tp,.

Reviewed By: nickdesaulniers, peter.smith

Differential Revision: https://reviews.llvm.org/D112600
llvm/lib/Target/ARM/ARMInstrThumb.td
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/test/CodeGen/ARM/readtp.ll
llvm/test/CodeGen/ARM/thread_pointer.ll