}
default:
- return make_error<GenericBinaryError>("Invalid symbol type",
+ return make_error<GenericBinaryError>("Invalid symbol type: " +
+ Twine(unsigned(Info.Kind)),
object_error::parse_failed);
}
uint32_t PreviousOffset = 0;
while (RelocCount--) {
wasm::WasmRelocation Reloc = {};
- Reloc.Type = readVaruint32(Ctx);
+ uint32_t type = readVaruint32(Ctx);
+ Reloc.Type = type;
Reloc.Offset = readVaruint32(Ctx);
if (Reloc.Offset < PreviousOffset)
return make_error<GenericBinaryError>("Relocations not in offset order",
object_error::parse_failed);
PreviousOffset = Reloc.Offset;
Reloc.Index = readVaruint32(Ctx);
- switch (Reloc.Type) {
+ switch (type) {
case wasm::R_WASM_FUNCTION_INDEX_LEB:
case wasm::R_WASM_TABLE_INDEX_SLEB:
case wasm::R_WASM_TABLE_INDEX_SLEB64:
Reloc.Addend = readVarint32(Ctx);
break;
default:
- return make_error<GenericBinaryError>("Bad relocation type: " +
- Twine(Reloc.Type),
- object_error::parse_failed);
+ return make_error<GenericBinaryError>(
+ "Bad relocation type: " + Twine(type), object_error::parse_failed);
}
// Relocations must fit inside the section, and must appear in order. They