summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/binary-reader-ir.cc2
-rw-r--r--test/binary/linking-section.txt56
2 files changed, 55 insertions, 3 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index 49feb255..340b938d 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -1670,7 +1670,7 @@ Result BinaryReaderIR::OnTableSymbol(Index index,
uint32_t flags,
std::string_view name,
Index table_index) {
- return SetTableName(index, name);
+ return SetTableName(table_index, name);
}
} // end anonymous namespace
diff --git a/test/binary/linking-section.txt b/test/binary/linking-section.txt
index a05c4a71..2e213427 100644
--- a/test/binary/linking-section.txt
+++ b/test/binary/linking-section.txt
@@ -1,12 +1,43 @@
;;; TOOL: run-objdump-gen-wasm
;;; ARGS: -x
+;;; RUN: %(wasm-validate)s %(temp_file)s.wasm --enable-all
magic
version
+section(TYPE) {
+ count[1]
+ function params[0] results[0]
+}
+section(FUNCTION) {
+ count[1]
+ type[0]
+}
+section(TABLE) {
+ count[1]
+ funcref
+ has_max[0]
+ initial[0]
+}
section(MEMORY) {
count[1]
has_max[0]
initial[0]
}
+section(TAG) {
+ count[1]
+ attr[0]
+ sig[0]
+}
+section(GLOBAL) {
+ count[1]
+ type[i32] met[0] init_expr[i32.const 0 end]
+}
+section(CODE) {
+ count[1]
+ func {
+ locals[0]
+ return
+ }
+}
section(DATA) {
count[2]
memory_index[0]
@@ -38,7 +69,7 @@ section("linking") {
}
section(LINKING_SYMBOL_TABLE) {
- num_symbols[4]
+ num_symbols[5]
type[0]
flags[1]
@@ -60,6 +91,11 @@ section("linking") {
type[0]
flags[0x10]
index[0]
+
+ type[5]
+ flags[1]
+ index[0]
+ str("table_sym")
}
section(LINKING_COMDAT_INFO) {
@@ -89,8 +125,20 @@ linking-section.wasm: file format wasm 0x1
Section Details:
+Type[1]:
+ - type[0] () -> nil
+Function[1]:
+ - func[0] sig=0 <func_sym>
+Table[1]:
+ - table[0] type=funcref initial=0 <table_sym>
Memory[1]:
- memory[0] pages: initial=0
+Tag[1]:
+ - tag[0] sig=0
+Global[1]:
+ - global[0] i32 mutable=0 <global_sym> - init i32=0
+Code[1]:
+ - func[0] size=3 <func_sym>
Data[2]:
- segment[0] <data1> memory=0 size=3 - init i32=0
- 0000000: 666f 6f foo
@@ -104,11 +152,12 @@ Custom:
- init functions [count=2]
- 1: priority=5
- 0: priority=6
- - symbol table [count=4]
+ - symbol table [count=5]
- 0: F <func_sym> func=0 [ binding=weak vis=default ]
- 1: G <global_sym> global=0 [ binding=local vis=default ]
- 2: D <data_sym> segment=1 offset=2 size=1 [ tls binding=global vis=hidden ]
- 3: F <func_sym> func=0 [ undefined binding=global vis=default ]
+ - 4: T <table_sym> table=0 [ binding=weak vis=default ]
- comdat groups [count=2]
- comdat1: [count=1]
- segment[1] <data2>
@@ -118,4 +167,7 @@ Custom:
Code Disassembly:
+00002e func[0] <func_sym>:
+ 00002f: 0f | return
+ 000030: 0b | end
;;; STDOUT ;;)