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