]> granicus.if.org Git - llvm/commitdiff
[WebAssembly] Define an initial set of relocation types for Wasm.
authorDan Gohman <dan433584@gmail.com>
Fri, 24 Feb 2017 21:21:44 +0000 (21:21 +0000)
committerDan Gohman <dan433584@gmail.com>
Fri, 24 Feb 2017 21:21:44 +0000 (21:21 +0000)
This set will likely evolve, along with the Wasm linking ABI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296177 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Wasm.h
include/llvm/Support/WasmRelocs/WebAssembly.def [new file with mode: 0644]

index 4bb9b4b8eb0ce6bc83473717b8fc18688d5d96ba..feb5fd0c9abf00db6b82ef231933171f177b7aeb 100644 (file)
@@ -81,6 +81,12 @@ enum : unsigned {
   WASM_OPCODE_F64_CONST  = 0x44,
 };
 
+#define WASM_RELOC(name, value) name = value,
+
+enum : unsigned {
+#include "WasmRelocs/WebAssembly.def"
+};
+
 } // end namespace wasm
 } // end namespace llvm
 
diff --git a/include/llvm/Support/WasmRelocs/WebAssembly.def b/include/llvm/Support/WasmRelocs/WebAssembly.def
new file mode 100644 (file)
index 0000000..798f744
--- /dev/null
@@ -0,0 +1,11 @@
+
+#ifndef WASM_RELOC
+#error "WASM_RELOC must be defined"
+#endif
+
+WASM_RELOC(R_WEBASSEMBLY_FUNCTION_INDEX_LEB,   0)
+WASM_RELOC(R_WEBASSEMBLY_TABLE_INDEX_SLEB,     1)
+WASM_RELOC(R_WEBASSEMBLY_TABLE_INDEX_I32,      2)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_LEB,      3)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_SLEB,     4)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_I32,      5)