1; RUN: llvm-mc -n -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s 2 3 .text 4_fred: 5 bl _func 6 bl _func + 20 7 8 adrp x3, _data@page 9 ldr w2, [x3, _data@pageoff] 10 11 add x3, x3, _data@pageoff + 4 12 13 adrp x3, _data@page+1 14 ldr w2, [x3, _data@pageoff + 4] 15 16 adrp x3, _data_ext@gotpage 17 ldr w2, [x3, _data_ext@gotpageoff] 18 adrp x0, L_.str@PAGE 19 20 .data 21_data: 22 .quad _foo 23 .quad _foo + 4 24 .quad _foo - _bar 25 .quad _foo - _bar + 4 26 27 .long _foo - _bar 28 29 .quad _foo@got 30 .long _foo@got - . 31 32 .section __TEXT,__cstring,cstring_literals 33L_.str: 34 .asciz "foo" 35 36 37; CHECK: Relocations [ 38; CHECK-NEXT: Section __text { 39; CHECK-NEXT: Relocation { 40; CHECK-NEXT: Offset: 0x24 41; CHECK-NEXT: PCRel: 1 42; CHECK-NEXT: Length: 2 43; CHECK-NEXT: Extern: 1 44; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3) 45; CHECK-NEXT: Symbol: L_.str 46; CHECK-NEXT: Scattered: 0 47; CHECK-NEXT: } 48; CHECK-NEXT: Relocation { 49; CHECK-NEXT: Offset: 0x20 50; CHECK-NEXT: PCRel: 0 51; CHECK-NEXT: Length: 2 52; CHECK-NEXT: Extern: 1 53; CHECK-NEXT: Type: ARM64_RELOC_GOT_LOAD_PAGEOFF12 (6) 54; CHECK-NEXT: Symbol: _data_ext 55; CHECK-NEXT: Scattered: 0 56; CHECK-NEXT: } 57; CHECK-NEXT: Relocation { 58; CHECK-NEXT: Offset: 0x1C 59; CHECK-NEXT: PCRel: 1 60; CHECK-NEXT: Length: 2 61; CHECK-NEXT: Extern: 1 62; CHECK-NEXT: Type: ARM64_RELOC_GOT_LOAD_PAGE21 (5) 63; CHECK-NEXT: Symbol: _data_ext 64; CHECK-NEXT: Scattered: 0 65; CHECK-NEXT: } 66; CHECK-NEXT: Relocation { 67; CHECK-NEXT: Offset: 0x18 68; CHECK-NEXT: PCRel: 0 69; CHECK-NEXT: Length: 2 70; CHECK-NEXT: Extern: 0 71; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10) 72; CHECK-NEXT: Symbol: 0x4 73; CHECK-NEXT: Scattered: 0 74; CHECK-NEXT: } 75; CHECK-NEXT: Relocation { 76; CHECK-NEXT: Offset: 0x18 77; CHECK-NEXT: PCRel: 0 78; CHECK-NEXT: Length: 2 79; CHECK-NEXT: Extern: 1 80; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4) 81; CHECK-NEXT: Symbol: _data 82; CHECK-NEXT: Scattered: 0 83; CHECK-NEXT: } 84; CHECK-NEXT: Relocation { 85; CHECK-NEXT: Offset: 0x14 86; CHECK-NEXT: PCRel: 0 87; CHECK-NEXT: Length: 2 88; CHECK-NEXT: Extern: 0 89; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10) 90; CHECK-NEXT: Symbol: 0x1 91; CHECK-NEXT: Scattered: 0 92; CHECK-NEXT: } 93; CHECK-NEXT: Relocation { 94; CHECK-NEXT: Offset: 0x14 95; CHECK-NEXT: PCRel: 1 96; CHECK-NEXT: Length: 2 97; CHECK-NEXT: Extern: 1 98; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3) 99; CHECK-NEXT: Symbol: _data 100; CHECK-NEXT: Scattered: 0 101; CHECK-NEXT: } 102; CHECK-NEXT: Relocation { 103; CHECK-NEXT: Offset: 0x10 104; CHECK-NEXT: PCRel: 0 105; CHECK-NEXT: Length: 2 106; CHECK-NEXT: Extern: 0 107; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10) 108; CHECK-NEXT: Symbol: 0x4 109; CHECK-NEXT: Scattered: 0 110; CHECK-NEXT: } 111; CHECK-NEXT: Relocation { 112; CHECK-NEXT: Offset: 0x10 113; CHECK-NEXT: PCRel: 0 114; CHECK-NEXT: Length: 2 115; CHECK-NEXT: Extern: 1 116; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4) 117; CHECK-NEXT: Symbol: _data 118; CHECK-NEXT: Scattered: 0 119; CHECK-NEXT: } 120; CHECK-NEXT: Relocation { 121; CHECK-NEXT: Offset: 0xC 122; CHECK-NEXT: PCRel: 0 123; CHECK-NEXT: Length: 2 124; CHECK-NEXT: Extern: 1 125; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4) 126; CHECK-NEXT: Symbol: _data 127; CHECK-NEXT: Scattered: 0 128; CHECK-NEXT: } 129; CHECK-NEXT: Relocation { 130; CHECK-NEXT: Offset: 0x8 131; CHECK-NEXT: PCRel: 1 132; CHECK-NEXT: Length: 2 133; CHECK-NEXT: Extern: 1 134; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3) 135; CHECK-NEXT: Symbol: _data 136; CHECK-NEXT: Scattered: 0 137; CHECK-NEXT: } 138; CHECK-NEXT: Relocation { 139; CHECK-NEXT: Offset: 0x4 140; CHECK-NEXT: PCRel: 0 141; CHECK-NEXT: Length: 2 142; CHECK-NEXT: Extern: 0 143; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10) 144; CHECK-NEXT: Symbol: 0x14 145; CHECK-NEXT: Scattered: 0 146; CHECK-NEXT: } 147; CHECK-NEXT: Relocation { 148; CHECK-NEXT: Offset: 0x4 149; CHECK-NEXT: PCRel: 1 150; CHECK-NEXT: Length: 2 151; CHECK-NEXT: Extern: 1 152; CHECK-NEXT: Type: ARM64_RELOC_BRANCH26 (2) 153; CHECK-NEXT: Symbol: _func 154; CHECK-NEXT: Scattered: 0 155; CHECK-NEXT: } 156; CHECK-NEXT: Relocation { 157; CHECK-NEXT: Offset: 0x0 158; CHECK-NEXT: PCRel: 1 159; CHECK-NEXT: Length: 2 160; CHECK-NEXT: Extern: 1 161; CHECK-NEXT: Type: ARM64_RELOC_BRANCH26 (2) 162; CHECK-NEXT: Symbol: _func 163; CHECK-NEXT: Scattered: 0 164; CHECK-NEXT: } 165; CHECK-NEXT: } 166; CHECK-NEXT: Section __data { 167; CHECK-NEXT: Relocation { 168; CHECK-NEXT: Offset: 0x2C 169; CHECK-NEXT: PCRel: 1 170; CHECK-NEXT: Length: 2 171; CHECK-NEXT: Extern: 1 172; CHECK-NEXT: Type: ARM64_RELOC_POINTER_TO_GOT (7) 173; CHECK-NEXT: Symbol: _foo 174; CHECK-NEXT: Scattered: 0 175; CHECK-NEXT: } 176; CHECK-NEXT: Relocation { 177; CHECK-NEXT: Offset: 0x24 178; CHECK-NEXT: PCRel: 0 179; CHECK-NEXT: Length: 3 180; CHECK-NEXT: Extern: 1 181; CHECK-NEXT: Type: ARM64_RELOC_POINTER_TO_GOT (7) 182; CHECK-NEXT: Symbol: _foo 183; CHECK-NEXT: Scattered: 0 184; CHECK-NEXT: } 185; CHECK-NEXT: Relocation { 186; CHECK-NEXT: Offset: 0x20 187; CHECK-NEXT: PCRel: 0 188; CHECK-NEXT: Length: 2 189; CHECK-NEXT: Extern: 1 190; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1) 191; CHECK-NEXT: Symbol: _bar 192; CHECK-NEXT: Scattered: 0 193; CHECK-NEXT: } 194; CHECK-NEXT: Relocation { 195; CHECK-NEXT: Offset: 0x20 196; CHECK-NEXT: PCRel: 0 197; CHECK-NEXT: Length: 2 198; CHECK-NEXT: Extern: 1 199; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0) 200; CHECK-NEXT: Symbol: _foo 201; CHECK-NEXT: Scattered: 0 202; CHECK-NEXT: } 203; CHECK-NEXT: Relocation { 204; CHECK-NEXT: Offset: 0x18 205; CHECK-NEXT: PCRel: 0 206; CHECK-NEXT: Length: 3 207; CHECK-NEXT: Extern: 1 208; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1) 209; CHECK-NEXT: Symbol: _bar 210; CHECK-NEXT: Scattered: 0 211; CHECK-NEXT: } 212; CHECK-NEXT: Relocation { 213; CHECK-NEXT: Offset: 0x18 214; CHECK-NEXT: PCRel: 0 215; CHECK-NEXT: Length: 3 216; CHECK-NEXT: Extern: 1 217; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0) 218; CHECK-NEXT: Symbol: _foo 219; CHECK-NEXT: Scattered: 0 220; CHECK-NEXT: } 221; CHECK-NEXT: Relocation { 222; CHECK-NEXT: Offset: 0x10 223; CHECK-NEXT: PCRel: 0 224; CHECK-NEXT: Length: 3 225; CHECK-NEXT: Extern: 1 226; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1) 227; CHECK-NEXT: Symbol: _bar 228; CHECK-NEXT: Scattered: 0 229; CHECK-NEXT: } 230; CHECK-NEXT: Relocation { 231; CHECK-NEXT: Offset: 0x10 232; CHECK-NEXT: PCRel: 0 233; CHECK-NEXT: Length: 3 234; CHECK-NEXT: Extern: 1 235; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0) 236; CHECK-NEXT: Symbol: _foo 237; CHECK-NEXT: Scattered: 0 238; CHECK-NEXT: } 239; CHECK-NEXT: Relocation { 240; CHECK-NEXT: Offset: 0x8 241; CHECK-NEXT: PCRel: 0 242; CHECK-NEXT: Length: 3 243; CHECK-NEXT: Extern: 1 244; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0) 245; CHECK-NEXT: Symbol: _foo 246; CHECK-NEXT: Scattered: 0 247; CHECK-NEXT: } 248; CHECK-NEXT: Relocation { 249; CHECK-NEXT: Offset: 0x0 250; CHECK-NEXT: PCRel: 0 251; CHECK-NEXT: Length: 3 252; CHECK-NEXT: Extern: 1 253; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0) 254; CHECK-NEXT: Symbol: _foo 255; CHECK-NEXT: Scattered: 0 256; CHECK-NEXT: } 257; CHECK-NEXT: } 258; CHECK-NEXT: ] 259