mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 03:44:59 +00:00
fb3c1b3de5
For x86-64, D33100 added a diagnostic for local-exec TLS relocations referencing a preemptible symbol. This patch generalizes it to non-preemptible symbols (see `-Bsymbolic` in `tls.s`) on all targets. Local-exec TLS relocations resolve to offsets relative to a fixed point within the static TLS block, which are only meaningful for the executable. With this change, `clang -fpic -shared -fuse-ld=bfd a.c` on the following example will be flagged for AArch64/ARM/i386/x86-64/RISC-V ``` static __attribute__((tls_model("local-exec"))) __thread long TlsVar = 42; long bump() { return ++TlsVar; } ``` Note, in GNU ld, at least arm, riscv and x86's ports have the similar diagnostics, but aarch64 and ppc64 do not error. Differential Revision: https://reviews.llvm.org/D93331
13 lines
437 B
ArmAsm
13 lines
437 B
ArmAsm
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model2.s -o %t.o
|
|
# RUN: ld.lld %t.o -o %t2 -shared
|
|
# RUN: llvm-readobj --dynamic-table %t2 | FileCheck %s
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model3.s -o %t.o
|
|
# RUN: ld.lld %t.o -o %t3 -shared
|
|
# RUN: llvm-readobj --dynamic-table %t3 | FileCheck %s
|
|
|
|
# CHECK: DynamicSection [
|
|
# CHECK: FLAGS STATIC_TLS
|