[all-commits] [llvm/llvm-project] aa4cb0: [Driver, CodeGen] Support -mtls-dialect= (#79256)

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jan 26 19:51:39 PST 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: aa4cb0e313a621bb9c2e5849de82684ed3c73c29
      https://github.com/llvm/llvm-project/commit/aa4cb0e313a621bb9c2e5849de82684ed3c73c29
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-01-26 (Fri, 26 Jan 2024)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.h
    A clang/test/CodeGen/RISCV/tls-dialect.c
    A clang/test/Driver/tls-dialect.c
    M llvm/include/llvm/TargetParser/Triple.h

  Log Message:
  -----------
  [Driver,CodeGen] Support -mtls-dialect= (#79256)

GCC supports -mtls-dialect= for several architectures to select TLSDESC.
This patch supports the following values

* x86: "gnu". "gnu2" (TLSDESC) is not supported yet.
* RISC-V: "trad" (general dynamic), "desc" (TLSDESC, see #66915)

AArch64 toolchains seem to support TLSDESC from the beginning, and the
general dynamic model has poor support. Nobody seems to use the option
-mtls-dialect= at all, so we don't bother with it.
There also seems very little interest in AArch32's TLSDESC support.

TLSDESC does not change IR, but affects object file generation. Without
a backend option the option is a no-op for in-process ThinLTO.

There seems no motivation to have fine-grained control mixing trad/desc
for TLS, so we just pass -mllvm, and don't bother with a modules flag
metadata or function attribute.

Co-authored-by: Paul Kirth <paulkirth at google.com>
(cherry picked from commit 36b4a9ccd9f7e04010476e6b2a311f2052a4ac20)




More information about the All-commits mailing list