104 lines · plain
1## Test that `llvm-objdump --private-headers` prints out the auxiliary header of an XCOFF object file.2# RUN: yaml2obj %s -o %t13# RUN: llvm-objdump --private-headers %t1 | \4# RUN: FileCheck %s --check-prefixes=CHECK32,COMMON --match-full-lines --strict-whitespace5# RUN: yaml2obj %s -DMAGIC=0x1F7 -DFLAG64=0x2 -o %t26# RUN: llvm-objdump --private-headers %t2 | \7# RUN: FileCheck %s --check-prefixes=CHECK64,COMMON --match-full-lines --strict-whitespace8 9--- !XCOFF10FileHeader:11 MagicNumber: [[MAGIC=0x1DF]]12AuxiliaryHeader:13 Magic: 0x10B14 Version: 0x115 TextSectionSize: 0x816 DataSectionSize: 0x917 BssSectionSize: 0x1018 EntryPointAddr: 0x111119 TextStartAddr: 0x222220 DataStartAddr: 0x333321 TOCAnchorAddr: 0x444422 SecNumOfEntryPoint: 123 SecNumOfText: 224 SecNumOfData: 325 SecNumOfTOC: 426 SecNumOfLoader: 527 SecNumOfBSS: 628 MaxAlignOfText: 0x729 MaxAlignOfData: 0x330 ModuleType: 0x131 TextPageSize: 0x132 DataPageSize: 0x133 StackPageSize: 0x134 SecNumOfTData: 735 SecNumOfTBSS: 836 FlagAndTDataAlignment: 0x137 Flag: [[FLAG64=<none>]]38Sections:39 - Flags: [ STYP_TEXT ]40 SectionData: "1232"41 - Flags: [ STYP_DATA ]42 SectionData: "5678"43 - Flags: [ STYP_BSS ]44 SectionData: "9101"45 - Flags: [ STYP_TDATA ]46 SectionData: "1112"47 - Flags: [ STYP_TBSS ]48 SectionData: "1314"49 50# COMMON:---Auxiliary Header:51# COMMON-NEXT:Magic: 0x10b52# COMMON-NEXT:Version: 0x153# CHECK32-NEXT:Size of .text section: 0x854# CHECK32-NEXT:Size of .data section: 0x955# CHECK32-NEXT:Size of .bss section: 0x1056# CHECK32-NEXT:Entry point address: 0x111157# CHECK64-NEXT:Reserved for debugger: 0x058# COMMON-NEXT:.text section start address: 0x222259# COMMON-NEXT:.data section start address: 0x333360# COMMON-NEXT:TOC anchor address: 0x444461# COMMON-NEXT:Section number of entryPoint: 162# COMMON-NEXT:Section number of .text: 263# COMMON-NEXT:Section number of .data: 364# COMMON-NEXT:Section number of TOC: 465# COMMON-NEXT:Section number of loader data: 566# COMMON-NEXT:Section number of .bss: 667# COMMON-NEXT:Maxium alignment of .text: 0x768# COMMON-NEXT:Maxium alignment of .data: 0x369# COMMON-NEXT:Module type: 0x070# COMMON-NEXT:CPU type of objects: 0x171# CHECK32-NEXT:Maximum stack size: 0x072# CHECK32-NEXT:Maximum data size: 0x073# CHECK32-NEXT:Reserved for debugger: 0x074# COMMON-NEXT:Text page size: 0x175# COMMON-NEXT:Data page size: 0x176# COMMON-NEXT:Stack page size: 0x177# COMMON-NEXT:Flag: 0x078# COMMON-NEXT:Alignment of thread-local storage: 0x179# CHECK64-NEXT:Size of .text section: 0x880# CHECK64-NEXT:Size of .data section: 0x981# CHECK64-NEXT:Size of .bss section: 0x1082# CHECK64-NEXT:Entry point address: 0x111183# CHECK64-NEXT:Maximum stack size: 0x084# CHECK64-NEXT:Maximum data size: 0x085# COMMON-NEXT:Section number for .tdata: 786# COMMON-NEXT:Section number for .tbss: 887# CHECK64-NEXT:Additional flags 64-bit XCOFF: 0x288 89## Test how llvm-objdump behaves when the auxiliary header of the XCOFF object file contains a partial field.90# RUN: cp %t1 %t1_err191# RUN: %python -c "with open(r'%t1_err1', 'r+b') as input: input.seek(17); input.write(b'\x45'); input.seek(4); input.write(b'\x00')"92# RUN: llvm-objdump --private-headers %t1_err1 2>&1 | FileCheck %s --check-prefix=WARN1 --match-full-lines --strict-whitespace93 94# WARN1:{{.*}}: only partial field for Section number for .tdata: at offset (68)95# WARN1-NEXT:Raw data (00)96 97## Test how llvm-objdump behaves when the auxiliary header of the XCOFF object file contains extra data.98# RUN: cp %t1 %t1_extra99# RUN: %python -c "with open(r'%t1_extra', 'r+b') as input: input.seek(17); input.write(b'\x4f'); input.seek(4); input.write(b'\x00')"100# RUN: llvm-objdump --private-headers %t1_extra 2>&1 | FileCheck %s --check-prefix=EXTRA --match-full-lines --strict-whitespace101 102# EXTRA:Extra raw data (00000000 000000)103# EXTRA-NOT:{{.}}104