Skip to content

Commit

Permalink
[WebAssembly] Define an initial set of relocation types for Wasm.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dan Gohman committed Feb 24, 2017
1 parent e3a136c commit 43d5d8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/llvm/Support/Wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions include/llvm/Support/WasmRelocs/WebAssembly.def
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 43d5d8c

Please sign in to comment.