mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
8a06229c89
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
14 lines
360 B
LLVM
14 lines
360 B
LLVM
; 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
|
|
}
|