1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic < %s | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj < %s
3 ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s
4 ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -filetype=obj -o - %s
6 ; LLVM gives well-defined semantics to this horrible construct (though C says
7 ; it's undefined). Regardless, we shouldn't crash. The important feature here is
8 ; that in general the only way to access a GOT symbol is via a 64-bit
9 ; load. Neither of these alternatives has the ELF relocations required to
11 ; + ldr wD, [xN, #:got_lo12:func]
12 ; + add xD, xN, #:got_lo12:func
14 declare void @consume(i32)
17 define void @foo() nounwind {
20 call void @consume(i32 ptrtoint (void ()* @func to i32))
21 ; CHECK: adrp x[[ADDRHI:[0-9]+]], :got:func
22 ; CHECK: ldr {{x[0-9]+}}, [x[[ADDRHI]], {{#?}}:got_lo12:func]