[PATCH] D105466: [RuntimeDyld] Implemented relocation of TLS symbols in ELF

Moritz Sichert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 01:39:49 PST 2021


MoritzS added a comment.

In D105466#3107759 <https://reviews.llvm.org/D105466#3107759>, @brad wrote:

> This commit appears to have broken the build on OpenBSD..
>
> ld: error: undefined symbol: LLVMRTDyldTLSSpace
>
>>>> referenced by llvm-rtdyld.cpp:372 (/home/brad/llvm/llvm-new/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp:372)

This symbol is only used when `defined(__x86_64__) && defined(__ELF__)` is true. The definition looks like this:

  extern "C" {
  alignas(16) __attribute__((visibility("hidden"), tls_model("initial-exec"),
                             used)) thread_local char LLVMRTDyldTLSSpace[16];
  }

And the symbol is then directly referenced from inline assembly like this:

  asm("leaq LLVMRTDyldTLSSpace at tpoff, %0" : "=r"(TLSOffset));

Does thread-local storage in ELF work differently on OpenBSD than it does on Linux? Is there an easy way to fix it or should I try to ifdef this out for OpenBSD?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105466/new/

https://reviews.llvm.org/D105466



More information about the llvm-commits mailing list