about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_abi.cpp10
-rw-r--r--src/rt/rust_abi.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/rt/rust_abi.cpp b/src/rt/rust_abi.cpp
new file mode 100644
index 00000000000..98b80fb41bd
--- /dev/null
+++ b/src/rt/rust_abi.cpp
@@ -0,0 +1,10 @@
+#include <cstdlib>
+#include <stdint.h>
+#include "rust_abi.h"
+
+weak_symbol<uint32_t> abi_version("rust_abi_version");
+
+uint32_t get_abi_version() {
+    return (*abi_version == NULL) ? 0 : **abi_version;
+}
+
diff --git a/src/rt/rust_abi.h b/src/rt/rust_abi.h
index 1894a56f6a4..9c22ea3fe7e 100644
--- a/src/rt/rust_abi.h
+++ b/src/rt/rust_abi.h
@@ -1,6 +1,8 @@
 #ifndef RUST_ABI_H
 #define RUST_ABI_H
 
+#include <cstdlib>
+
 #ifdef __WIN32__
 #include <windows.h>
 #else
@@ -34,5 +36,7 @@ public:
     T *&operator*() { fill(); return data; }
 };
 
+uint32_t get_abi_version();
+
 #endif