mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[WebAssembly] Don't try to emit size information for unsized types
Patch by John Sully! Fixes PR35164. Differential Revision: https://reviews.llvm.org/D39519 llvm-svn: 319991
This commit is contained in:
parent
54a36e6cb7
commit
79ec459a34
@ -90,11 +90,13 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
}
|
||||
for (const auto &G : M.globals()) {
|
||||
if (!G.hasInitializer() && G.hasExternalLinkage()) {
|
||||
uint16_t Size = M.getDataLayout().getTypeAllocSize(G.getValueType());
|
||||
if (TM.getTargetTriple().isOSBinFormatELF())
|
||||
getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier());
|
||||
OutStreamer->emitELFSize(getSymbol(&G),
|
||||
MCConstantExpr::create(Size, OutContext));
|
||||
if (G.getValueType()->isSized()) {
|
||||
uint16_t Size = M.getDataLayout().getTypeAllocSize(G.getValueType());
|
||||
if (TM.getTargetTriple().isOSBinFormatELF())
|
||||
getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier());
|
||||
OutStreamer->emitELFSize(getSymbol(&G),
|
||||
MCConstantExpr::create(Size, OutContext));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,3 +213,10 @@ define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {
|
||||
; CHECK-NEXT: .size pointer_to_array, 4
|
||||
@array = internal constant [8 x i8] zeroinitializer, align 1
|
||||
@pointer_to_array = constant i8* getelementptr inbounds ([8 x i8], [8 x i8]* @array, i32 0, i32 4), align 4
|
||||
|
||||
; Handle external objects with opaque type.
|
||||
%struct.ASTRUCT = type opaque
|
||||
@g_struct = external global %struct.ASTRUCT, align 1
|
||||
define i32 @address_of_opaque() {
|
||||
ret i32 ptrtoint (%struct.ASTRUCT* @g_struct to i32)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user