summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorTim Northover <Tim.Northover@arm.com>2013-02-06 16:43:33 +0000
committerTim Northover <Tim.Northover@arm.com>2013-02-06 16:43:33 +0000
commit228d9d3aa25f95c3fae5b38aa58d82e17f465ab8 (patch)
tree88ffd984e91fa56e5289db0dfc3452ac617037ff /llvm/test
parent82b836a61dc4be6a7b64e9df06dddee62ffe39bc (diff)
downloadbcm5719-llvm-228d9d3aa25f95c3fae5b38aa58d82e17f465ab8.tar.gz
bcm5719-llvm-228d9d3aa25f95c3fae5b38aa58d82e17f465ab8.zip
Implement external weak (ELF) symbols on AArch64
Weakly defined symbols should evaluate to 0 if they're undefined at link-time. This is impossible to do with the usual address generation patterns, so we should use a literal pool entry to materlialise the address. llvm-svn: 174518
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/AArch64/extern-weak.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/extern-weak.ll b/llvm/test/CodeGen/AArch64/extern-weak.ll
new file mode 100644
index 00000000000..54baab2200b
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/extern-weak.ll
@@ -0,0 +1,13 @@
+; RUN: llc -mtriple=aarch64-none-linux-gnu -o - < %s | FileCheck %s
+
+declare extern_weak i32 @var()
+
+define i32()* @foo() {
+; The usual ADRP/ADD pair can't be used for a weak reference because it must
+; evaluate to 0 if the symbol is undefined. We use a litpool entry.
+ ret i32()* @var
+; CHECK: ldr x0, .LCPI0_0
+
+; CHECK: .LCPI0_0:
+; CHECK-NEXT: .xword var
+}
OpenPOWER on IntegriCloud