[llvm] [llvm-objdump] Implement decoding auxiliary header for xcoff with llvm-objdump --private-headers (PR #105682)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 00:16:43 PDT 2024


================
@@ -0,0 +1,128 @@
+## Test that `the llvm-objdump --private-headers` print out the auxiliary header of XCOFF object file.
+
+# RUN: yaml2obj %s -o %t1
+# RUN: llvm-objdump --private-headers %t1 | \
+# RUN:   FileCheck %s --check-prefix=CHECK32 --match-full-lines --strict-whitespace
+# RUN: cp %t1 %t1_err1
+# RUN: python -c "with open(r'%t1_err1', 'r+b') as input: input.seek(17); input.write(b'\x45')"
+# RUN: python -c "with open(r'%t1_err1', 'r+b') as input: input.seek(4); input.write(b'\x00')"
+# RUN: llvm-objdump --private-headers %t1_err1 2>&1 | FileCheck %s --check-prefix=WARN1 --match-full-lines
+# RUN: cp %t1 %t1_extra
+# RUN: python -c "with open(r'%t1_extra', 'r+b') as input: input.seek(4); input.write(b'\x00')"
+# RUN: python -c "with open(r'%t1_extra', 'r+b') as input: input.seek(17); input.write(b'\x4f')"
+# RUN: llvm-objdump --private-headers %t1_extra 2>&1 | FileCheck %s --check-prefix=EXTRA --match-full-lines
+# RUN: yaml2obj %s -DMAGIC=0x1F7 -DFLAG64=0x2 -o %t2
+# RUN: llvm-objdump --private-headers %t2 | \
+# RUN:   FileCheck %s --check-prefix=CHECK64 --match-full-lines --strict-whitespace
+
+
+#      CHECK32:---Auxiliary Header:
+# CHECK32-NEXT:Magic:                              0x10b
+# CHECK32-NEXT:Version:                            0x1
+# CHECK32-NEXT:Size of .text section:              0x8
+# CHECK32-NEXT:Size of .data section:              0x9
+# CHECK32-NEXT:Size of .bss section:               0x10
+# CHECK32-NEXT:Entry point address:                0x1111
+# CHECK32-NEXT:.text section start address:        0x2222
+# CHECK32-NEXT:.data section start address;        0x3333
+# CHECK32-NEXT:TOC anchor address:                 0x4444
+# CHECK32-NEXT:Section number of entryPoint:       1
+# CHECK32-NEXT:Section number of .text:            2
+# CHECK32-NEXT:Section number of .data:            3
+# CHECK32-NEXT:Section number of TOC:              4
+# CHECK32-NEXT:Section number of loader data:      5
+# CHECK32-NEXT:Section number of .bss:             6
+# CHECK32-NEXT:Maxium alignment of .text:          0x7
+# CHECK32-NEXT:Maxium alignment of .data:          0x3
+# CHECK32-NEXT:Module type;                        0x0
+# CHECK32-NEXT:CPU type of objects:                0x1
+# CHECK32-NEXT:(Reserved):                         0x0
----------------
jh7370 wrote:

Does a Reserved field really need printing?

https://github.com/llvm/llvm-project/pull/105682


More information about the llvm-commits mailing list