summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp68
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp32
-rw-r--r--llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp22
3 files changed, 61 insertions, 61 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 4747bb5ec8f..65bc2b5c0ba 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -150,11 +150,11 @@ struct WasmRelocationEntry {
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;
@@ -519,8 +519,8 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm,
// 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");
@@ -538,9 +538,9 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm,
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");
@@ -578,33 +578,33 @@ static const MCSymbolWasm *ResolveSymbol(const MCSymbolWasm &Symbol) {
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
@@ -660,7 +660,7 @@ static void addData(SmallVectorImpl<char> &DataBytes,
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());
@@ -684,21 +684,21 @@ void WasmObjectWriter::applyRelocations(
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:
@@ -1481,8 +1481,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm,
// 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);
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index d2421cb95ee..21b4604f799 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -719,43 +719,43 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) {
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);
@@ -771,10 +771,10 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) {
// 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",
@@ -1419,7 +1419,7 @@ uint64_t WasmObjectFile::getRelocationOffset(DataRefImpl Ref) const {
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;
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
index 1eb1308c2b8..d13e1ece9bf 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
@@ -99,31 +99,31 @@ unsigned WebAssemblyWasmObjectWriter::getRelocType(const MCValue &Target,
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:
OpenPOWER on IntegriCloud