[PATCH] D151335: [AIX][TLS] Generate .extern and .ref references to __tls_get_addr for local-exec accesses.

Amy Kwan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 06:48:16 PDT 2023


amyk created this revision.
amyk added reviewers: power-llvm-team, PowerPC, stefanp, kamaub, nemanjai, hubert.reinterpretcast, daltenty, sfertile.
amyk added a project: PowerPC.
Herald added a subscriber: hiraditya.
Herald added a project: All.
amyk requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Compiling with TLS variables requires `-pthread`, but if the user omits this option, the
compiler will not show any obvious indication during compilation that `-pthread` is
needed for programs using TLS variables. Instead, the user will experience a segmentation
fault when running programs with TLS variables in them and without specifying `-pthread`.

This patch aims to generate `.extern`/`.ref` references to `__tls_get_addr[DS]` for local-exec
accesses, in order to trigger an error from the linker to indicate that there is an undefined
symbol to `__tls_get_addr`. Doing so will remind the user to compile/link with `-pthread`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151335

Files:
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-tls-le-ldst-double.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-ldst-float.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-ldst-int.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-ldst-longlong.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151335.525153.patch
Type: text/x-patch
Size: 39369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/aab4bf26/attachment.bin>


More information about the llvm-commits mailing list