• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Test the p_align field of a program header can be set explicitly or inferred
2## from the maximum alignment of contained sections.
3
4## Explicit Align has priority over section alignments.
5
6# RUN: yaml2obj --docnum=1 %s -o %t
7# RUN: llvm-readobj -l %t | FileCheck %s
8# CHECK:      ProgramHeader {
9# CHECK-NOT:  ProgramHeader {
10# CHECK:        Alignment: 16
11# CHECK-NEXT: }
12
13--- !ELF
14FileHeader:
15  Class: ELFCLASS64
16  Data:  ELFDATA2LSB
17  Type:  ET_EXEC
18Sections:
19  - Name:         .tdata
20    Type:         SHT_PROGBITS
21    AddressAlign: 4
22  - Name:         .tbss
23    Type:         SHT_NOBITS
24    AddressAlign: 64
25ProgramHeaders:
26  - Type:  PT_TLS
27    Align: 16
28    FirstSec: .tdata
29    LastSec:  .tbss
30
31## If Align is not specified, p_align is inferred from the maximum alignment
32## of contained sections.
33
34# RUN: yaml2obj --docnum=2 %s -o %t
35# RUN: llvm-readobj -l %t | FileCheck %s
36
37--- !ELF
38FileHeader:
39  Class: ELFCLASS64
40  Data:  ELFDATA2LSB
41  Type:  ET_EXEC
42Sections:
43  - Name:         .text
44    Type:         SHT_PROGBITS
45    AddressAlign: 4
46  - Name:         .text.hot
47    Type:         SHT_PROGBITS
48    AddressAlign: 16
49ProgramHeaders:
50  - Type:     PT_LOAD
51    FirstSec: .text
52    LastSec:  .text.hot
53