summaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64
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
commit8a06229c89f848bf742e2b88423d02558b7ca638 (patch)
tree199f15ef02b0e4e5077718feae6f418159dd965a /test/CodeGen/AArch64
parent2e402d5b5f2fce8bfe29509cc771b9919946003b (diff)
downloadllvm-8a06229c89f848bf742e2b88423d02558b7ca638.tar.gz
llvm-8a06229c89f848bf742e2b88423d02558b7ca638.tar.bz2
llvm-8a06229c89f848bf742e2b88423d02558b7ca638.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/AArch64')
-rw-r--r--test/CodeGen/AArch64/extern-weak.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/AArch64/extern-weak.ll b/test/CodeGen/AArch64/extern-weak.ll
new file mode 100644
index 0000000000..54baab2200
--- /dev/null
+++ b/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
+}