[llvm] r296177 - [WebAssembly] Define an initial set of relocation types for Wasm.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 24 13:21:44 PST 2017
Author: djg
Date: Fri Feb 24 15:21:44 2017
New Revision: 296177
URL: http://llvm.org/viewvc/llvm-project?rev=296177&view=rev
Log:
[WebAssembly] Define an initial set of relocation types for Wasm.
This set will likely evolve, along with the Wasm linking ABI.
Added:
llvm/trunk/include/llvm/Support/WasmRelocs/
llvm/trunk/include/llvm/Support/WasmRelocs/WebAssembly.def
Modified:
llvm/trunk/include/llvm/Support/Wasm.h
Modified: llvm/trunk/include/llvm/Support/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Wasm.h?rev=296177&r1=296176&r2=296177&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Wasm.h (original)
+++ llvm/trunk/include/llvm/Support/Wasm.h Fri Feb 24 15:21:44 2017
@@ -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
Added: llvm/trunk/include/llvm/Support/WasmRelocs/WebAssembly.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/WasmRelocs/WebAssembly.def?rev=296177&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/WasmRelocs/WebAssembly.def (added)
+++ llvm/trunk/include/llvm/Support/WasmRelocs/WebAssembly.def Fri Feb 24 15:21:44 2017
@@ -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)
More information about the llvm-commits
mailing list