1;; RUN: llc -mtriple=aarch64-none-linux-gnu -filetype=obj %s -o - | \ 2;; RUN: elf-dump | FileCheck -check-prefix=OBJ %s 3 4; Also take it on a round-trip through llvm-mc to stretch assembly-parsing's legs: 5;; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | \ 6;; RUN: llvm-mc -arch=aarch64 -filetype=obj -o - | \ 7;; RUN: elf-dump | FileCheck -check-prefix=OBJ %s 8 9@var8 = global i8 0 10@var16 = global i16 0 11@var32 = global i32 0 12@var64 = global i64 0 13 14define void @loadstore() { 15 %val8 = load i8* @var8 16 store volatile i8 %val8, i8* @var8 17 18 %val16 = load i16* @var16 19 store volatile i16 %val16, i16* @var16 20 21 %val32 = load i32* @var32 22 store volatile i32 %val32, i32* @var32 23 24 %val64 = load i64* @var64 25 store volatile i64 %val64, i64* @var64 26 27 ret void 28} 29 30@globaddr = global i64* null 31 32define void @address() { 33 store i64* @var64, i64** @globaddr 34 ret void 35} 36 37; Check we're using EM_AARCH64 38; OBJ: 'e_machine', 0x00 39 40; OBJ: .rela.text 41 42; var8 43; R_AARCH64_ADR_PREL_PG_HI21 against var8 44; OBJ: 'r_sym', 0x0000000f 45; OBJ-NEXT: 'r_type', 0x00000113 46 47; R_AARCH64_LDST8_ABS_LO12_NC against var8 48; OBJ: 'r_sym', 0x0000000f 49; OBJ-NEXT: 'r_type', 0x00000116 50 51 52; var16 53; R_AARCH64_ADR_PREL_PG_HI21 against var16 54; OBJ: 'r_sym', 0x0000000c 55; OBJ-NEXT: 'r_type', 0x00000113 56 57; R_AARCH64_LDST16_ABS_LO12_NC against var16 58; OBJ: 'r_sym', 0x0000000c 59; OBJ-NEXT: 'r_type', 0x0000011c 60 61 62; var32 63; R_AARCH64_ADR_PREL_PG_HI21 against var32 64; OBJ: 'r_sym', 0x0000000d 65; OBJ-NEXT: 'r_type', 0x00000113 66 67; R_AARCH64_LDST32_ABS_LO12_NC against var32 68; OBJ: 'r_sym', 0x0000000d 69; OBJ-NEXT: 'r_type', 0x0000011d 70 71 72; var64 73; R_AARCH64_ADR_PREL_PG_HI21 against var64 74; OBJ: 'r_sym', 0x0000000e 75; OBJ-NEXT: 'r_type', 0x00000113 76 77; R_AARCH64_LDST64_ABS_LO12_NC against var64 78; OBJ: 'r_sym', 0x0000000e 79; OBJ-NEXT: 'r_type', 0x0000011e 80 81; This is on the store, so not really important, but it stops the next 82; match working. 83; R_AARCH64_LDST64_ABS_LO12_NC against var64 84; OBJ: 'r_sym', 0x0000000e 85; OBJ-NEXT: 'r_type', 0x0000011e 86 87 88; Pure address-calculation against var64 89; R_AARCH64_ADR_PREL_PG_HI21 against var64 90; OBJ: 'r_sym', 0x0000000e 91; OBJ-NEXT: 'r_type', 0x00000113 92 93; R_AARCH64_ADD_ABS_LO12_NC against var64 94; OBJ: 'r_sym', 0x0000000e 95; OBJ-NEXT: 'r_type', 0x00000115 96 97 98; Make sure the symbols don't move around, otherwise relocation info 99; will be wrong: 100 101; OBJ: Symbol 12 102; OBJ-NEXT: var16 103 104; OBJ: Symbol 13 105; OBJ-NEXT: var32 106 107; OBJ: Symbol 14 108; OBJ-NEXT: var64 109 110; OBJ: Symbol 15 111; OBJ-NEXT: var8 112