[all-commits] [llvm/llvm-project] ff6069: [JITLink] Add initial native TLS support to ELFNix...

luxufan via All-commits all-commits at lists.llvm.org
Sun Sep 12 23:36:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff6069b89114325b1904e55d3987701567d522d4
      https://github.com/llvm/llvm-project/commit/ff6069b89114325b1904e55d3987701567d522d4
  Author: luxufan <932494295 at qq.com>
  Date:   2021-09-13 (Mon, 13 Sep 2021)

  Changed paths:
    M compiler-rt/lib/orc/CMakeLists.txt
    M compiler-rt/lib/orc/elfnix_platform.cpp
    A compiler-rt/lib/orc/elfnix_tls.x86-64.S
    A compiler-rt/test/orc/TestCases/FreeBSD/x86-64/trivial-tls.S
    A compiler-rt/test/orc/TestCases/Linux/x86-64/trivial-tls.S
    M llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
    M llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h
    M llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
    M llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    A llvm/lib/ExecutionEngine/JITLink/PerGraphTLSInfoEntryBuilder.h
    M llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp

  Log Message:
  -----------
  [JITLink] Add initial native TLS support to ELFNix platform

This patch use the same way as the https://reviews.llvm.org/rGfe1fa43f16beac1506a2e73a9f7b3c81179744eb to handle the thread local variable.

It allocates 2 * pointerSize space in GOT to represent the thread key and data address. Instead of using the _tls_get_addr function, I customed a function __orc_rt_elfnix_tls_get_addr to get the address of thread local varible. Currently, this is a wip patch, only one TLS relocation R_X86_64_TLSGD is supported and I need to add the corresponding test cases.

To allocate the TLS  descriptor in GOT, I need to get the edge kind information in PerGraphGOTAndPLTStubBuilder, So I add a `Edge::Kind K` argument in some functions in PerGraphGOTAndPLTStubBuilder.h. If it is not suitable, I can think further to solve this problem.

Differential Revision: https://reviews.llvm.org/D109293




More information about the All-commits mailing list