Skip to content

Commit 2447540

Browse files
authored
[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
1 parent 0dcf924 commit 2447540

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/include/llvm/Config/abi-breaking.h.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#ifndef LLVM_ABI_BREAKING_CHECKS_H
1313
#define LLVM_ABI_BREAKING_CHECKS_H
1414

15+
// Compiler.h is required for LLVM_ABI definition.
16+
#include "llvm/Support/Compiler.h"
17+
1518
/* Define to enable checks that alter the LLVM C++ ABI */
1619
#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS
1720

@@ -43,12 +46,12 @@
4346
#endif
4447
namespace llvm {
4548
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
46-
extern int EnableABIBreakingChecks;
49+
LLVM_ABI extern int EnableABIBreakingChecks;
4750
LLVM_HIDDEN_VISIBILITY
4851
__attribute__((weak)) int *VerifyEnableABIBreakingChecks =
4952
&EnableABIBreakingChecks;
5053
#else
51-
extern int DisableABIBreakingChecks;
54+
LLVM_ABI extern int DisableABIBreakingChecks;
5255
LLVM_HIDDEN_VISIBILITY
5356
__attribute__((weak)) int *VerifyDisableABIBreakingChecks =
5457
&DisableABIBreakingChecks;

0 commit comments

Comments
 (0)