xref: /llvm-project/bolt/test/X86/phdr-out-of-order.test (revision 116e801a15569386c452085de783ecb9223050ff)
1## Check that llvm-bolt correctly processes a binary with program headers and
2## corresponding sections specified in non-ascending address order.
3
4RUN: split-file %s %t
5RUN: yaml2obj %t/yaml -o %t.exe --max-size=0
6RUN: llvm-bolt %t.exe -o %t.bolt --allow-stripped
7RUN: llvm-readelf -WS %t.bolt | FileCheck %s
8
9CHECK:      .a PROGBITS 0000000000400000 [[#%.6x, OFFSET:]] 000001
10CHECK-NEXT: .b PROGBITS 0000000000000000 [[#%.6x, OFFSET+1]] 000001
11CHECK-NEXT: .c PROGBITS 0000000000600000 [[#%.6x, OFFSET+2]] 000001
12
13#--- yaml
14--- !ELF
15FileHeader:
16  Class: ELFCLASS64
17  Data: ELFDATA2LSB
18  Type: ET_EXEC
19  Machine: EM_X86_64
20ProgramHeaders:
21  - Type: PT_LOAD
22    FirstSec: .a
23    LastSec: .a
24    VAddr: 0x400000
25  - Type: PT_LOAD
26    FirstSec: .b
27    LastSec: .b
28    VAddr: 0x0
29  - Type: PT_LOAD
30    FirstSec: .c
31    LastSec: .c
32    VAddr: 0x600000
33Sections:
34  - Name: .a
35    Type: SHT_PROGBITS
36    Flags: [ SHF_ALLOC ]
37    Content: 00
38    AddressAlign: 0x1
39    Address: 0x400000
40  - Name: .b
41    Type: SHT_PROGBITS
42    Flags: [ SHF_ALLOC ]
43    Content: 00
44    AddressAlign: 0x1
45    Address: 0x0
46  - Name: .c
47    Type: SHT_PROGBITS
48    Flags: [ SHF_ALLOC ]
49    Content: 00
50    AddressAlign: 0x1
51    Address: 0x600000
52...
53