1010#include < cstdint>
1111#include < iostream>
1212
13+ #if (defined(_WIN32) || defined(__CYGWIN__))
14+ #ifndef MLIR_ARMSMEABISTUBS_EXPORTED
15+ #ifdef mlir_arm_sme_abi_stubs_EXPORTS
16+ // We are building this library
17+ #define MLIR_ARMSMEABISTUBS_EXPORTED __declspec (dllexport)
18+ #else
19+ // We are using this library
20+ #define MLIR_ARMSMEABISTUBS_EXPORTED __declspec (dllimport)
21+ #endif // mlir_arm_sme_abi_stubs_EXPORTS
22+ #endif // MLIR_ARMSMEABISTUBS_EXPORTED
23+ #else
24+ #define MLIR_ARMSMEABISTUBS_EXPORTED \
25+ __attribute__ ((visibility(" default" ))) LLVM_ATTRIBUTE_WEAK
26+ #endif // (defined(_WIN32) || defined(__CYGWIN__))
27+
1328// The actual implementation of these routines is in:
1429// compiler-rt/lib/builtins/aarch64/sme-abi.S. These stubs allow the current
1530// ArmSME tests to run without depending on compiler-rt. This works as we don't
1934
2035extern " C" {
2136
22- bool LLVM_ATTRIBUTE_WEAK __aarch64_sme_accessible () {
37+ bool MLIR_ARMSMEABISTUBS_EXPORTED __aarch64_sme_accessible () {
2338 // The ArmSME tests are run within an emulator so we assume SME is available.
2439 return true ;
2540}
@@ -29,20 +44,20 @@ struct sme_state {
2944 int64_t x1;
3045};
3146
32- sme_state LLVM_ATTRIBUTE_WEAK __arm_sme_state () {
47+ sme_state MLIR_ARMSMEABISTUBS_EXPORTED __arm_sme_state () {
3348 std::cerr << " [warning] __arm_sme_state() stubbed!\n " ;
3449 return sme_state{};
3550}
3651
37- void LLVM_ATTRIBUTE_WEAK __arm_tpidr2_restore () {
52+ void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_restore () {
3853 std::cerr << " [warning] __arm_tpidr2_restore() stubbed!\n " ;
3954}
4055
41- void LLVM_ATTRIBUTE_WEAK __arm_tpidr2_save () {
56+ void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_save () {
4257 std::cerr << " [warning] __arm_tpidr2_save() stubbed!\n " ;
4358}
4459
45- void LLVM_ATTRIBUTE_WEAK __arm_za_disable () {
60+ void MLIR_ARMSMEABISTUBS_EXPORTED __arm_za_disable () {
4661 std::cerr << " [warning] __arm_za_disable() stubbed!\n " ;
4762}
4863}
0 commit comments