summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/WebAssembly/external-data.ll
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-06-02 01:05:24 +0000
committerSam Clegg <sbc@chromium.org>2017-06-02 01:05:24 +0000
commitc38e947e506f152b75df8148e5c1e95eea3fe6b7 (patch)
tree5c5d15593d258097dd9b9fcab2f2154fc6424fa9 /llvm/test/MC/WebAssembly/external-data.ll
parent1800814b41ebe23706a45f821ec7a6866dbad6f3 (diff)
downloadbcm5719-llvm-c38e947e506f152b75df8148e5c1e95eea3fe6b7.tar.gz
bcm5719-llvm-c38e947e506f152b75df8148e5c1e95eea3fe6b7.zip
[WebAssembly] MC: Fix references to undefined externals in data section
Undefined externals don't need to have a size or an offset. This was broken by r303915. Added a test for this case. This fixes the "Compile LLVM Torture (o)" step on the wasm waterfall. Differential Revision: https://reviews.llvm.org/D33803 llvm-svn: 304505
Diffstat (limited to 'llvm/test/MC/WebAssembly/external-data.ll')
-rw-r--r--llvm/test/MC/WebAssembly/external-data.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/MC/WebAssembly/external-data.ll b/llvm/test/MC/WebAssembly/external-data.ll
new file mode 100644
index 00000000000..91e05b3f13a
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/external-data.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s
+; Verify relocations are correctly generated for addresses of externals
+; in the data section.
+
+declare i32 @f1(...)
+
+@foo = global i64 7, align 4
+@far = local_unnamed_addr global i32 (...)* @f1, align 4
+
+; CHECK: - Type: DATA
+; CHECK: Relocations:
+; CHECK: - Type: R_WEBASSEMBLY_GLOBAL_ADDR_I32
+; CHECK: Index: 0
+; CHECK: Offset: 0x0000000E
+; CHECK: Segments:
+; CHECK: - Index: 0
+; CHECK: Offset:
+; CHECK: Opcode: I32_CONST
+; CHECK: Value: 0
+; CHECK: Content: 0700000000000000FFFFFFFF
+
OpenPOWER on IntegriCloud