[llvm] [XCOFF][obj2yaml] Support SymbolAlignmentAndType as 2 separate fields in YAML. (PR #76828)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 11:54:21 PST 2024
================
@@ -0,0 +1,140 @@
+## Check that obj2yaml can parse SymbolAlignmentAndType, SymbolAlignment,
+## and SymbolType. If either SymbolAlignment or SymbolType are specified
+## along with SymbolAligmentAndType, report an error.
+
+# RUN: yaml2obj %s --docnum=1 -DMAGIC=0x01DF -DSectionOrLength=SectionOrLength -o %t32
+# RUN: obj2yaml %t32 | FileCheck %s --check-prefix=CHECK
+# RUN: yaml2obj %s --docnum=1 -DMAGIC=0x01F7 -DSectionOrLength=SectionOrLengthLo -o %t64
+# RUN: obj2yaml %t64 | FileCheck %s --check-prefix=CHECK
+
+# CHECK: --- !XCOFF
+# CHECK-NEXT: FileHeader:
+# CHECK-NEXT: MagicNumber:
+# CHECK: Symbols:
+# CHECK: - Name: .fcn1
+# CHECK: NumberOfAuxEntries: 1
+# CHECK-NEXT: AuxEntries:
+# CHECK-NEXT: - Type: AUX_CSECT
+# CHECK: SymbolType: XTY_ER
+# CHECK-NEXT: SymbolAlignment: 4
+# CHECK: - Name: .fcn2
+# CHECK: NumberOfAuxEntries: 1
+# CHECK-NEXT: AuxEntries:
+# CHECK-NEXT: - Type: AUX_CSECT
+# CHECK: SymbolType: XTY_SD
+# CHECK-NEXT: SymbolAlignment: 2
+# CHECK: - Name: .fcn3
+# CHECK: NumberOfAuxEntries: 1
+# CHECK-NEXT: AuxEntries:
+# CHECK-NEXT: - Type: AUX_CSECT
+# CHECK: SymbolType: XTY_SD
+# CHECK-NEXT: SymbolAlignment: 0
+
+--- !XCOFF
+FileHeader:
+ MagicNumber: [[MAGIC]]
+Symbols:
+ - StorageClass: C_FILE
+ AuxEntries:
+ - Type: AUX_FILE
+ FileNameOrString: FileName
+ FileStringType: XFT_CD
+ - StorageClass: C_EXT
+ Name: .fcn1
+ AuxEntries:
+ - Type: AUX_CSECT
+ SymbolAlignment: 4
+ [[SectionOrLength]]: 4
+ - StorageClass: C_EXT
+ Name: .fcn2
+ AuxEntries:
+ - Type: AUX_CSECT
+ SymbolAlignment: 2
+ SymbolType: XTY_SD
+ [[SectionOrLength]]: 4
----------------
diggerlin wrote:
do we need the [[SectionOrLength]]: 4 in this test case ?
https://github.com/llvm/llvm-project/pull/76828
More information about the llvm-commits
mailing list