24 lines · plain
1; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s2; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj -o - %s3 4; LLVM gives well-defined semantics to this horrible construct (though C says5; it's undefined). Regardless, we shouldn't crash. The important feature here is6; that in general the only way to access a GOT symbol is via a 64-bit7; load. Neither of these alternatives has the ELF relocations required to8; support it:9; + ldr wD, [xN, #:got_lo12:func]10; + add xD, xN, #:got_lo12:func11 12declare void @consume(i32)13declare void @func()14 15define void @foo() nounwind {16; CHECK-LABEL: foo:17entry:18 call void @consume(i32 ptrtoint (ptr @func to i32))19; CHECK: adrp x[[ADDRHI:[0-9]+]], :got:func20; CHECK-NEXT: ldr {{x[0-9]+}}, [x[[ADDRHI]], {{#?}}:got_lo12:func]21 ret void22}23 24