Home | History | Annotate | Download | only in llvm-objcopy
      1 # RUN: yaml2obj %s -o %t
      2 # RUN: llvm-objcopy -R .text2 %t %t2
      3 # RUN: llvm-readobj -file-headers -sections -program-headers %t2 | FileCheck %s
      4 
      5 !ELF
      6 FileHeader:
      7   Class:           ELFCLASS64
      8   Data:            ELFDATA2LSB
      9   Type:            ET_EXEC
     10   Machine:         EM_X86_64
     11 Sections:
     12   - Name:            .text
     13     Type:            SHT_PROGBITS
     14     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     15     Address:         0x1000
     16     AddressAlign:    0x1000
     17     Size:            0x1000
     18   - Name:            .text2
     19     Type:            SHT_PROGBITS
     20     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     21     Address:         0x2000
     22     AddressAlign:    0x1000
     23     Size:            0x1000
     24   - Name:            .text3
     25     Type:            SHT_PROGBITS
     26     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     27     Address:         0x3000
     28     AddressAlign:    0x1000
     29     Size:            0x1000
     30 ProgramHeaders:
     31   - Type: PT_LOAD
     32     Flags: [ PF_R ]
     33     VAddr: 0x1000
     34     PAddr: 0x1000
     35     Sections:
     36       - Section: .text
     37   - Type: PT_LOAD
     38     Flags: [ PF_X, PF_R ]
     39     VAddr: 0x3000
     40     PAddr: 0x3000
     41     Sections:
     42       - Section: .text3
     43 
     44 #CHECK: SectionHeaderCount: 6
     45 
     46 # CHECK:           Sections [
     47 # CHECK-NEXT:        Section {
     48 # CHECK-NEXT:          Index: 0
     49 # CHECK-NEXT:          Name:  (0)
     50 # CHECK-NEXT:          Type: SHT_NULL (0x0)
     51 # CHECK-NEXT:          Flags [ (0x0)
     52 # CHECK-NEXT:          ]
     53 # CHECK-NEXT:          Address: 0x0
     54 # CHECK-NEXT:          Offset: 0x0
     55 # CHECK-NEXT:          Size: 0
     56 # CHECK-NEXT:          Link: 0
     57 # CHECK-NEXT:          Info: 0
     58 # CHECK-NEXT:          AddressAlignment: 0
     59 # CHECK-NEXT:          EntrySize: 0
     60 # CHECK-NEXT:        }
     61 # CHECK-NEXT:        Section {
     62 # CHECK-NEXT:          Index: 1
     63 # CHECK-NEXT:          Name: .text
     64 # CHECK-NEXT:          Type: SHT_PROGBITS (0x1)
     65 # CHECK-NEXT:          Flags [ (0x6)
     66 # CHECK-NEXT:            SHF_ALLOC (0x2)
     67 # CHECK-NEXT:            SHF_EXECINSTR (0x4)
     68 # CHECK-NEXT:          ]
     69 # CHECK-NEXT:          Address: 0x1000
     70 # CHECK-NEXT:          Offset: 0x1000
     71 # CHECK-NEXT:          Size: 4096
     72 # CHECK-NEXT:          Link: 0
     73 # CHECK-NEXT:          Info: 0
     74 # CHECK-NEXT:          AddressAlignment: 4096
     75 # CHECK-NEXT:          EntrySize: 0
     76 # CHECK-NEXT:        }
     77 # CHECK-NEXT:        Section {
     78 # CHECK-NEXT:          Index: 2
     79 # CHECK-NEXT:          Name: .text3
     80 # CHECK-NEXT:          Type: SHT_PROGBITS (0x1)
     81 # CHECK-NEXT:          Flags [ (0x6)
     82 # CHECK-NEXT:            SHF_ALLOC (0x2)
     83 # CHECK-NEXT:            SHF_EXECINSTR (0x4)
     84 # CHECK-NEXT:          ]
     85 # CHECK-NEXT:          Address: 0x3000
     86 # CHECK-NEXT:          Offset: 0x2000
     87 # CHECK-NEXT:          Size: 4096
     88 # CHECK-NEXT:          Link: 0
     89 # CHECK-NEXT:          Info: 0
     90 # CHECK-NEXT:          AddressAlignment: 4096
     91 # CHECK-NEXT:          EntrySize: 0
     92 # CHECK-NEXT:        }
     93 # CHECK-NEXT:        Section {
     94 # CHECK-NEXT:          Index: 3
     95 # CHECK-NEXT:          Name: .symtab
     96 # CHECK-NEXT:          Type: SHT_SYMTAB (0x2)
     97 # CHECK-NEXT:          Flags [ (0x0)
     98 # CHECK-NEXT:          ]
     99 # CHECK-NEXT:          Address: 0x0
    100 # CHECK-NEXT:          Offset: 0x3000
    101 # CHECK-NEXT:          Size: 24
    102 # CHECK-NEXT:          Link: 4
    103 # CHECK-NEXT:          Info: 1
    104 # CHECK-NEXT:          AddressAlignment: 8
    105 # CHECK-NEXT:          EntrySize: 24
    106 # CHECK-NEXT:        }
    107 # CHECK-NEXT:        Section {
    108 # CHECK-NEXT:          Index: 4
    109 # CHECK-NEXT:          Name: .strtab
    110 # CHECK-NEXT:          Type: SHT_STRTAB (0x3)
    111 # CHECK-NEXT:          Flags [ (0x0)
    112 # CHECK-NEXT:          ]
    113 # CHECK-NEXT:          Address: 0x0
    114 # CHECK-NEXT:          Offset: 0x3018
    115 # CHECK-NEXT:          Size:
    116 # CHECK-NEXT:          Link: 0
    117 # CHECK-NEXT:          Info: 0
    118 # CHECK-NEXT:          AddressAlignment: 1
    119 # CHECK-NEXT:          EntrySize: 0
    120 # CHECK-NEXT:        }
    121 # CHECK-NEXT:        Section {
    122 # CHECK-NEXT:          Index: 5
    123 # CHECK-NEXT:          Name: .shstrtab
    124 # CHECK-NEXT:          Type: SHT_STRTAB (0x3)
    125 # CHECK-NEXT:          Flags [ (0x0)
    126 # CHECK-NEXT:          ]
    127 # CHECK-NEXT:          Address: 0x0
    128 # CHECK-NEXT:          Offset:
    129 # CHECK-NEXT:          Size:
    130 # CHECK-NEXT:          Link: 0
    131 # CHECK-NEXT:          Info: 0
    132 # CHECK-NEXT:          AddressAlignment: 1
    133 # CHECK-NEXT:          EntrySize: 0
    134 # CHECK-NEXT:        }
    135 # CHECK-NEXT:      ]
    136 
    137 
    138 # CHECK:     ProgramHeaders [
    139 # CHECK-NEXT:  ProgramHeader {
    140 # CHECK-NEXT:    Type: PT_LOAD (0x1)
    141 # CHECK-NEXT:    Offset: 0x1000
    142 # CHECK-NEXT:    VirtualAddress: 0x1000
    143 # CHECK-NEXT:    PhysicalAddress: 0x1000
    144 # CHECK-NEXT:    FileSize: 4096
    145 # CHECK-NEXT:    MemSize: 4096
    146 # CHECK-NEXT:    Flags [ (0x4)
    147 # CHECK-NEXT:      PF_R (0x4)
    148 # CHECK-NEXT:    ]
    149 # CHECK-NEXT:    Alignment: 4096
    150 # CHECK-NEXT:  }
    151 # CHECK-NEXT:  ProgramHeader {
    152 # CHECK-NEXT:    Type: PT_LOAD (0x1)
    153 # CHECK-NEXT:    Offset: 0x2000
    154 # CHECK-NEXT:    VirtualAddress: 0x3000
    155 # CHECK-NEXT:    PhysicalAddress: 0x3000
    156 # CHECK-NEXT:    FileSize: 4096
    157 # CHECK-NEXT:    MemSize: 4096
    158 # CHECK-NEXT:    Flags [ (0x5)
    159 # CHECK-NEXT:      PF_R (0x4)
    160 # CHECK-NEXT:      PF_X (0x1)
    161 # CHECK-NEXT:    ]
    162 # CHECK-NEXT:    Alignment: 4096
    163 # CHECK-NEXT:  }
    164 # CHECK-NEXT:]
    165