From: Dan Gohman Date: Fri, 24 Feb 2017 21:21:44 +0000 (+0000) Subject: [WebAssembly] Define an initial set of relocation types for Wasm. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43d5d8ce649033d73852d320d7cb1cad7b35febd;p=llvm [WebAssembly] Define an initial set of relocation types for Wasm. 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 --- diff --git a/include/llvm/Support/Wasm.h b/include/llvm/Support/Wasm.h index 4bb9b4b8eb0..feb5fd0c9ab 100644 --- a/include/llvm/Support/Wasm.h +++ b/include/llvm/Support/Wasm.h @@ -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 index 00000000000..798f74499fa --- /dev/null +++ b/include/llvm/Support/WasmRelocs/WebAssembly.def @@ -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)