See https://github.com/WebAssembly/tool-conventions/pull/95.
This is less typing and IMHO more readable, and it also fits with
our naming around the binary format which tends to use the short name.
e.g.
include/llvm/BinaryFormat/Wasm.h
tools/llvm-objdump/WasmDump.cpp
etc..
Differential Revision: https://reviews.llvm.org/D57611
llvm-svn: 353062
#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_MEMORY_ADDR_LEB, 3)
-WASM_RELOC(R_WEBASSEMBLY_MEMORY_ADDR_SLEB, 4)
-WASM_RELOC(R_WEBASSEMBLY_MEMORY_ADDR_I32, 5)
-WASM_RELOC(R_WEBASSEMBLY_TYPE_INDEX_LEB, 6)
-WASM_RELOC(R_WEBASSEMBLY_GLOBAL_INDEX_LEB, 7)
-WASM_RELOC(R_WEBASSEMBLY_FUNCTION_OFFSET_I32, 8)
-WASM_RELOC(R_WEBASSEMBLY_SECTION_OFFSET_I32, 9)
-WASM_RELOC(R_WEBASSEMBLY_EVENT_INDEX_LEB, 10)
+WASM_RELOC(R_WASM_FUNCTION_INDEX_LEB, 0)
+WASM_RELOC(R_WASM_TABLE_INDEX_SLEB, 1)
+WASM_RELOC(R_WASM_TABLE_INDEX_I32, 2)
+WASM_RELOC(R_WASM_MEMORY_ADDR_LEB, 3)
+WASM_RELOC(R_WASM_MEMORY_ADDR_SLEB, 4)
+WASM_RELOC(R_WASM_MEMORY_ADDR_I32, 5)
+WASM_RELOC(R_WASM_TYPE_INDEX_LEB, 6)
+WASM_RELOC(R_WASM_GLOBAL_INDEX_LEB, 7)
+WASM_RELOC(R_WASM_FUNCTION_OFFSET_I32, 8)
+WASM_RELOC(R_WASM_SECTION_OFFSET_I32, 9)
+WASM_RELOC(R_WASM_EVENT_INDEX_LEB, 10)
uint64_t visitWasm(uint32_t Rel, RelocationRef R, uint64_t Value) {
if (ObjToVisit.getArch() == Triple::wasm32) {
switch (Rel) {
- case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB:
+ case wasm::R_WASM_FUNCTION_INDEX_LEB:
+ case wasm::R_WASM_TABLE_INDEX_SLEB:
+ case wasm::R_WASM_TABLE_INDEX_I32:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_TYPE_INDEX_LEB:
+ case wasm::R_WASM_GLOBAL_INDEX_LEB:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
+ case wasm::R_WASM_EVENT_INDEX_LEB:
// For wasm section, its offset at 0 -- ignoring Value
return 0;
}
bool hasAddend() const {
switch (Type) {
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
return true;
default:
return false;
// Absolute offset within a section or a function.
// Currently only supported for for metadata sections.
// See: test/MC/WebAssembly/blockaddress.ll
- if (Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32 ||
- Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32) {
+ if (Type == wasm::R_WASM_FUNCTION_OFFSET_I32 ||
+ Type == wasm::R_WASM_SECTION_OFFSET_I32) {
if (!FixupSection.getKind().isMetadata())
report_fatal_error("relocations for function or section offsets are "
"only supported in metadata sections");
SymA = cast<MCSymbolWasm>(SectionSymbol);
}
- // Relocation other than R_WEBASSEMBLY_TYPE_INDEX_LEB are required to be
+ // Relocation other than R_WASM_TYPE_INDEX_LEB are required to be
// against a named symbol.
- if (Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) {
+ if (Type != wasm::R_WASM_TYPE_INDEX_LEB) {
if (SymA->getName().empty())
report_fatal_error("relocations against un-named temporaries are not yet "
"supported by wasm");
uint32_t
WasmObjectWriter::getProvisionalValue(const WasmRelocationEntry &RelEntry) {
switch (RelEntry.Type) {
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32: {
+ case wasm::R_WASM_TABLE_INDEX_SLEB:
+ case wasm::R_WASM_TABLE_INDEX_I32: {
// Provisional value is table address of the resolved symbol itself
const MCSymbolWasm *Sym = ResolveSymbol(*RelEntry.Symbol);
assert(Sym->isFunction());
return TableIndices[Sym];
}
- case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
+ case wasm::R_WASM_TYPE_INDEX_LEB:
// Provisional value is same as the index
return getRelocationIndexValue(RelEntry);
- case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB:
+ case wasm::R_WASM_FUNCTION_INDEX_LEB:
+ case wasm::R_WASM_GLOBAL_INDEX_LEB:
+ case wasm::R_WASM_EVENT_INDEX_LEB:
// Provisional value is function/global/event Wasm index
if (!WasmIndices.count(RelEntry.Symbol))
report_fatal_error("symbol not found in wasm index space: " +
RelEntry.Symbol->getName());
return WasmIndices[RelEntry.Symbol];
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32: {
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32: {
const auto &Section =
static_cast<const MCSectionWasm &>(RelEntry.Symbol->getSection());
return Section.getSectionOffset() + RelEntry.Addend;
}
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB: {
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB: {
// Provisional value is address of the global
const MCSymbolWasm *Sym = ResolveSymbol(*RelEntry.Symbol);
// For undefined symbols, use zero
uint32_t
WasmObjectWriter::getRelocationIndexValue(const WasmRelocationEntry &RelEntry) {
- if (RelEntry.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) {
+ if (RelEntry.Type == wasm::R_WASM_TYPE_INDEX_LEB) {
if (!TypeIndices.count(RelEntry.Symbol))
report_fatal_error("symbol not found in type index space: " +
RelEntry.Symbol->getName());
uint32_t Value = getProvisionalValue(RelEntry);
switch (RelEntry.Type) {
- case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB:
+ case wasm::R_WASM_FUNCTION_INDEX_LEB:
+ case wasm::R_WASM_TYPE_INDEX_LEB:
+ case wasm::R_WASM_GLOBAL_INDEX_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_EVENT_INDEX_LEB:
WritePatchableLEB(Stream, Value, Offset);
break;
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
+ case wasm::R_WASM_TABLE_INDEX_I32:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
WriteI32(Stream, Value, Offset);
break;
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_TABLE_INDEX_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
WritePatchableSLEB(Stream, Value, Offset);
break;
default:
// Functions referenced by a relocation need to put in the table. This is
// purely to make the object file's provisional values readable, and is
// ignored by the linker, which re-calculates the relocations itself.
- if (Rel.Type != wasm::R_WEBASSEMBLY_TABLE_INDEX_I32 &&
- Rel.Type != wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB)
+ if (Rel.Type != wasm::R_WASM_TABLE_INDEX_I32 &&
+ Rel.Type != wasm::R_WASM_TABLE_INDEX_SLEB)
return;
assert(Rel.Symbol->isFunction());
const MCSymbolWasm &WS = *ResolveSymbol(*Rel.Symbol);
PreviousOffset = Reloc.Offset;
Reloc.Index = readVaruint32(Ctx);
switch (Reloc.Type) {
- case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
+ case wasm::R_WASM_FUNCTION_INDEX_LEB:
+ case wasm::R_WASM_TABLE_INDEX_SLEB:
+ case wasm::R_WASM_TABLE_INDEX_I32:
if (!isValidFunctionSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation function index",
object_error::parse_failed);
break;
- case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
+ case wasm::R_WASM_TYPE_INDEX_LEB:
if (Reloc.Index >= Signatures.size())
return make_error<GenericBinaryError>("Bad relocation type index",
object_error::parse_failed);
break;
- case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
+ case wasm::R_WASM_GLOBAL_INDEX_LEB:
if (!isValidGlobalSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation global index",
object_error::parse_failed);
break;
- case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB:
+ case wasm::R_WASM_EVENT_INDEX_LEB:
if (!isValidEventSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation event index",
object_error::parse_failed);
break;
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
if (!isValidDataSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation data index",
object_error::parse_failed);
Reloc.Addend = readVarint32(Ctx);
break;
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
if (!isValidFunctionSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation function index",
object_error::parse_failed);
Reloc.Addend = readVarint32(Ctx);
break;
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
if (!isValidSectionSymbol(Reloc.Index))
return make_error<GenericBinaryError>("Bad relocation section index",
object_error::parse_failed);
// also shouldn't overlap a function/element boundary, but we don't bother
// to check that.
uint64_t Size = 5;
- if (Reloc.Type == wasm::R_WEBASSEMBLY_TABLE_INDEX_I32 ||
- Reloc.Type == wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32 ||
- Reloc.Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32 ||
- Reloc.Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32)
+ if (Reloc.Type == wasm::R_WASM_TABLE_INDEX_I32 ||
+ Reloc.Type == wasm::R_WASM_MEMORY_ADDR_I32 ||
+ Reloc.Type == wasm::R_WASM_SECTION_OFFSET_I32 ||
+ Reloc.Type == wasm::R_WASM_FUNCTION_OFFSET_I32)
Size = 4;
if (Reloc.Offset + Size > EndOffset)
return make_error<GenericBinaryError>("Bad relocation offset",
symbol_iterator WasmObjectFile::getRelocationSymbol(DataRefImpl Ref) const {
const wasm::WasmRelocation &Rel = getWasmRelocation(Ref);
- if (Rel.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB)
+ if (Rel.Type == wasm::R_WASM_TYPE_INDEX_LEB)
return symbol_end();
DataRefImpl Sym;
Sym.d.a = 1;
switch (unsigned(Fixup.getKind())) {
case WebAssembly::fixup_code_sleb128_i32:
if (IsFunction)
- return wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB;
- return wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB;
+ return wasm::R_WASM_TABLE_INDEX_SLEB;
+ return wasm::R_WASM_MEMORY_ADDR_SLEB;
case WebAssembly::fixup_code_sleb128_i64:
llvm_unreachable("fixup_sleb128_i64 not implemented yet");
case WebAssembly::fixup_code_uleb128_i32:
if (IsGlobalType(Target))
- return wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB;
+ return wasm::R_WASM_GLOBAL_INDEX_LEB;
if (IsFunctionType(Target))
- return wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB;
+ return wasm::R_WASM_TYPE_INDEX_LEB;
if (IsFunction)
- return wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB;
+ return wasm::R_WASM_FUNCTION_INDEX_LEB;
if (IsEventType(Target))
- return wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB;
- return wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB;
+ return wasm::R_WASM_EVENT_INDEX_LEB;
+ return wasm::R_WASM_MEMORY_ADDR_LEB;
case FK_Data_4:
if (IsFunction)
- return wasm::R_WEBASSEMBLY_TABLE_INDEX_I32;
+ return wasm::R_WASM_TABLE_INDEX_I32;
if (auto Section = static_cast<const MCSectionWasm *>(
GetFixupSection(Fixup.getValue()))) {
if (Section->getKind().isText())
- return wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32;
+ return wasm::R_WASM_FUNCTION_OFFSET_I32;
else if (!Section->isWasmData())
- return wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32;
+ return wasm::R_WASM_SECTION_OFFSET_I32;
}
- return wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32;
+ return wasm::R_WASM_MEMORY_ADDR_I32;
case FK_Data_8:
llvm_unreachable("FK_Data_8 not implemented yet");
default:
; CHECK-NEXT: FunctionTypes: [ 0 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000004
; CHECK-NEXT: Functions:
; CHECK-NEXT: FunctionTypes: [ 0, 0, 0 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000004
; CHECK-NEXT: Functions:
; CHECK-NEXT:]
; CHECK-NEXT:Relocations [
; CHECK-NEXT: Section (6) DATA {
-; CHECK-NEXT: 0x6 R_WEBASSEMBLY_MEMORY_ADDR_I32 myextern 0
-; CHECK-NEXT: 0xF R_WEBASSEMBLY_TABLE_INDEX_I32 f2
+; CHECK-NEXT: 0x6 R_WASM_MEMORY_ADDR_I32 myextern 0
+; CHECK-NEXT: 0xF R_WASM_TABLE_INDEX_I32 f2
; CHECK-NEXT: }
; CHECK-NEXT: Section (9) .debug_info {
-; CHECK-NEXT: 0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_abbrev 0
-; CHECK-NEXT: 0xC R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 0
-; CHECK-NEXT: 0x12 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 55
-; CHECK-NEXT: 0x16 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_line 0
-; CHECK-NEXT: 0x1A R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 62
-; CHECK-NEXT: 0x1E R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
-; CHECK-NEXT: 0x27 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 105
-; CHECK-NEXT: 0x33 R_WEBASSEMBLY_MEMORY_ADDR_I32 foo 0
-; CHECK-NEXT: 0x3D R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 109
-; CHECK-NEXT: 0x44 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 113
-; CHECK-NEXT: 0x50 R_WEBASSEMBLY_MEMORY_ADDR_I32 ptr2 0
-; CHECK-NEXT: 0x5B R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
-; CHECK-NEXT: 0x63 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 118
+; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_abbrev 0
+; CHECK-NEXT: 0xC R_WASM_SECTION_OFFSET_I32 .debug_str 0
+; CHECK-NEXT: 0x12 R_WASM_SECTION_OFFSET_I32 .debug_str 55
+; CHECK-NEXT: 0x16 R_WASM_SECTION_OFFSET_I32 .debug_line 0
+; CHECK-NEXT: 0x1A R_WASM_SECTION_OFFSET_I32 .debug_str 62
+; CHECK-NEXT: 0x1E R_WASM_FUNCTION_OFFSET_I32 f2 0
+; CHECK-NEXT: 0x27 R_WASM_SECTION_OFFSET_I32 .debug_str 105
+; CHECK-NEXT: 0x33 R_WASM_MEMORY_ADDR_I32 foo 0
+; CHECK-NEXT: 0x3D R_WASM_SECTION_OFFSET_I32 .debug_str 109
+; CHECK-NEXT: 0x44 R_WASM_SECTION_OFFSET_I32 .debug_str 113
+; CHECK-NEXT: 0x50 R_WASM_MEMORY_ADDR_I32 ptr2 0
+; CHECK-NEXT: 0x5B R_WASM_FUNCTION_OFFSET_I32 f2 0
+; CHECK-NEXT: 0x63 R_WASM_SECTION_OFFSET_I32 .debug_str 118
; CHECK-NEXT: }
; CHECK-NEXT: Section (11) .debug_pubnames {
-; CHECK-NEXT: 0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_info 0
+; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (12) .debug_pubtypes {
-; CHECK-NEXT: 0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_info 0
+; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (13) .debug_line {
-; CHECK-NEXT: 0x2B R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
+; CHECK-NEXT: 0x2B R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: }
; CHECK-NEXT:]
; CHECK-NEXT:Symbols [
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_EVENT_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_EVENT_INDEX_LEB
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000006
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_EVENT_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_EVENT_INDEX_LEB
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000011
; CHECK: - Type: DATA
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
; CHECK-NEXT: Index: 2
; CHECK-NEXT: Offset: 0x00000013
; CHECK-NEXT: Segments:
; CHECK-NEXT: Functions: [ 1, 2 ]
; CHECK: - Type: DATA
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
+; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x00000006
; CHECK: Relocations [
; CHECK-NEXT: Section (5) CODE {
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
; CHECK-NEXT: Offset: 0x4
; CHECK-NEXT: Symbol: import1
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
; CHECK-NEXT: Offset: 0xB
; CHECK-NEXT: Symbol: import2
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_GLOBAL_INDEX_LEB (7)
+; CHECK-NEXT: Type: R_WASM_GLOBAL_INDEX_LEB (7)
; CHECK-NEXT: Offset: 0x15
; CHECK-NEXT: Symbol: __stack_pointer
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB (1)
+; CHECK-NEXT: Type: R_WASM_TABLE_INDEX_SLEB (1)
; CHECK-NEXT: Offset: 0x1E
; CHECK-NEXT: Symbol: import3
; CHECK-NEXT: }
; CHECK-NEXT: Functions: [ 5, 7 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000004
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
+; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x0000000F
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x00000017
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 4
; CHECK-NEXT: Offset: 0x0000001D
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 6
; CHECK-NEXT: Offset: 0x0000002C
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
+; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_SLEB
; CHECK-NEXT: Index: 5
; CHECK-NEXT: Offset: 0x00000037
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x0000003F
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 4
; CHECK-NEXT: Offset: 0x00000045
; CHECK-NEXT: Functions:
; CHECK: Relocations [
; CHECK-NEXT: Section (4) CODE {
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_LEB (3)
; CHECK-NEXT: Offset: 0x9
; CHECK-NEXT: Symbol: b
; CHECK-NEXT: Addend: 0
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_LEB (3)
; CHECK-NEXT: Offset: 0x14
; CHECK-NEXT: Symbol: a
; CHECK-NEXT: Addend: 0
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6)
+; CHECK-NEXT: Type: R_WASM_TYPE_INDEX_LEB (6)
; CHECK-NEXT: Offset: 0x1A
; CHECK-NEXT: Index: 0x1
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6)
+; CHECK-NEXT: Type: R_WASM_TYPE_INDEX_LEB (6)
; CHECK-NEXT: Offset: 0x24
; CHECK-NEXT: Index: 0x0
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
; CHECK-NEXT: Offset: 0x2D
; CHECK-NEXT: Symbol: c
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+; CHECK-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
; CHECK-NEXT: Offset: 0x34
; CHECK-NEXT: Symbol: d
; CHECK-NEXT: }
; CHECK: Relocations [
; CHECK-NEXT: Section (2) DATA {
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
; CHECK-NEXT: Offset: 0x13
; CHECK-NEXT: Symbol: foo
; CHECK-NEXT: Addend: 8
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
; CHECK-NEXT: Offset: 0x1C
; CHECK-NEXT: Symbol: bar
; CHECK-NEXT: Addend: -16
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
; CHECK-NEXT: Offset: 0x25
; CHECK-NEXT: Symbol: foo
; CHECK-NEXT: Addend: 0
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
; CHECK-NEXT: Offset: 0x29
; CHECK-NEXT: Symbol: foo
; CHECK-NEXT: Addend: 0
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
-; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
+; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
; CHECK-NEXT: Offset: 0x2D
; CHECK-NEXT: Symbol: foo
; CHECK-NEXT: Addend: 0
; CHECK: GlobalMutable: true
; CHECK: - Type: CODE
; CHECK: Relocations:
-; CHECK: - Type: R_WEBASSEMBLY_GLOBAL_INDEX_LEB
+; CHECK: - Type: R_WASM_GLOBAL_INDEX_LEB
; CHECK: Index: 0
; CHECK: - Type: DATA
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x0000001C
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
; CHECK-NEXT: Index: 1
; CHECK-NEXT: Offset: 0x00000025
; CHECK-NEXT: Segments:
; CHECK-NEXT: Functions: [ 0 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x00000009
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x00000012
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
; CHECK-NEXT: Index: 5
; CHECK-NEXT: Offset: 0x0000001E
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x00000024
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB
+; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
; CHECK-NEXT: Index: 7
; CHECK-NEXT: Offset: 0x00000031
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB
+; CHECK-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x00000037
; CHECK-NEXT: Functions:
; CHECK-NEXT: Body: 410028029080808000118080808000000B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
+; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 0
; CHECK-NEXT: Offset: 0x0000000F
-; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
+; CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
; CHECK-NEXT: Index: 3
; CHECK-NEXT: Offset: 0x00000018
; CHECK-NEXT: Segments:
ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
WASM: CODE
-WASM-NEXT: R_WEBASSEMBLY_MEMORY_ADDR_SLEB .L.str
-WASM-NEXT: R_WEBASSEMBLY_FUNCTION_INDEX_LEB puts
-WASM-NEXT: R_WEBASSEMBLY_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
-WASM-NEXT: R_WEBASSEMBLY_FUNCTION_INDEX_LEB SomeOtherFunction
+WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
+WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
+WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
+WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
ELF-complex-x86-64: .text
ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
- 1
- Type: CODE
Relocations:
- - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
+ - Type: R_WASM_TABLE_INDEX_SLEB
Index: 0
Offset: 0x00000006
- - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+ - Type: R_WASM_FUNCTION_INDEX_LEB
Index: 1
Offset: 0x00000025
Functions:
# CHECK: - I64
# CHECK: - Type: CODE
# CHECK: Relocations:
-# CHECK: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
+# CHECK: - Type: R_WASM_TABLE_INDEX_SLEB
# CHECK: Index: 0
# CHECK: Offset: 0x00000006
-# CHECK: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
+# CHECK: - Type: R_WASM_FUNCTION_INDEX_LEB
# CHECK: Index: 1
# CHECK: Offset: 0x00000025
# CHECK: Functions:
Value: 4
Content: '10001000'
Relocations:
- - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+ - Type: R_WASM_MEMORY_ADDR_I32
Index: 0
Offset: 0x00000006
Addend: 8
- - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+ - Type: R_WASM_MEMORY_ADDR_I32
Index: 0
Offset: 0x00000006
Addend: -6
# CHECK: Sections:
# CHECK: - Type: DATA
# CHECK-NEXT: Relocations:
-# CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+# CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
# CHECK-NEXT: Index: 0
# CHECK-NEXT: Offset: 0x00000006
# CHECK-NEXT: Addend: 8
-# CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
+# CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
# CHECK-NEXT: Index: 0
# CHECK-NEXT: Offset: 0x00000006
# CHECK-NEXT: Addend: -6
SigIndex: 1
- Type: CODE
Relocations:
- - Type: R_WEBASSEMBLY_EVENT_INDEX_LEB
+ - Type: R_WASM_EVENT_INDEX_LEB
Index: 1
Offset: 0x00000006
Functions:
# CHECK-NEXT: SigIndex: 1
# CHECK-NEXT: - Type: CODE
# CHECK-NEXT: Relocations:
-# CHECK-NEXT: - Type: R_WEBASSEMBLY_EVENT_INDEX_LEB
+# CHECK-NEXT: - Type: R_WASM_EVENT_INDEX_LEB
# CHECK-NEXT: Index: 1
# CHECK-NEXT: Offset: 0x00000006
# CHECK-NEXT: Functions:
}
; CHECK: RELOCATION RECORDS FOR [CODE]:
-; CHECK-NEXT: 00000006 R_WEBASSEMBLY_TYPE_INDEX_LEB 1+0
+; CHECK-NEXT: 00000006 R_WASM_TYPE_INDEX_LEB 1+0
; CHECK: RELOCATION RECORDS FOR [DATA]:
-; CHECK-NEXT: 00000006 R_WEBASSEMBLY_MEMORY_ADDR_I32 foo+0
+; CHECK-NEXT: 00000006 R_WASM_MEMORY_ADDR_I32 foo+0
WASM: Relocations [
WASM-NEXT: Section (4) CODE {
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB (4)
+WASM-NEXT: Type: R_WASM_MEMORY_ADDR_SLEB (4)
WASM-NEXT: Offset: 0x4
WASM-NEXT: Symbol: .L.str
WASM-NEXT: Addend: 0
WASM-NEXT: }
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
WASM-NEXT: Offset: 0xA
WASM-NEXT: Symbol: puts
WASM-NEXT: }
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
WASM-NEXT: Offset: 0x11
WASM-NEXT: Symbol: .LSomeOtherFunction_bitcast
WASM-NEXT: }
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
WASM-NEXT: Offset: 0x1E
WASM-NEXT: Symbol: SomeOtherFunction
WASM-NEXT: }
raw_string_ostream Fmt(FmtBuf);
if (SI == Obj->symbol_end()) {
// Not all wasm relocations have symbols associated with them.
- // In particular R_WEBASSEMBLY_TYPE_INDEX_LEB.
+ // In particular R_WASM_TYPE_INDEX_LEB.
Fmt << Rel.Index;
} else {
Expected<StringRef> SymNameOrErr = SI->getName();
bool HasAddend = false;
switch (RelocType) {
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
HasAddend = true;
break;
default:
encodeULEB128(Reloc.Offset, OS);
encodeULEB128(Reloc.Index, OS);
switch (Reloc.Type) {
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
- case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
- case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
- case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
+ case wasm::R_WASM_MEMORY_ADDR_LEB:
+ case wasm::R_WASM_MEMORY_ADDR_SLEB:
+ case wasm::R_WASM_MEMORY_ADDR_I32:
+ case wasm::R_WASM_FUNCTION_OFFSET_I32:
+ case wasm::R_WASM_SECTION_OFFSET_I32:
encodeULEB128(Reloc.Addend, OS);
}
}