forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Tim Northover
authored and
Tim Northover
committed
Feb 6, 2013
1 parent
2e402d5
commit 8a06229
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |