[llvm] [llvm] Fix DEMANGLE_ABI for MinGW (PR #198288)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Mon May 18 05:46:08 PDT 2026
https://github.com/kito-cheng created https://github.com/llvm/llvm-project/pull/198288
Exclude MinGW from __declspec(dllimport) like LLVM_ABI in llvm/include/llvm/Support/Compiler.h does. MinGW auto-exports all DLL symbols, so __declspec is not needed and causes undefined __imp__ references when linking static libraries.
>From 7c1ec552f48b80f0f9dafac7c4abf572dc9baf5e Mon Sep 17 00:00:00 2001
From: Kito Cheng <kito.cheng at sifive.com>
Date: Mon, 18 May 2026 01:14:03 -0700
Subject: [PATCH] [llvm] Fix DEMANGLE_ABI for MinGW
Exclude MinGW from __declspec(dllimport) like LLVM_ABI in
llvm/include/llvm/Support/Compiler.h does. MinGW auto-exports
all DLL symbols, so __declspec is not needed and causes
undefined __imp__ references when linking static libraries.
---
llvm/include/llvm/Demangle/DemangleConfig.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/Demangle/DemangleConfig.h b/llvm/include/llvm/Demangle/DemangleConfig.h
index 912c9b869bf7d..5c48ae1972bec 100644
--- a/llvm/include/llvm/Demangle/DemangleConfig.h
+++ b/llvm/include/llvm/Demangle/DemangleConfig.h
@@ -102,7 +102,7 @@
#if defined(LLVM_BUILD_STATIC) || !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS)
#define DEMANGLE_ABI
#else
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
#if defined(LLVM_EXPORTS)
#define DEMANGLE_ABI __declspec(dllexport)
#else
More information about the llvm-commits
mailing list