summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/WebAssembly
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-09-25 23:33:16 +0000
committerSam Clegg <sbc@chromium.org>2019-09-25 23:33:16 +0000
commit079cba04bfa95f34d4b9e667f722ff6ebdf13ba6 (patch)
treeb15eaabfe61e3fa5542488bca2ab5c92e4013b75 /llvm/test/MC/WebAssembly
parentf8804047af8c397db804e5775009981d96db8fb4 (diff)
downloadbcm5719-llvm-079cba04bfa95f34d4b9e667f722ff6ebdf13ba6.tar.gz
bcm5719-llvm-079cba04bfa95f34d4b9e667f722ff6ebdf13ba6.zip
[MC][WebAssembly] Error on data symbols in the text section.
Previously we had an assert but this can actually occur in valid user code so we need to handle this in release builds too. Differential Revision: https://reviews.llvm.org/D67997 llvm-svn: 372934
Diffstat (limited to 'llvm/test/MC/WebAssembly')
-rw-r--r--llvm/test/MC/WebAssembly/data-symbol-in-text-section.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/MC/WebAssembly/data-symbol-in-text-section.ll b/llvm/test/MC/WebAssembly/data-symbol-in-text-section.ll
new file mode 100644
index 00000000000..7e9b28ac243
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/data-symbol-in-text-section.ll
@@ -0,0 +1,13 @@
+; RUN: not llc -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
+; CHECK: data symbols must live in a data section: data_symbol
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+@data_symbol = constant [1024 x i32] zeroinitializer, section ".text", align 16
+
+define hidden i32 @main() local_unnamed_addr #0 {
+entry:
+ %0 = load i32, i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @data_symbol, i32 0, i32 10)
+ ret i32 %0
+}
OpenPOWER on IntegriCloud