Index: WebAssemblyAsmPrinter.cpp =================================================================== --- WebAssemblyAsmPrinter.cpp +++ WebAssemblyAsmPrinter.cpp @@ -90,10 +90,12 @@ } for (const auto &G : M.globals()) { if (!G.hasInitializer() && G.hasExternalLinkage()) { - uint16_t Size = M.getDataLayout().getTypeAllocSize(G.getValueType()); - getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier()); - OutStreamer->emitELFSize(getSymbol(&G), + if (G.getValueType()->isSized()) { + uint16_t Size = M.getDataLayout().getTypeAllocSize(G.getValueType()); + getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier()); + OutStreamer->emitELFSize(getSymbol(&G), MCConstantExpr::create(Size, OutContext)); + } } } }