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