llvm-6502/test/CodeGen/AArch64/adrp-relocation.ll
Tim Northover 1e8839302b AArch64: remove ConstantIsland pass & put literals in separate section.
This implements the review suggestion to simplify the AArch64 backend. If we
later discover that we *really* need the extra complexity of the
ConstantIslands pass for performance reasons it can be resurrected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175258 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 09:33:43 +00:00

36 lines
1.1 KiB
LLVM

; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -filetype=obj < %s | elf-dump | FileCheck %s
define i64 @testfn() nounwind {
entry:
ret i64 0
}
define i64 @foo() nounwind {
entry:
%bar = alloca i64 ()*, align 8
store i64 ()* @testfn, i64 ()** %bar, align 8
%call = call i64 @testfn()
ret i64 %call
}
; The above should produce an ADRP/ADD pair to calculate the address of
; testfn. The important point is that LLVM shouldn't think it can deal with the
; relocation on the ADRP itself (even though it knows everything about the
; relative offsets of testfn and foo) because its value depends on where this
; object file's .text section gets relocated in memory.
; CHECK: .rela.text
; CHECK: # Relocation 0
; CHECK-NEXT: (('r_offset', 0x0000000000000010)
; CHECK-NEXT: ('r_sym', 0x00000007)
; CHECK-NEXT: ('r_type', 0x00000113)
; CHECK-NEXT: ('r_addend', 0x0000000000000000)
; CHECK-NEXT: ),
; CHECK-NEXT: Relocation 1
; CHECK-NEXT: (('r_offset', 0x0000000000000014)
; CHECK-NEXT: ('r_sym', 0x00000007)
; CHECK-NEXT: ('r_type', 0x00000115)
; CHECK-NEXT: ('r_addend', 0x0000000000000000)
; CHECK-NEXT: ),