1# RUN: yaml2obj %s -o %t 2# RUN: llvm-objcopy --strip-sections %t %t2 3# RUN: llvm-readobj --file-headers --program-headers %t2 | FileCheck %s 4# RUN: od -t x1 -j 4096 -N 12 %t2 | FileCheck %s --ignore-case --check-prefix=DATA 5 6## Sanity check the DATA-NOT line by showing that "fe ed fa ce" appears 7## if --strip-sections is not specified. 8# RUN: llvm-objcopy %t %t3 9# RUN: od -t x1 -j 4096 -N 12 %t3 | FileCheck %s --ignore-case --check-prefix=VALIDATE 10 11## Check that llvm-strip --strip-sections is equivalent to 12## llvm-objcopy --strip-sections. 13# RUN: llvm-strip --strip-sections %t -o %t4 14# RUN: cmp %t2 %t4 15 16!ELF 17FileHeader: 18 Class: ELFCLASS64 19 Data: ELFDATA2LSB 20 Type: ET_EXEC 21 Machine: EM_X86_64 22Sections: 23 - Name: .text 24 Type: SHT_PROGBITS 25 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 26 AddressAlign: 0x0000000000001000 27 Content: "DEADBEEF" 28 - Name: .non_alloc_in_segment 29 Type: SHT_PROGBITS 30 Flags: [ ] 31 Content: "CAFEBABE" 32 - Name: .non_alloc_not_in_segment 33 Type: SHT_PROGBITS 34 Flags: [ ] 35 Content: "FEEDFACE" 36ProgramHeaders: 37- Type: PT_LOAD 38 Flags: [ PF_X, PF_R ] 39 FirstSec: .text 40 LastSec: .non_alloc_in_segment 41 42# DATA: {{^[^[:blank:]]+}} de ad be ef ca fe ba be 43# DATA-NOT: fe ed fa ce 44 45# VALIDATE: {{^[^[:blank:]]+}} de ad be ef ca fe ba be fe ed fa ce 46 47# CHECK: ElfHeader { 48# CHECK-NEXT: Ident { 49# CHECK-NEXT: Magic: (7F 45 4C 46) 50# CHECK-NEXT: Class: 64-bit (0x2) 51# CHECK-NEXT: DataEncoding: LittleEndian (0x1) 52# CHECK-NEXT: FileVersion: 1 53# CHECK-NEXT: OS/ABI: SystemV (0x0) 54# CHECK-NEXT: ABIVersion: 0 55# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) 56# CHECK-NEXT: } 57# CHECK-NEXT: Type: Executable (0x2) 58# CHECK-NEXT: Machine: EM_X86_64 (0x3E) 59# CHECK-NEXT: Version: 1 60# CHECK-NEXT: Entry: 0x0 61# CHECK-NEXT: ProgramHeaderOffset: 0x40 62# CHECK-NEXT: SectionHeaderOffset: 0x0 63# CHECK-NEXT: Flags [ (0x0) 64# CHECK-NEXT: ] 65# CHECK-NEXT: HeaderSize: 64 66# CHECK-NEXT: ProgramHeaderEntrySize: 56 67# CHECK-NEXT: ProgramHeaderCount: 1 68# CHECK-NEXT: SectionHeaderEntrySize: 0 69# CHECK-NEXT: SectionHeaderCount: 0 70# CHECK-NEXT: StringTableSectionIndex: 0 71# CHECK-NEXT: } 72 73# CHECK: ProgramHeaders [ 74# CHECK-NEXT: ProgramHeader { 75# CHECK-NEXT: Type: PT_LOAD (0x1) 76# CHECK-NEXT: Offset: 0x1000 77# CHECK-NEXT: VirtualAddress: 0x0 78# CHECK-NEXT: PhysicalAddress: 0x0 79# CHECK-NEXT: FileSize: 8 80# CHECK-NEXT: MemSize: 8 81# CHECK-NEXT: Flags [ (0x5) 82# CHECK-NEXT: PF_R (0x4) 83# CHECK-NEXT: PF_X (0x1) 84# CHECK-NEXT: ] 85# CHECK-NEXT: Alignment: 4096 86# CHECK-NEXT: } 87# CHECK-NEXT: ] 88