summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen')
-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