1; RUN: llvm-mc -triple aarch64-windows -filetype obj -o %t.obj %s 2; RUN: llvm-readobj -r %t.obj | FileCheck %s 3; RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix=DISASM 4 5; IMAGE_REL_ARM64_ADDR32 6.Linfo_foo: 7 .asciz "foo" 8 .long foo 9 10; IMAGE_REL_ARM64_ADDR32NB 11.long func@IMGREL 12 13; IMAGE_REL_ARM64_ADDR64 14.globl struc 15struc: 16 .quad arr 17 18; IMAGE_REL_ARM64_BRANCH26 19b target 20 21; IMAGE_REL_ARM64_PAGEBASE_REL21 22adrp x0, foo 23 24; IMAGE_REL_ARM64_PAGEOFFSET_12A 25add x0, x0, :lo12:foo 26 27; IMAGE_REL_ARM64_PAGEOFFSET_12L 28ldr x0, [x0, :lo12:foo] 29 30; IMAGE_REL_ARM64_PAGEBASE_REL21, even if the symbol offset is known 31adrp x0, bar 32bar: 33 34; IMAGE_REL_ARM64_SECREL 35.secrel32 .Linfo_bar 36.Linfo_bar: 37 38; IMAGE_REL_ARM64_SECTION 39.secidx func 40 41.align 2 42adrp x0, baz + 0x12345 43baz: 44add x0, x0, :lo12:foo + 0x12345 45ldrb w0, [x0, :lo12:foo + 0x12345] 46ldr x0, [x0, :lo12:foo + 0x12348] 47 48; IMAGE_REL_ARM64_SECREL_LOW12A 49add x0, x0, :secrel_lo12:foo 50; IMAGE_REL_ARM64_SECREL_HIGH12A 51add x0, x0, :secrel_hi12:foo 52; IMAGE_REL_ARM64_SECREL_LOW12L 53ldr x0, [x0, :secrel_lo12:foo] 54 55; IMAGE_REL_ARM64_REL21 56adr x0, foo + 0x12345 57 58; IMAGE_REL_ARM64_BRANCH19 59bne target 60 61; IMAGE_REL_ARM64_BRANCH14 62tbz x0, #0, target 63 64; CHECK: Format: COFF-ARM64 65; CHECK: Arch: aarch64 66; CHECK: AddressSize: 64bit 67; CHECK: Relocations [ 68; CHECK: Section (1) .text { 69; CHECK: 0x4 IMAGE_REL_ARM64_ADDR32 foo 70; CHECK: 0x8 IMAGE_REL_ARM64_ADDR32NB func 71; CHECK: 0xC IMAGE_REL_ARM64_ADDR64 arr 72; CHECK: 0x14 IMAGE_REL_ARM64_BRANCH26 target 73; CHECK: 0x18 IMAGE_REL_ARM64_PAGEBASE_REL21 foo 74; CHECK: 0x1C IMAGE_REL_ARM64_PAGEOFFSET_12A foo 75; CHECK: 0x20 IMAGE_REL_ARM64_PAGEOFFSET_12L foo 76; CHECK: 0x24 IMAGE_REL_ARM64_PAGEBASE_REL21 bar 77; CHECK: 0x28 IMAGE_REL_ARM64_SECREL .text 78; CHECK: 0x2C IMAGE_REL_ARM64_SECTION func 79; CHECK: 0x30 IMAGE_REL_ARM64_PAGEBASE_REL21 baz 80; CHECK: 0x34 IMAGE_REL_ARM64_PAGEOFFSET_12A foo 81; CHECK: 0x38 IMAGE_REL_ARM64_PAGEOFFSET_12L foo 82; CHECK: 0x3C IMAGE_REL_ARM64_PAGEOFFSET_12L foo 83; CHECK: 0x40 IMAGE_REL_ARM64_SECREL_LOW12A foo 84; CHECK: 0x44 IMAGE_REL_ARM64_SECREL_HIGH12A foo 85; CHECK: 0x48 IMAGE_REL_ARM64_SECREL_LOW12L foo 86; CHECK: 0x4C IMAGE_REL_ARM64_REL21 foo 87; CHECK: 0x50 IMAGE_REL_ARM64_BRANCH19 target 88; CHECK: 0x54 IMAGE_REL_ARM64_BRANCH14 target 89; CHECK: } 90; CHECK: ] 91 92; DISASM: 30: 20 1a 09 b0 adrp x0, #305418240 93; DISASM: 34: 00 14 0d 91 add x0, x0, #837 94; DISASM: 38: 00 14 4d 39 ldrb w0, [x0, #837] 95; DISASM: 3c: 00 a4 41 f9 ldr x0, [x0, #840] 96; DISASM: 40: 00 00 00 91 add x0, x0, #0 97; DISASM: 44: 00 00 40 91 add x0, x0, #0, lsl #12 98; DISASM: 48: 00 00 40 f9 ldr x0, [x0] 99; DISASM: 4c: 20 1a 09 30 adr x0, #74565 100