summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binary-writer.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/binary-writer.cc b/src/binary-writer.cc
index 3ad5e53b..ec8d9dbd 100644
--- a/src/binary-writer.cc
+++ b/src/binary-writer.cc
@@ -323,8 +323,10 @@ Index BinaryWriter::GetSymbolIndex(RelocType reloc_type, Index index) {
type = SymbolType::Global;
name = module_->globals[index]->name;
break;
+ case RelocType::TypeIndexLEB:
+ // type indexes don't create entries in the symbol table, instead their index is directly used
+ return index;
default:
- // TODO: Add support for TypeIndexLEB.
fprintf(stderr, "warning: unsupported relocation type: %s\n",
GetRelocTypeName(reloc_type));
return kInvalidIndex;
@@ -1146,9 +1148,7 @@ Result BinaryWriter::WriteModule() {
case ElemExprKind::RefFunc:
WriteOpcode(stream_, Opcode::RefFunc);
- WriteU32Leb128WithReloc(module_->GetFuncIndex(elem_expr.var),
- "elem expr function index",
- RelocType::FuncIndexLEB);
+ WriteU32Leb128(stream_, module_->GetFuncIndex(elem_expr.var), "elem expr function index");
break;
}
WriteOpcode(stream_, Opcode::End);
@@ -1156,9 +1156,7 @@ Result BinaryWriter::WriteModule() {
} else {
for (const ElemExpr& elem_expr : segment->elem_exprs) {
assert(elem_expr.kind == ElemExprKind::RefFunc);
- WriteU32Leb128WithReloc(module_->GetFuncIndex(elem_expr.var),
- "elem function index",
- RelocType::FuncIndexLEB);
+ WriteU32Leb128(stream_, module_->GetFuncIndex(elem_expr.var), "elem function index");
}
}
}