Home | History | Annotate | Download | only in llvm-objcopy
      1 # RUN: yaml2obj %s > %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 %t2 | FileCheck %s --check-prefix=DATA
      5 
      6 !ELF
      7 FileHeader:
      8   Class:           ELFCLASS64
      9   Data:            ELFDATA2LSB
     10   Type:            ET_EXEC
     11   Machine:         EM_X86_64
     12 Sections:
     13   - Name:            .text
     14     Type:            SHT_PROGBITS
     15     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     16     AddressAlign:    0x0000000000001000
     17     Content:         "DEADBEEF"
     18 ProgramHeaders:
     19 - Type: PT_LOAD
     20   Flags: [ PF_X, PF_R ]
     21   Sections:
     22     - Section: .text
     23 
     24 #DATA: 0010000 de ad be ef
     25 
     26 #CHECK: ElfHeader {
     27 #CHECK-NEXT:  Ident {
     28 #CHECK-NEXT:     Magic: (7F 45 4C 46)
     29 #CHECK-NEXT:     Class: 64-bit (0x2)
     30 #CHECK-NEXT:     DataEncoding: LittleEndian (0x1)
     31 #CHECK-NEXT:     FileVersion: 1
     32 #CHECK-NEXT:     OS/ABI: SystemV (0x0)
     33 #CHECK-NEXT:     ABIVersion: 0
     34 #CHECK-NEXT:     Unused: (00 00 00 00 00 00 00)
     35 #CHECK-NEXT:   }
     36 #CHECK-NEXT:   Type: Executable (0x2)
     37 #CHECK-NEXT:   Machine: EM_X86_64 (0x3E)
     38 #CHECK-NEXT:   Version: 1
     39 #CHECK-NEXT:   Entry: 0x0
     40 #CHECK-NEXT:   ProgramHeaderOffset: 0x40
     41 #CHECK-NEXT:   SectionHeaderOffset: 0x0
     42 #CHECK-NEXT:   Flags [ (0x0)
     43 #CHECK-NEXT:   ]
     44 #CHECK-NEXT:   HeaderSize: 64
     45 #CHECK-NEXT:   ProgramHeaderEntrySize: 56
     46 #CHECK-NEXT:   ProgramHeaderCount: 1
     47 #CHECK-NEXT:   SectionHeaderEntrySize: 64
     48 #CHECK-NEXT:   SectionHeaderCount: 0
     49 #CHECK-NEXT:   StringTableSectionIndex: 0
     50 #CHECK-NEXT: }
     51 
     52 #CHECK:     ProgramHeaders [
     53 #CHECK-NEXT:  ProgramHeader {
     54 #CHECK-NEXT:    Type: PT_LOAD (0x1)
     55 #CHECK-NEXT:    Offset: 0x1000
     56 #CHECK-NEXT:    VirtualAddress: 0x0
     57 #CHECK-NEXT:    PhysicalAddress: 0x0
     58 #CHECK-NEXT:    FileSize: 4
     59 #CHECK-NEXT:    MemSize: 4
     60 #CHECK-NEXT:    Flags [ (0x5)
     61 #CHECK-NEXT:      PF_R (0x4)
     62 #CHECK-NEXT:      PF_X (0x1)
     63 #CHECK-NEXT:    ]
     64 #CHECK-NEXT:    Alignment: 4096
     65 #CHECK-NEXT:  }
     66 #CHECK-NEXT:]
     67