From e98834c4711dd724f2a083351e11a7313b523f25 Mon Sep 17 00:00:00 2001 From: Fabroce de Gans Date: Wed, 10 Dec 2025 15:46:55 +0100 Subject: [PATCH 1/2] llvm: Add missing `LLVM_ABI` annotations This patch updates various LLVM headers to properly add the `LLVM_ABI` and `LLVM_ABI_FOR_TEST` annotations to build LLVM as a DLL on Windows. This effort is tracked in #109483. --- llvm/include/llvm/CodeGen/LibcallLoweringInfo.h | 2 +- llvm/include/llvm/SandboxIR/Constant.h | 2 +- llvm/include/llvm/Support/Hash.h | 7 ++++--- llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h b/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h index 3e0137710e8eb..13225c072cf78 100644 --- a/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h +++ b/llvm/include/llvm/CodeGen/LibcallLoweringInfo.h @@ -110,7 +110,7 @@ class LibcallLoweringModuleAnalysis : public AnalysisInfoMixin { private: friend AnalysisInfoMixin; - static AnalysisKey Key; + LLVM_ABI static AnalysisKey Key; LibcallLoweringModuleAnalysisResult LibcallLoweringMap; diff --git a/llvm/include/llvm/SandboxIR/Constant.h b/llvm/include/llvm/SandboxIR/Constant.h index 2fe923f6c3866..c9ceba2dabed3 100644 --- a/llvm/include/llvm/SandboxIR/Constant.h +++ b/llvm/include/llvm/SandboxIR/Constant.h @@ -1379,7 +1379,7 @@ class ConstantPtrAuth final : public Constant { /// the only global-initializer user of the ptrauth signed pointer. LLVM_ABI Constant *getAddrDiscriminator() const; - Constant *getDeactivationSymbol() const; + LLVM_ABI_FOR_TEST Constant *getDeactivationSymbol() const; /// Whether there is any non-null address discriminator. bool hasAddressDiscriminator() const { diff --git a/llvm/include/llvm/Support/Hash.h b/llvm/include/llvm/Support/Hash.h index bf98f0dcef836..7a2cfb8774ae8 100644 --- a/llvm/include/llvm/Support/Hash.h +++ b/llvm/include/llvm/Support/Hash.h @@ -22,14 +22,15 @@ enum class KCFIHashAlgorithm { xxHash64, FNV1a }; /// Parse a KCFI hash algorithm name. /// Returns xxHash64 if the name is not recognized. -KCFIHashAlgorithm parseKCFIHashAlgorithm(StringRef Name); +LLVM_ABI KCFIHashAlgorithm parseKCFIHashAlgorithm(StringRef Name); /// Convert a KCFI hash algorithm enum to its string representation. -StringRef stringifyKCFIHashAlgorithm(KCFIHashAlgorithm Algorithm); +LLVM_ABI StringRef stringifyKCFIHashAlgorithm(KCFIHashAlgorithm Algorithm); /// Compute KCFI type ID from mangled type name. /// The algorithm can be xxHash64 or FNV-1a. -uint32_t getKCFITypeID(StringRef MangledTypeName, KCFIHashAlgorithm Algorithm); +LLVM_ABI uint32_t getKCFITypeID(StringRef MangledTypeName, + KCFIHashAlgorithm Algorithm); } // end namespace llvm diff --git a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h index 2d25ce3245793..3d88df91c2da5 100644 --- a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h +++ b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h @@ -29,6 +29,7 @@ #include "llvm/IR/Instruction.h" #include "llvm/IR/ValueHandle.h" #include "llvm/IR/ValueMap.h" +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -342,7 +343,7 @@ class DbgValueRangeTable { DenseMap OrigSingleLocVariableValueTable; public: - void addVariable(Function *F, DebugVariableAggregate DVA); + LLVM_ABI_FOR_TEST void addVariable(Function *F, DebugVariableAggregate DVA); bool hasVariableEntry(DebugVariableAggregate DVA) const { return OrigVariableValueRangeTable.contains(DVA) || OrigSingleLocVariableValueTable.contains(DVA); From 68eea2971ef0bfe57bcea827c64a2b0efc3aa412 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Thu, 11 Dec 2025 12:59:33 -0500 Subject: [PATCH 2/2] Update llvm/include/llvm/SandboxIR/Constant.h Co-authored-by: Nikita Popov --- llvm/include/llvm/SandboxIR/Constant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/SandboxIR/Constant.h b/llvm/include/llvm/SandboxIR/Constant.h index c9ceba2dabed3..1925195b69e61 100644 --- a/llvm/include/llvm/SandboxIR/Constant.h +++ b/llvm/include/llvm/SandboxIR/Constant.h @@ -1379,7 +1379,7 @@ class ConstantPtrAuth final : public Constant { /// the only global-initializer user of the ptrauth signed pointer. LLVM_ABI Constant *getAddrDiscriminator() const; - LLVM_ABI_FOR_TEST Constant *getDeactivationSymbol() const; + LLVM_ABI Constant *getDeactivationSymbol() const; /// Whether there is any non-null address discriminator. bool hasAddressDiscriminator() const {