[Mlir-commits] [mlir] [mlir] Fix ArmSME ABI stub exports (PR #224629)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Sep 18 06:14:24 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-execution-engine
Author: Fabrice de Gans (Steelskin)
<details>
<summary>Changes</summary>
Previously, the `MLIR_ARMSMEABISTUBS_EXPORTED` macro would expand to `__declspec(dllimport)` when building LLVM as a dylib on Windows. This would cause a build failure since it is an incorrect annotation on a function definition.
The intent here is to always export the symbol, so these changes use the `LLVM_ALWAYS_EXPORT` macro, which properly expands to the right attribute depending on the compiler / platform.
The effort to build LLVM as a dylib is tracked in #<!-- -->109483.
---
Full diff: https://github.com/llvm/llvm-project/pull/224629.diff
2 Files Affected:
- (modified) mlir/lib/ExecutionEngine/ArmSMEStubs.cpp (+4-19)
- (modified) mlir/lib/ExecutionEngine/CMakeLists.txt (-1)
``````````diff
diff --git a/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp b/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp
index 8abd2073494c32..3f0ef52e7c8e89 100644
--- a/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp
+++ b/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp
@@ -10,21 +10,6 @@
#include <cstdint>
#include <iostream>
-#if (defined(_WIN32) || defined(__CYGWIN__))
-#ifndef MLIR_ARMSMEABISTUBS_EXPORTED
-#ifdef mlir_arm_sme_abi_stubs_EXPORTS
-// We are building this library
-#define MLIR_ARMSMEABISTUBS_EXPORTED __declspec(dllexport)
-#else
-// We are using this library
-#define MLIR_ARMSMEABISTUBS_EXPORTED __declspec(dllimport)
-#endif // mlir_arm_sme_abi_stubs_EXPORTS
-#endif // MLIR_ARMSMEABISTUBS_EXPORTED
-#else
-#define MLIR_ARMSMEABISTUBS_EXPORTED \
- __attribute__((visibility("default"))) LLVM_ATTRIBUTE_WEAK
-#endif // (defined(_WIN32) || defined(__CYGWIN__))
-
// The actual implementation of these routines is in:
// compiler-rt/lib/builtins/aarch64/sme-abi.S. These stubs allow the current
// ArmSME tests to run without depending on compiler-rt. This works as we don't
@@ -39,20 +24,20 @@ struct sme_state {
int64_t x1;
};
-sme_state MLIR_ARMSMEABISTUBS_EXPORTED __arm_sme_state() {
+LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK sme_state __arm_sme_state() {
std::cerr << "[warning] __arm_sme_state() stubbed!\n";
return sme_state{};
}
-void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_restore() {
+LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_tpidr2_restore() {
std::cerr << "[warning] __arm_tpidr2_restore() stubbed!\n";
}
-void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_save() {
+LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_tpidr2_save() {
std::cerr << "[warning] __arm_tpidr2_save() stubbed!\n";
}
-void MLIR_ARMSMEABISTUBS_EXPORTED __arm_za_disable() {
+LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_WEAK void __arm_za_disable() {
std::cerr << "[warning] __arm_za_disable() stubbed!\n";
}
}
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 3199c88313087d..f9403b62425a06 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -271,7 +271,6 @@ if(LLVM_ENABLE_PIC)
# dlopen-ed.
DISABLE_PCH_REUSE
)
- target_compile_definitions(mlir_arm_sme_abi_stubs PRIVATE mlir_arm_sme_abi_stubs_EXPORTS)
add_mlir_library(mlir_arm_runner_utils
SHARED
``````````
</details>
https://github.com/llvm/llvm-project/pull/224629
More information about the Mlir-commits
mailing list