[llvm] [llvm-c] Add EmulatedTLS and EnableTLSDESC to LLVMTargetMachineOptions (PR #161155)

Julien Portalier via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 05:55:06 PDT 2025


================
@@ -40,6 +40,8 @@ struct LLVMTargetMachineOptions {
   std::optional<Reloc::Model> RM;
   std::optional<CodeModel::Model> CM;
   bool JIT;
+  bool EmulatedTLS;
+  bool EnableTLSDESC;
----------------
ysbaddaden wrote:

I investigated a bit: LLVMCreateTargetMachineWithOptions uses the default `llvm::TargetOptions` constructor that explicitly initializes both options to false already. Setting them again to false again is a NOOP.

I understand that the frontend is responsible to call hasDefaultEmulatedTLS or hasDefaultTLSDESC as a fallback value when unspecified. Clang appears to do that.

Now, I could change both options to be `std::optional` and have LLVMCreateTargetMachineWithOptions set the options when they have been explicit set, and fallback to hasDefaultEmulatedTLS and hasDefaultTLSDESC otherwise.

https://github.com/llvm/llvm-project/pull/161155


More information about the llvm-commits mailing list