Skip to content

Commit b03c2b4

Browse files
committedJul 10, 2017
[WebAssembly] Use the correct size for MCFillFragment
Summary: When implementing MCFillFragment, use the size of the fragment, rather than the size of the section. Patch by Dan Gohman Differential Revision: https://reviews.llvm.org/D35090 llvm-svn: 307565
1 parent 0ac065f commit b03c2b4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
 

‎llvm/lib/MC/WasmObjectWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm,
11971197
Align->getMaxBytesToEmit());
11981198
DataBytes.resize(Size, Value);
11991199
} else if (auto *Fill = dyn_cast<MCFillFragment>(&Frag)) {
1200-
DataBytes.insert(DataBytes.end(), Size, Fill->getValue());
1200+
DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue());
12011201
} else {
12021202
const auto &DataFrag = cast<MCDataFragment>(Frag);
12031203
const SmallVectorImpl<char> &Contents = DataFrag.getContents();
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
2+
; PR33624
3+
4+
source_filename = "ws.c"
5+
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6+
target triple = "wasm32-unknown-unknown-wasm"
7+
8+
%struct.bd = type { i8 }
9+
10+
@gBd = hidden global [2 x %struct.bd] [%struct.bd { i8 1 }, %struct.bd { i8 2 }], align 1
11+
12+
; CHECK: - Type: DATA
13+
; CHECK: Content: '0102'
14+
; CHECK: DataSize: 2

0 commit comments

Comments
 (0)
Please sign in to comment.