[llvm] 2447540 - [llvm] annotate ABIBreakingChecks symbols for DLL export (#145575)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 08:49:53 PDT 2025
Author: Andrew Rogers
Date: 2025-07-08T08:49:50-07:00
New Revision: 24475409e4eac6fd60e2111424a4bef3452c8f21
URL: https://github.com/llvm/llvm-project/commit/24475409e4eac6fd60e2111424a4bef3452c8f21
DIFF: https://github.com/llvm/llvm-project/commit/24475409e4eac6fd60e2111424a4bef3452c8f21.diff
LOG: [llvm] annotate ABIBreakingChecks symbols for DLL export (#145575)
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates the ABI Breaking Checks
interface in llvm/config. The annotations currently have no meaningful
impact on the LLVM build; however, they are a prerequisite to support an
LLVM Windows DLL (shared library) build.
## Background
The effort to build LLVM as a Windows DLL is tracked in #109483.
Additional context is provided in [this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).
## Validation
Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:
- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
Added:
Modified:
llvm/include/llvm/Config/abi-breaking.h.cmake
Removed:
################################################################################
diff --git a/llvm/include/llvm/Config/abi-breaking.h.cmake b/llvm/include/llvm/Config/abi-breaking.h.cmake
index 2d27e02b1d545..318bd015f80d2 100644
--- a/llvm/include/llvm/Config/abi-breaking.h.cmake
+++ b/llvm/include/llvm/Config/abi-breaking.h.cmake
@@ -12,6 +12,9 @@
#ifndef LLVM_ABI_BREAKING_CHECKS_H
#define LLVM_ABI_BREAKING_CHECKS_H
+// Compiler.h is required for LLVM_ABI definition.
+#include "llvm/Support/Compiler.h"
+
/* Define to enable checks that alter the LLVM C++ ABI */
#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS
@@ -43,12 +46,12 @@
#endif
namespace llvm {
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
-extern int EnableABIBreakingChecks;
+LLVM_ABI extern int EnableABIBreakingChecks;
LLVM_HIDDEN_VISIBILITY
__attribute__((weak)) int *VerifyEnableABIBreakingChecks =
&EnableABIBreakingChecks;
#else
-extern int DisableABIBreakingChecks;
+LLVM_ABI extern int DisableABIBreakingChecks;
LLVM_HIDDEN_VISIBILITY
__attribute__((weak)) int *VerifyDisableABIBreakingChecks =
&DisableABIBreakingChecks;
More information about the llvm-commits
mailing list