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