[Mlir-commits] [mlir] 3d144cc - [mlir] Fix ArmSME ABI stub exports (#224629)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 21 03:27:49 PDT 2026


Author: Fabrice de Gans
Date: 2026-09-21T03:27:42-07:00
New Revision: 3d144ccf9a49b8d0f73bc32b03dd1adb2cf33830

URL: https://github.com/llvm/llvm-project/commit/3d144ccf9a49b8d0f73bc32b03dd1adb2cf33830
DIFF: https://github.com/llvm/llvm-project/commit/3d144ccf9a49b8d0f73bc32b03dd1adb2cf33830.diff

LOG: [mlir] Fix ArmSME ABI stub exports (#224629)

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.

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/ArmSMEStubs.cpp
    mlir/lib/ExecutionEngine/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp b/mlir/lib/ExecutionEngine/ArmSMEStubs.cpp
index 8abd2073494c3..3f0ef52e7c8e8 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 3199c88313087..f9403b62425a0 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


        


More information about the Mlir-commits mailing list