empty-section.test
2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
## .empty is not covered by a segment. Its offset is moved to 0x200 to fill the gap.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-objcopy %t1 %t1.out
# RUN: llvm-readelf -S %t1.out | FileCheck --check-prefix=CHECK1 %s
# CHECK1: Name Type Address Off
# CHECK1-NEXT: NULL 0000000000000000 000000
# CHECK1-NEXT: .foo PROGBITS 0000000000000000 000100
# CHECK1-NEXT: .empty PROGBITS 0000000000001000 000200
# CHECK1-NEXT: .baz PROGBITS 0000000000001000 001000
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: gap
Type: Fill
Size: 0xE00
- Name: .foo
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x100
Address: 0
Size: 0x100
- Name: .empty
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
Address: 0x1000
- Name: .baz
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x1000
Address: 0x1000
Size: 0x100
## Test that we attribute .empty to the second segment. Its offset is assigned according to
## the p_offset of the second segment.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-objcopy %t2 %t2.out
# RUN: llvm-readelf -S -l %t2.out | FileCheck --check-prefix=CHECK2 %s
# CHECK2: Name Type Address Off
# CHECK2-NEXT: NULL 0000000000000000 000000
# CHECK2-NEXT: .foo PROGBITS 0000000000000000 000100
# CHECK2-NEXT: .empty PROGBITS 0000000000001000 001000
# CHECK2-NEXT: .baz PROGBITS 0000000000001000 001000
# CHECK2: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# CHECK2-NEXT: LOAD 0x000100 0x0000000000000000 0x0000000000000000 0x000100 0x000100 0x100
# CHECK2-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000100 0x000100 0x1000
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: gap
Type: Fill
Size: 0xE00
- Name: .foo
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x100
Address: 0
Size: 0x100
- Name: .empty
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
Address: 0x1000
- Name: .baz
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x1000
Address: 0x1000
Size: 0x100
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0
Align: 0x100
Sections:
- Section: .foo
- Type: PT_LOAD
VAddr: 0x1000
Align: 0x1000
Sections:
- Section: .empty
- Section: .baz