Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / yaml2obj / program-header.yaml
blobb5fac89cdc0f1d1cabeeca66942395721232a278
1 # RUN: yaml2obj --docnum=1 %s -o %t
2 # RUN: llvm-readobj -l %t | FileCheck %s
4 --- !ELF
5 FileHeader:
6   Class:           ELFCLASS64
7   Data:            ELFDATA2LSB
8   Type:            ET_EXEC
9   Machine:         EM_X86_64
10 Sections:
11   - Name:            .text
12     Type:            SHT_PROGBITS
13     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
14     AddressAlign:    0x0000000000001000
15     Content:         "00000000"
16   - Name:            .init
17     Type:            SHT_PROGBITS
18     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
19     Content:         "00000000"
20     AddressAlign:    0x0000000000000010
21   - Name:            .data
22     Type:            SHT_PROGBITS
23     Flags:           [ SHF_ALLOC ]
24     Content:         "00000000"
25     AddressAlign:    0x0000000000001000
26 ProgramHeaders:
27   - Type: PT_LOAD
28     Flags: [ PF_X, PF_R ]
29     VAddr: 0xAAAA1000
30     PAddr: 0xFFFF1000
31     Sections:
32       - Section: .text
33       - Section: .init
34   - Type: PT_LOAD
35     Flags: [ PF_R ]
36     VAddr: 0xAAAA2000
37     PAddr: 0xFFFF2000
38     Sections:
39       - Section: .data
41 #CHECK:     ProgramHeaders [
42 #CHECK-NEXT:   ProgramHeader {
43 #CHECK-NEXT:    Type: PT_LOAD
44 #CHECK-NEXT:    Offset: 0x1000
45 #CHECK-NEXT:    VirtualAddress: 0xAAAA1000
46 #CHECK-NEXT:    PhysicalAddress: 0xFFFF1000
47 #CHECK-NEXT:    FileSize: 20
48 #CHECK-NEXT:    MemSize: 20
49 #CHECK-NEXT:    Flags [
50 #CHECK-NEXT:      PF_R
51 #CHECK-NEXT:      PF_X
52 #CHECK-NEXT:    ]
53 #CHECK-NEXT:    Alignment: 4096
54 #CHECK-NEXT:  }
55 #CHECK-NEXT:  ProgramHeader {
56 #CHECK-NEXT:    Type: PT_LOAD
57 #CHECK-NEXT:    Offset: 0x2000
58 #CHECK-NEXT:    VirtualAddress: 0xAAAA2000
59 #CHECK-NEXT:    PhysicalAddress: 0xFFFF2000
60 #CHECK-NEXT:    FileSize: 4
61 #CHECK-NEXT:    MemSize: 4
62 #CHECK-NEXT:    Flags [
63 #CHECK-NEXT:      PF_R
64 #CHECK-NEXT:    ]
65 #CHECK-NEXT:    Alignment: 4096
66 #CHECK-NEXT:  }
67 #CHECK-NEXT:]
69 ## Check we do not allow referencing sections that do not exist.
70 # RUN: not yaml2obj --docnum=2 %s -o %t 2>&1 | FileCheck %s --check-prefix=ERR
71 # ERR: error: Unknown section referenced: '.foo' by program header.
73 --- !ELF
74 FileHeader:
75   Class:           ELFCLASS64
76   Data:            ELFDATA2LSB
77   Type:            ET_EXEC
78   Machine:         EM_X86_64
79 ProgramHeaders:
80   - Type: PT_LOAD
81     Sections:
82       - Section: .foo