1RUN: llvm-readobj -r %p/Inputs/trivial.obj.coff-i386 \ 2RUN: | FileCheck %s -check-prefix COFF 3RUN: llvm-readobj -r %p/Inputs/bad-relocs.obj.coff-i386 \ 4RUN: | FileCheck %s -check-prefix BAD-COFF-RELOCS 5RUN: llvm-readobj -r %p/Inputs/relocs-no-symtab.obj.coff-i386 \ 6RUN: | FileCheck %s -check-prefix BAD-COFF-RELOCS 7RUN: llvm-readobj -r %p/Inputs/trivial.obj.elf-i386 \ 8RUN: | FileCheck %s -check-prefix ELF 9RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-i386 \ 10RUN: | FileCheck %s -check-prefix MACHO-I386 11RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-x86-64 \ 12RUN: | FileCheck %s -check-prefix MACHO-X86-64 13RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc \ 14RUN: | FileCheck %s -check-prefix MACHO-PPC 15RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc64 \ 16RUN: | FileCheck %s -check-prefix MACHO-PPC64 17RUN: llvm-readobj -r -expand-relocs %p/Inputs/trivial.obj.macho-arm \ 18RUN: | FileCheck %s -check-prefix MACHO-ARM 19 20COFF: Relocations [ 21COFF-NEXT: Section (1) .text { 22COFF-NEXT: 0x4 IMAGE_REL_I386_DIR32 .data 23COFF-NEXT: 0x9 IMAGE_REL_I386_REL32 _puts 24COFF-NEXT: 0xE IMAGE_REL_I386_REL32 _SomeOtherFunction 25COFF-NEXT: } 26COFF-NEXT: ] 27 28BAD-COFF-RELOCS: Relocations [ 29BAD-COFF-RELOCS-NEXT: Section (1) sec { 30BAD-COFF-RELOCS-NEXT: 0xDEADBEEF IMAGE_REL_I386_ABSOLUTE - 31BAD-COFF-RELOCS-NEXT: } 32BAD-COFF-RELOCS-NEXT: ] 33 34ELF: Relocations [ 35ELF-NEXT: Section (2) .rel.text { 36ELF-NEXT: 0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0 37ELF-NEXT: 0x12 R_386_GOTOFF .L.str 0x0 38ELF-NEXT: 0x1A R_386_PLT32 puts 0x0 39ELF-NEXT: 0x1F R_386_PLT32 SomeOtherFunction 0x0 40ELF-NEXT: } 41ELF-NEXT: ] 42 43MACHO-I386: Relocations [ 44MACHO-I386-NEXT: Section __text { 45MACHO-I386-NEXT: 0x18 1 2 1 GENERIC_RELOC_VANILLA 0 _SomeOtherFunction 46MACHO-I386-NEXT: 0x13 1 2 1 GENERIC_RELOC_VANILLA 0 _puts 47MACHO-I386-NEXT: 0xB 0 2 n/a GENERIC_RELOC_LOCAL_SECTDIFF 1 0x22 48MACHO-I386-NEXT: 0x0 0 2 n/a GENERIC_RELOC_PAIR 1 0x8 49MACHO-I386-NEXT: } 50MACHO-I386-NEXT: ] 51 52MACHO-X86-64: Relocations [ 53MACHO-X86-64-NEXT: Section __text { 54MACHO-X86-64-NEXT: 0xE 1 2 1 X86_64_RELOC_BRANCH 0 _SomeOtherFunction 55MACHO-X86-64-NEXT: 0x9 1 2 1 X86_64_RELOC_BRANCH 0 _puts 56MACHO-X86-64-NEXT: 0x4 1 2 1 X86_64_RELOC_SIGNED 0 L_.str 57MACHO-X86-64-NEXT: } 58MACHO-X86-64-NEXT:] 59 60MACHO-PPC: Relocations [ 61MACHO-PPC-NEXT: Section __text { 62MACHO-PPC-NEXT: Relocation { 63MACHO-PPC-NEXT: Offset: 0x24 64MACHO-PPC-NEXT: PCRel: 0 65MACHO-PPC-NEXT: Length: 2 66MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11) 67MACHO-PPC-NEXT: Value: 0x64 68MACHO-PPC-NEXT: } 69MACHO-PPC-NEXT: Relocation { 70MACHO-PPC-NEXT: Offset: 0x0 71MACHO-PPC-NEXT: PCRel: 0 72MACHO-PPC-NEXT: Length: 2 73MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1) 74MACHO-PPC-NEXT: Value: 0xC 75MACHO-PPC-NEXT: } 76MACHO-PPC-NEXT: Relocation { 77MACHO-PPC-NEXT: Offset: 0x1C 78MACHO-PPC-NEXT: PCRel: 0 79MACHO-PPC-NEXT: Length: 2 80MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12) 81MACHO-PPC-NEXT: Value: 0x64 82MACHO-PPC-NEXT: } 83MACHO-PPC-NEXT: Relocation { 84MACHO-PPC-NEXT: Offset: 0x58 85MACHO-PPC-NEXT: PCRel: 0 86MACHO-PPC-NEXT: Length: 2 87MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1) 88MACHO-PPC-NEXT: Value: 0xC 89MACHO-PPC-NEXT: } 90MACHO-PPC-NEXT: Relocation { 91MACHO-PPC-NEXT: Offset: 0x18 92MACHO-PPC-NEXT: PCRel: 1 93MACHO-PPC-NEXT: Length: 2 94MACHO-PPC-NEXT: Type: PPC_RELOC_BR24 (3) 95MACHO-PPC-NEXT: Section: __picsymbolstub1 (2) 96MACHO-PPC-NEXT: } 97MACHO-PPC-NEXT: } 98MACHO-PPC-NEXT: Section __picsymbolstub1 { 99MACHO-PPC-NEXT: Relocation { 100MACHO-PPC-NEXT: Offset: 0x14 101MACHO-PPC-NEXT: PCRel: 0 102MACHO-PPC-NEXT: Length: 2 103MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11) 104MACHO-PPC-NEXT: Value: 0x68 105MACHO-PPC-NEXT: } 106MACHO-PPC-NEXT: Relocation { 107MACHO-PPC-NEXT: Offset: 0x0 108MACHO-PPC-NEXT: PCRel: 0 109MACHO-PPC-NEXT: Length: 2 110MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1) 111MACHO-PPC-NEXT: Value: 0x48 112MACHO-PPC-NEXT: } 113MACHO-PPC-NEXT: Relocation { 114MACHO-PPC-NEXT: Offset: 0xC 115MACHO-PPC-NEXT: PCRel: 0 116MACHO-PPC-NEXT: Length: 2 117MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12) 118MACHO-PPC-NEXT: Value: 0x68 119MACHO-PPC-NEXT: } 120MACHO-PPC-NEXT: Relocation { 121MACHO-PPC-NEXT: Offset: 0x20 122MACHO-PPC-NEXT: PCRel: 0 123MACHO-PPC-NEXT: Length: 2 124MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1) 125MACHO-PPC-NEXT: Value: 0x48 126MACHO-PPC-NEXT: } 127MACHO-PPC-NEXT: } 128MACHO-PPC-NEXT: Section __la_symbol_ptr { 129MACHO-PPC-NEXT: Relocation { 130MACHO-PPC-NEXT: Offset: 0x0 131MACHO-PPC-NEXT: PCRel: 0 132MACHO-PPC-NEXT: Length: 2 133MACHO-PPC-NEXT: Type: PPC_RELOC_VANILLA (0) 134MACHO-PPC-NEXT: Symbol: dyld_stub_binding_helper (5) 135MACHO-PPC-NEXT: } 136MACHO-PPC-NEXT: } 137MACHO-PPC-NEXT: ] 138 139MACHO-PPC64: Relocations [ 140MACHO-PPC64-NEXT: Section __text { 141MACHO-PPC64-NEXT: Relocation { 142MACHO-PPC64-NEXT: Offset: 0x24 143MACHO-PPC64-NEXT: PCRel: 0 144MACHO-PPC64-NEXT: Length: 2 145MACHO-PPC64-NEXT: Type: (14) 146MACHO-PPC64-NEXT: Value: 0x64 147MACHO-PPC64-NEXT: } 148MACHO-PPC64-NEXT: Relocation { 149MACHO-PPC64-NEXT: Offset: 0x0 150MACHO-PPC64-NEXT: PCRel: 0 151MACHO-PPC64-NEXT: Length: 2 152MACHO-PPC64-NEXT: Type: (1) 153MACHO-PPC64-NEXT: Value: 0xC 154MACHO-PPC64-NEXT: } 155MACHO-PPC64-NEXT: Relocation { 156MACHO-PPC64-NEXT: Offset: 0x1C 157MACHO-PPC64-NEXT: PCRel: 0 158MACHO-PPC64-NEXT: Length: 2 159MACHO-PPC64-NEXT: Type: (12) 160MACHO-PPC64-NEXT: Value: 0x64 161MACHO-PPC64-NEXT: } 162MACHO-PPC64-NEXT: Relocation { 163MACHO-PPC64-NEXT: Offset: 0x58 164MACHO-PPC64-NEXT: PCRel: 0 165MACHO-PPC64-NEXT: Length: 2 166MACHO-PPC64-NEXT: Type: (1) 167MACHO-PPC64-NEXT: Value: 0xC 168MACHO-PPC64-NEXT: } 169MACHO-PPC64-NEXT: Relocation { 170MACHO-PPC64-NEXT: Offset: 0x18 171MACHO-PPC64-NEXT: PCRel: 1 172MACHO-PPC64-NEXT: Length: 2 173MACHO-PPC64-NEXT: Type: (3) 174MACHO-PPC64-NEXT: Section: __picsymbolstub1 (2) 175MACHO-PPC64-NEXT: } 176MACHO-PPC64-NEXT: } 177MACHO-PPC64-NEXT: Section __picsymbolstub1 { 178MACHO-PPC64-NEXT: Relocation { 179MACHO-PPC64-NEXT: Offset: 0x14 180MACHO-PPC64-NEXT: PCRel: 0 181MACHO-PPC64-NEXT: Length: 2 182MACHO-PPC64-NEXT: Type: (14) 183MACHO-PPC64-NEXT: Value: 0x6C 184MACHO-PPC64-NEXT: } 185MACHO-PPC64-NEXT: Relocation { 186MACHO-PPC64-NEXT: Offset: 0x0 187MACHO-PPC64-NEXT: PCRel: 0 188MACHO-PPC64-NEXT: Length: 2 189MACHO-PPC64-NEXT: Type: (1) 190MACHO-PPC64-NEXT: Value: 0x48 191MACHO-PPC64-NEXT: } 192MACHO-PPC64-NEXT: Relocation { 193MACHO-PPC64-NEXT: Offset: 0xC 194MACHO-PPC64-NEXT: PCRel: 0 195MACHO-PPC64-NEXT: Length: 2 196MACHO-PPC64-NEXT: Type: (12) 197MACHO-PPC64-NEXT: Value: 0x6C 198MACHO-PPC64-NEXT: } 199MACHO-PPC64-NEXT: Relocation { 200MACHO-PPC64-NEXT: Offset: 0x24 201MACHO-PPC64-NEXT: PCRel: 0 202MACHO-PPC64-NEXT: Length: 2 203MACHO-PPC64-NEXT: Type: (1) 204MACHO-PPC64-NEXT: Value: 0x48 205MACHO-PPC64-NEXT: } 206MACHO-PPC64-NEXT: } 207MACHO-PPC64-NEXT: Section __la_symbol_ptr { 208MACHO-PPC64-NEXT: Relocation { 209MACHO-PPC64-NEXT: Offset: 0x0 210MACHO-PPC64-NEXT: PCRel: 0 211MACHO-PPC64-NEXT: Length: 3 212MACHO-PPC64-NEXT: Type: (0) 213MACHO-PPC64-NEXT: Symbol: dyld_stub_binding_helper (5) 214MACHO-PPC64-NEXT: } 215MACHO-PPC64-NEXT: } 216MACHO-PPC64-NEXT: ] 217 218 219MACHO-ARM: Relocations [ 220MACHO-ARM-NEXT: Section __text { 221MACHO-ARM-NEXT: Relocation { 222MACHO-ARM-NEXT: Offset: 0x38 223MACHO-ARM-NEXT: PCRel: 0 224MACHO-ARM-NEXT: Length: 2 225MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2) 226MACHO-ARM-NEXT: Value: 0x40 227MACHO-ARM-NEXT: } 228MACHO-ARM-NEXT: Relocation { 229MACHO-ARM-NEXT: Offset: 0x0 230MACHO-ARM-NEXT: PCRel: 0 231MACHO-ARM-NEXT: Length: 2 232MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1) 233MACHO-ARM-NEXT: Value: 0x28 234MACHO-ARM-NEXT: } 235MACHO-ARM-NEXT: Relocation { 236MACHO-ARM-NEXT: Offset: 0x20 237MACHO-ARM-NEXT: PCRel: 1 238MACHO-ARM-NEXT: Length: 2 239MACHO-ARM-NEXT: Type: ARM_RELOC_BR24 (5) 240MACHO-ARM-NEXT: Symbol: _g 241MACHO-ARM-NEXT: } 242MACHO-ARM-NEXT: Relocation { 243MACHO-ARM-NEXT: Offset: 0x1C 244MACHO-ARM-NEXT: PCRel: 0 245MACHO-ARM-NEXT: Length: 1 246MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8) 247MACHO-ARM-NEXT: Symbol: _g 248MACHO-ARM-NEXT: } 249MACHO-ARM-NEXT: Relocation { 250MACHO-ARM-NEXT: Offset: 0x0 251MACHO-ARM-NEXT: PCRel: 0 252MACHO-ARM-NEXT: Length: 1 253MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1) 254MACHO-ARM-NEXT: Section: - 255MACHO-ARM-NEXT: } 256MACHO-ARM-NEXT: Relocation { 257MACHO-ARM-NEXT: Offset: 0x18 258MACHO-ARM-NEXT: PCRel: 0 259MACHO-ARM-NEXT: Length: 0 260MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8) 261MACHO-ARM-NEXT: Symbol: _g 262MACHO-ARM-NEXT: } 263MACHO-ARM-NEXT: Relocation { 264MACHO-ARM-NEXT: Offset: 0x0 265MACHO-ARM-NEXT: PCRel: 0 266MACHO-ARM-NEXT: Length: 0 267MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1) 268MACHO-ARM-NEXT: Section: - 269MACHO-ARM-NEXT: } 270MACHO-ARM-NEXT: Relocation { 271MACHO-ARM-NEXT: Offset: 0xC 272MACHO-ARM-NEXT: PCRel: 0 273MACHO-ARM-NEXT: Length: 2 274MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2) 275MACHO-ARM-NEXT: Value: 0x44 276MACHO-ARM-NEXT: } 277MACHO-ARM-NEXT: Relocation { 278MACHO-ARM-NEXT: Offset: 0x0 279MACHO-ARM-NEXT: PCRel: 0 280MACHO-ARM-NEXT: Length: 2 281MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1) 282MACHO-ARM-NEXT: Value: 0x4 283MACHO-ARM-NEXT: } 284MACHO-ARM-NEXT: } 285MACHO-ARM-NEXT: ] 286