[PATCH] D43947: [WebAssembly] Add assertion for init function signature
Nicholas Wilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 06:49:11 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL326579: [WebAssembly] Add validation for init function signature (authored by ncw, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43947?vs=136543&id=136741#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43947
Files:
lld/trunk/wasm/Writer.cpp
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -893,9 +893,12 @@
void Writer::calculateInitFunctions() {
for (ObjFile *File : Symtab->ObjectFiles) {
const WasmLinkingData &L = File->getWasmObj()->linkingData();
- for (const WasmInitFunc &F : L.InitFunctions)
- InitFunctions.emplace_back(
- WasmInitEntry{File->getFunctionSymbol(F.Symbol), F.Priority});
+ for (const WasmInitFunc &F : L.InitFunctions) {
+ FunctionSymbol *Sym = File->getFunctionSymbol(F.Symbol);
+ if (*Sym->getFunctionType() != WasmSignature{{}, WASM_TYPE_NORESULT})
+ error("invalid signature for init func: " + toString(*Sym));
+ InitFunctions.emplace_back(WasmInitEntry{Sym, F.Priority});
+ }
}
// Sort in order of priority (lowest first) so that they are called
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43947.136741.patch
Type: text/x-patch
Size: 913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/82017d0a/attachment.bin>
More information about the llvm-commits
mailing list