summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/WebAssembly/external-func-address.ll
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-06-13 01:42:21 +0000
committerSam Clegg <sbc@chromium.org>2017-06-13 01:42:21 +0000
commit7736855dee38bb7abcb05ad665b8775e58c145d9 (patch)
tree5a5b3ea97c06fe39415fcb71b66c249768a05295 /llvm/test/MC/WebAssembly/external-func-address.ll
parentf6137493829af06a98ec3d78f56e447c4de02909 (diff)
downloadbcm5719-llvm-7736855dee38bb7abcb05ad665b8775e58c145d9.tar.gz
bcm5719-llvm-7736855dee38bb7abcb05ad665b8775e58c145d9.zip
[WebAssembly] Fix symbol type for addresses of external functions
These symbols were previously not being marked as functions so were appearing as globals instead, and with the incorrect relocation type. Without this fix, objects that take address of external functions include them as global imports rather than function imports which then fails at link time. Differential Revision: https://reviews.llvm.org/D34068 llvm-svn: 305263
Diffstat (limited to 'llvm/test/MC/WebAssembly/external-func-address.ll')
-rw-r--r--llvm/test/MC/WebAssembly/external-func-address.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/MC/WebAssembly/external-func-address.ll b/llvm/test/MC/WebAssembly/external-func-address.ll
new file mode 100644
index 00000000000..4022b2c9bae
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/external-func-address.ll
@@ -0,0 +1,25 @@
+; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s
+; Verify that addresses of external functions generate correctly typed
+; imports and relocations or type R_TABLE_INDEX_I32.
+
+declare void @f1() #1
+@ptr_to_f1 = hidden global void ()* @f1, align 4
+
+
+; CHECK: - Type: IMPORT
+; CHECK: Imports:
+; CHECK: - Module: env
+; CHECK: Field: f1
+; CHECK: Kind: FUNCTION
+; CHECK: SigIndex: 0
+; CHECK: - Type: ELEM
+; CHECK: Segments:
+; CHECK: - Offset:
+; CHECK: Opcode: I32_CONST
+; CHECK: Value: 0
+; CHECK: Functions: [ 0 ]
+; CHECK: - Type: DATA
+; CHECK: Relocations:
+; CHECK: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
+; CHECK: Index: 0
+; CHECK: Offset: 0x00000006
OpenPOWER on IntegriCloud