summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-objdump.cc6
-rw-r--r--src/binary-reader.cc6
-rw-r--r--src/binary-writer.cc6
-rw-r--r--src/common.cc15
-rw-r--r--src/common.h16
5 files changed, 23 insertions, 26 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 0b5cb5a4..836bf7fa 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -129,9 +129,9 @@ void BinaryReaderObjdumpBase::PrintRelocation(const Reloc& reloc,
printf(" %06" PRIzx ": %-18s %" PRIindex "", offset,
GetRelocTypeName(reloc.type), reloc.index);
switch (reloc.type) {
- case RelocType::GlobalAddressLEB:
- case RelocType::GlobalAddressSLEB:
- case RelocType::GlobalAddressI32:
+ case RelocType::MemoryAddressLEB:
+ case RelocType::MemoryAddressSLEB:
+ case RelocType::MemoryAddressI32:
printf(" + %d", reloc.addend);
break;
case RelocType::FuncIndexLEB:
diff --git a/src/binary-reader.cc b/src/binary-reader.cc
index 2ae82315..d17751c1 100644
--- a/src/binary-reader.cc
+++ b/src/binary-reader.cc
@@ -1205,9 +1205,9 @@ Result BinaryReader::ReadRelocSection(Offset section_size) {
CHECK_RESULT(ReadIndex(&index, "index"));
RelocType type = static_cast<RelocType>(reloc_type);
switch (type) {
- case RelocType::GlobalAddressLEB:
- case RelocType::GlobalAddressSLEB:
- case RelocType::GlobalAddressI32:
+ case RelocType::MemoryAddressLEB:
+ case RelocType::MemoryAddressSLEB:
+ case RelocType::MemoryAddressI32:
CHECK_RESULT(ReadI32Leb128(&addend, "addend"));
break;
default:
diff --git a/src/binary-writer.cc b/src/binary-writer.cc
index 128f8afa..7be8ecb8 100644
--- a/src/binary-writer.cc
+++ b/src/binary-writer.cc
@@ -718,9 +718,9 @@ void BinaryWriter::WriteRelocSection(const RelocSection* reloc_section) {
WriteU32Leb128(&stream_, reloc.offset, "reloc offset");
WriteU32Leb128(&stream_, reloc.index, "reloc index");
switch (reloc.type) {
- case RelocType::GlobalAddressLEB:
- case RelocType::GlobalAddressSLEB:
- case RelocType::GlobalAddressI32:
+ case RelocType::MemoryAddressLEB:
+ case RelocType::MemoryAddressSLEB:
+ case RelocType::MemoryAddressI32:
WriteU32Leb128(&stream_, reloc.addend, "reloc addend");
break;
default:
diff --git a/src/common.cc b/src/common.cc
index 922489be..65b2e15c 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -37,15 +37,12 @@ Reloc::Reloc(RelocType type, Offset offset, Index index, int32_t addend)
const char* g_kind_name[] = {"func", "table", "memory", "global", "except"};
WABT_STATIC_ASSERT(WABT_ARRAY_SIZE(g_kind_name) == kExternalKindCount);
-const char* g_reloc_type_name[] = {"R_FUNC_INDEX_LEB",
- "R_TABLE_INDEX_SLEB",
- "R_TABLE_INDEX_I32",
- "R_GLOBAL_ADDR_LEB",
- "R_GLOBAL_ADDR_SLEB",
- "R_GLOBAL_ADDR_I32",
- "R_TYPE_INDEX_LEB",
- "R_GLOBAL_INDEX_LEB",
- };
+const char* g_reloc_type_name[] = {
+ "R_WEBASSEMBLY_FUNCTION_INDEX_LEB", "R_WEBASSEMBLY_TABLE_INDEX_SLEB",
+ "R_WEBASSEMBLY_TABLE_INDEX_I32", "R_WEBASSEMBLY_MEMORY_ADDR_LEB",
+ "R_WEBASSEMBLY_MEMORY_ADDR_SLEB", "R_WEBASSEMBLY_MEMORY_ADDR_I32",
+ "R_WEBASSEMBLY_TYPE_INDEX_LEB", "R_WEBASSEMBLY_GLOBAL_INDEX_LEB",
+};
WABT_STATIC_ASSERT(WABT_ARRAY_SIZE(g_reloc_type_name) == kRelocTypeCount);
Result ReadFile(const char* filename, std::vector<uint8_t>* out_data) {
diff --git a/src/common.h b/src/common.h
index 90754063..78fe710f 100644
--- a/src/common.h
+++ b/src/common.h
@@ -199,14 +199,14 @@ enum class Type {
typedef std::vector<Type> TypeVector;
enum class RelocType {
- FuncIndexLEB = 0, /* e.g. immediate of call instruction */
- TableIndexSLEB = 1, /* e.g. loading address of function */
- TableIndexI32 = 2, /* e.g. function address in DATA */
- GlobalAddressLEB = 3,
- GlobalAddressSLEB = 4,
- GlobalAddressI32 = 5,
- TypeIndexLEB = 6, /* e.g immediate type in call_indirect */
- GlobalIndexLEB = 7, /* e.g immediate of get_global inst */
+ FuncIndexLEB = 0, // e.g. Immediate of call instruction
+ TableIndexSLEB = 1, // e.g. Loading address of function
+ TableIndexI32 = 2, // e.g. Function address in DATA
+ MemoryAddressLEB = 3, // e.g. Memory address in load/store offset immediate
+ MemoryAddressSLEB = 4, // e.g. Memory address in i32.const
+ MemoryAddressI32 = 5, // e.g. Memory address in DATA
+ TypeIndexLEB = 6, // e.g. Immediate type in call_indirect
+ GlobalIndexLEB = 7, // e.g. Immediate of get_global inst
First = FuncIndexLEB,
Last = GlobalIndexLEB,