155c81d42SFangrui Song# RUN: yaml2obj --docnum=1 %s -o %t1 2a795bd96SGeorgii Rymar# RUN: llvm-objcopy %t1 %t2 3298ea3f5SJordan Rupprecht# RUN: llvm-readobj --relocations %t2 | FileCheck %s 46e4dc6f2SAlexander Shaposhnikov 5a795bd96SGeorgii Rymar--- !ELF 66e4dc6f2SAlexander ShaposhnikovFileHeader: 76e4dc6f2SAlexander Shaposhnikov Class: ELFCLASS64 86e4dc6f2SAlexander Shaposhnikov Data: ELFDATA2LSB 977d3590aSJordan Rupprecht Type: ET_EXEC 106e4dc6f2SAlexander Shaposhnikov Machine: EM_X86_64 116e4dc6f2SAlexander ShaposhnikovSections: 126e4dc6f2SAlexander Shaposhnikov - Name: .text 136e4dc6f2SAlexander Shaposhnikov Type: SHT_PROGBITS 146e4dc6f2SAlexander Shaposhnikov Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 156e4dc6f2SAlexander Shaposhnikov Address: 0x1000 166e4dc6f2SAlexander Shaposhnikov AddressAlign: 0x0000000000000010 176e4dc6f2SAlexander Shaposhnikov Content: "0000000000000000" 186e4dc6f2SAlexander Shaposhnikov - Name: .rel.text 196e4dc6f2SAlexander Shaposhnikov Type: SHT_REL 206e4dc6f2SAlexander Shaposhnikov Info: .text 216e4dc6f2SAlexander Shaposhnikov Relocations: 226e4dc6f2SAlexander Shaposhnikov - Offset: 0x1000 236e4dc6f2SAlexander Shaposhnikov Type: R_X86_64_RELATIVE 246e4dc6f2SAlexander Shaposhnikov 256e4dc6f2SAlexander Shaposhnikov# CHECK: Relocations [ 266e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT: Section (2) .rel.text { 27*98a42898SGeorgii Rymar# CHECK-NEXT: 0x1000 R_X86_64_RELATIVE - 286e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT: } 296e4dc6f2SAlexander Shaposhnikov# CHECK-NEXT:] 30a795bd96SGeorgii Rymar 31a795bd96SGeorgii Rymar## Check we produce a valid output when stripping unneeded symbols from an object that 32a795bd96SGeorgii Rymar## has a symbol table and a relocation with a symbol index of 0. 33a795bd96SGeorgii Rymar 3455c81d42SFangrui Song# RUN: yaml2obj --docnum=2 %s -o %t3 35a795bd96SGeorgii Rymar# RUN: llvm-objcopy --strip-unneeded %t3 %t4 36a795bd96SGeorgii Rymar# RUN: llvm-readobj --relocations --sections --symbols %t4 | FileCheck %s --check-prefix=STRIP 37a795bd96SGeorgii Rymar 38a795bd96SGeorgii Rymar# STRIP: Relocations [ 39a795bd96SGeorgii Rymar# STRIP-NEXT: Section {{.*}} .rel.text { 40*98a42898SGeorgii Rymar# STRIP-NEXT: 0x1000 R_X86_64_NONE - 41a795bd96SGeorgii Rymar# STRIP-NEXT: } 42a795bd96SGeorgii Rymar# STRIP-NEXT: ] 43a795bd96SGeorgii Rymar# STRIP-NEXT: Symbols [ 44a795bd96SGeorgii Rymar# STRIP-NEXT: Symbol { 45a795bd96SGeorgii Rymar# STRIP-NEXT: Name: (0) 46a795bd96SGeorgii Rymar# STRIP-NEXT: Value: 0x0 47a795bd96SGeorgii Rymar# STRIP-NEXT: Size: 0 48a795bd96SGeorgii Rymar# STRIP-NEXT: Binding: Local (0x0) 49a795bd96SGeorgii Rymar# STRIP-NEXT: Type: None (0x0) 50a795bd96SGeorgii Rymar# STRIP-NEXT: Other: 0 51a795bd96SGeorgii Rymar# STRIP-NEXT: Section: Undefined (0x0) 52a795bd96SGeorgii Rymar# STRIP-NEXT: } 53a795bd96SGeorgii Rymar# STRIP-NEXT: ] 54a795bd96SGeorgii Rymar 55a795bd96SGeorgii Rymar--- !ELF 56a795bd96SGeorgii RymarFileHeader: 57a795bd96SGeorgii Rymar Class: ELFCLASS64 58a795bd96SGeorgii Rymar Data: ELFDATA2LSB 59a795bd96SGeorgii Rymar Type: ET_REL 60a795bd96SGeorgii Rymar Machine: EM_X86_64 61a795bd96SGeorgii RymarSections: 62a795bd96SGeorgii Rymar - Name: .text 63a795bd96SGeorgii Rymar Type: SHT_PROGBITS 64a795bd96SGeorgii Rymar - Name: .rel.text 65a795bd96SGeorgii Rymar Type: SHT_REL 66a795bd96SGeorgii Rymar Info: .text 67a795bd96SGeorgii Rymar Relocations: 68a795bd96SGeorgii Rymar - Offset: 0x1000 69a795bd96SGeorgii Rymar Type: R_X86_64_NONE 70a795bd96SGeorgii RymarSymbols: [] 71