diff options
| author | Dan Gohman <dan433584@gmail.com> | 2017-12-05 17:21:57 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2017-12-05 17:21:57 +0000 |
| commit | f7172f4ab095c641c36ce205d6c7e965b2b5b67c (patch) | |
| tree | b9b317b0b1e6403a5ac8fdbc3358ca0a6d77e539 /llvm | |
| parent | 06be6debbc005a45493c81643729b32bd3754f38 (diff) | |
| download | bcm5719-llvm-f7172f4ab095c641c36ce205d6c7e965b2b5b67c.tar.gz bcm5719-llvm-f7172f4ab095c641c36ce205d6c7e965b2b5b67c.zip | |
[WebAssembly] Don't emit .import_global for the wasm target.
.import_global is used by the ELF-based target and not needed by the wasm
target.
llvm-svn: 319796
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/globl.ll | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index ee60c8f3a7a..5f7f3d694cd 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -91,7 +91,8 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { for (const auto &G : M.globals()) { if (!G.hasInitializer() && G.hasExternalLinkage()) { uint16_t Size = M.getDataLayout().getTypeAllocSize(G.getValueType()); - getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier()); + if (TM.getTargetTriple().isOSBinFormatELF()) + getTargetStreamer()->emitGlobalImport(G.getGlobalIdentifier()); OutStreamer->emitELFSize(getSymbol(&G), MCConstantExpr::create(Size, OutContext)); } diff --git a/llvm/test/CodeGen/WebAssembly/globl.ll b/llvm/test/CodeGen/WebAssembly/globl.ll index ba9f6659d7d..c3126d55863 100644 --- a/llvm/test/CodeGen/WebAssembly/globl.ll +++ b/llvm/test/CodeGen/WebAssembly/globl.ll @@ -4,11 +4,14 @@ target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown-wasm" ; CHECK: .globl foo +; CHECK: .type foo,@function ; CHECK-LABEL: foo: -define void @foo() { - ret void +; CHECK: .size foo, +define i32* @foo() { + ret i32* @bar } -; Check import directives - must be at the end of the file -; CHECK: .import_global bar{{$}} -@bar = external global i32 +; CHECK: .type bar,@object +; CHECK: .globl bar +; CHECK: .size bar, 4 +@bar = global i32 2 |

