1 ## Test the alignment of XCOFF object files in the big archive format.
3 # RUN: rm -rf %t && mkdir %t
6 # RUN: yaml2obj --docnum=1 -DFLAG=0x1DF -DSECNAME=.data %s -o t32_1.o
7 # RUN: yaml2obj --docnum=1 -DFLAG=0x1F7 -DSECNAME=.data %s -o t64_1.o
8 # RUN: yaml2obj --docnum=1 -DFLAG=0x1DF -DSECNAME=.text %s -o t32_2.o
9 # RUN: yaml2obj --docnum=1 -DFLAG=0x1F7 -DSECNAME=.text %s -o t64_2.o
10 # RUN: yaml2obj --docnum=2 -DFLAG=0x1DF %s -o t32_nomaxdata_text.o
11 # RUN: yaml2obj --docnum=2 -DFLAG=0x1F7 %s -o t64_nomaxdata_text.o
12 # RUN: yaml2obj --docnum=3 -DFLAG=0x1DF %s -o t32_maxdata_text.o
13 # RUN: yaml2obj --docnum=3 -DFLAG=0x1F7 %s -o t64_maxdata_text.o
14 # RUN: yaml2obj --docnum=4 -DFLAG=0x1DF %s -o t32_noloader.o
15 # RUN: yaml2obj --docnum=4 -DFLAG=0x1F7 %s -o t64_noloader.o
16 # RUN: yaml2obj --docnum=5 -DFLAG=0x1DF %s -o t32_excess.o
17 # RUN: yaml2obj --docnum=5 -DFLAG=0x1F7 %s -o t64_excess.o
19 # RUN: echo -e "import sys\nf=open(sys.argv[1],\"rb\");f.seek(int(sys.argv[2]));print(f.read(2));f.close()" > print_magic.py
21 ## Test that the content of an XCOFF object file, which has an auxiliary header,
22 ## is aligned in a big archive based on the content of auxiliary header.
23 # RUN: env OBJECT_MODE=32_64 llvm-ar -q t_aux.a t32_nomaxdata_text.o t64_nomaxdata_text.o t32_maxdata_text.o t64_maxdata_text.o t32_noloader.o t64_noloader.o t32_excess.o t64_excess.o
24 ## The content of t32_nomaxdata_text, t64_nomaxdata_text.o aligned at 2.
25 # RUN: %python print_magic.py t_aux.a 262 | FileCheck --check-prefix=MAGIC32 %s
26 # RUN: %python print_magic.py t_aux.a 528 | FileCheck --check-prefix=MAGIC64 %s
27 ## The content of t32_maxdata_text.o, t64_maxdata_text.o aligned at 2^8.
28 # RUN: %python print_magic.py t_aux.a 1024 | FileCheck --check-prefix=MAGIC32 %s
29 # RUN: %python print_magic.py t_aux.a 1536 | FileCheck --check-prefix=MAGIC64 %s
30 ## The content of t32_noloader.o, t64_noloader.o aligned at 2.
31 # RUN: %python print_magic.py t_aux.a 1870 | FileCheck --check-prefix=MAGIC32 %s
32 # RUN: %python print_magic.py t_aux.a 2130 | FileCheck --check-prefix=MAGIC64 %s
33 ## The content of t32_excess.o aligned at word.
34 # RUN: %python print_magic.py t_aux.a 2464 | FileCheck --check-prefix=MAGIC32 %s
35 ## The content of t64_excess.o aligned at 2^12.
36 # RUN: %python print_magic.py t_aux.a 4096 | FileCheck --check-prefix=MAGIC64 %s
38 ## Test that the content of an XCOFF object file, which does not have an auxiliary
39 ## header, is aligned at 2 in a big archive.
40 # RUN: env OBJECT_MODE=32_64 llvm-ar -q t3.a t32_1.o t64_1.o t32_2.o t64_2.o
41 # # RUN: %python print_magic.py t3.a 250 | FileCheck --check-prefix=MAGIC32 %s
42 # # RUN: %python print_magic.py t3.a 432 | FileCheck -check-prefix=MAGIC64 %s
43 # # RUN: %python print_magic.py t3.a 650 | FileCheck --check-prefix=MAGIC32 %s
44 # # RUN: %python print_magic.py t3.a 832 | FileCheck -check-prefix=MAGIC64 %s
46 # MAGIC64: b'\x01\xf7'
47 # MAGIC32: b'\x01\xdf'
56 ## The auxiliary header has neither the MaxAlignOfData nor MaxAlignOfText field.
60 AuxiliaryHeaderSize: 12
68 ## The auxiliary header has both MaxAlignOfData and MaxAlignOfText fields.
72 AuxiliaryHeaderSize: 48
82 ## The auxiliary header does not have a loader section.
86 AuxiliaryHeaderSize: 34
96 ## The auxiliary header has both MaxAlignOfData and MaxAlignOfText fields
97 ## but max(MaxAlignOfData, MaxAlignOfText) exceeds the page size(2^12).
100 MagicNumber: [[FLAG]]
101 AuxiliaryHeaderSize: 48