[llvm] [XCOFF][obj2yaml] support parsing auxiliary symbols for XCOFF (PR #70642)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 03:14:57 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Esme (EsmeYi)
<details>
<summary>Changes</summary>
This PR adds the support for parsing auxiliary symbols of XCOFF object file for obj2yaml.
---
Patch is 25.62 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/70642.diff
5 Files Affected:
- (modified) llvm/include/llvm/Object/XCOFFObjectFile.h (+1-1)
- (modified) llvm/lib/ObjectYAML/XCOFFYAML.cpp (+17-10)
- (modified) llvm/test/tools/obj2yaml/XCOFF/aix.yaml (+38)
- (added) llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml (+264)
- (modified) llvm/tools/obj2yaml/xcoff2yaml.cpp (+184-1)
``````````diff
diff --git a/llvm/include/llvm/Object/XCOFFObjectFile.h b/llvm/include/llvm/Object/XCOFFObjectFile.h
index 63064abb4d3c322..9a3b4aa2623551c 100644
--- a/llvm/include/llvm/Object/XCOFFObjectFile.h
+++ b/llvm/include/llvm/Object/XCOFFObjectFile.h
@@ -411,13 +411,13 @@ class XCOFFCsectAuxRef {
return Entry64->AuxType;
}
-private:
uint8_t getSymbolAlignmentAndType() const {
return GETVALUE(SymbolAlignmentAndType);
}
#undef GETVALUE
+private:
const XCOFFCsectAuxEnt32 *Entry32 = nullptr;
const XCOFFCsectAuxEnt64 *Entry64 = nullptr;
};
diff --git a/llvm/lib/ObjectYAML/XCOFFYAML.cpp b/llvm/lib/ObjectYAML/XCOFFYAML.cpp
index 44ef33501b65e43..a9af0405546a3c7 100644
--- a/llvm/lib/ObjectYAML/XCOFFYAML.cpp
+++ b/llvm/lib/ObjectYAML/XCOFFYAML.cpp
@@ -282,45 +282,53 @@ static void auxSymMapping(IO &IO, XCOFFYAML::SectAuxEntForStat &AuxSym) {
void MappingTraits<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>>::mapping(
IO &IO, std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym) {
- assert(!IO.outputting() && "We don't dump aux symbols currently.");
const bool Is64 =
static_cast<XCOFFYAML::Object *>(IO.getContext())->Header.Magic ==
(llvm::yaml::Hex16)XCOFF::XCOFF64;
XCOFFYAML::AuxSymbolType AuxType;
+ if (IO.outputting())
+ AuxType = AuxSym.get()->Type;
IO.mapRequired("Type", AuxType);
switch (AuxType) {
case XCOFFYAML::AUX_EXCEPT:
if (!Is64)
IO.setError("an auxiliary symbol of type AUX_EXCEPT cannot be defined in "
"XCOFF32");
- AuxSym.reset(new XCOFFYAML::ExcpetionAuxEnt());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::ExcpetionAuxEnt());
auxSymMapping(IO, *cast<XCOFFYAML::ExcpetionAuxEnt>(AuxSym.get()));
break;
case XCOFFYAML::AUX_FCN:
- AuxSym.reset(new XCOFFYAML::FunctionAuxEnt());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::FunctionAuxEnt());
auxSymMapping(IO, *cast<XCOFFYAML::FunctionAuxEnt>(AuxSym.get()), Is64);
break;
case XCOFFYAML::AUX_SYM:
- AuxSym.reset(new XCOFFYAML::BlockAuxEnt());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::BlockAuxEnt());
auxSymMapping(IO, *cast<XCOFFYAML::BlockAuxEnt>(AuxSym.get()), Is64);
break;
case XCOFFYAML::AUX_FILE:
- AuxSym.reset(new XCOFFYAML::FileAuxEnt());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::FileAuxEnt());
auxSymMapping(IO, *cast<XCOFFYAML::FileAuxEnt>(AuxSym.get()));
break;
case XCOFFYAML::AUX_CSECT:
- AuxSym.reset(new XCOFFYAML::CsectAuxEnt());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::CsectAuxEnt());
auxSymMapping(IO, *cast<XCOFFYAML::CsectAuxEnt>(AuxSym.get()), Is64);
break;
case XCOFFYAML::AUX_SECT:
- AuxSym.reset(new XCOFFYAML::SectAuxEntForDWARF());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::SectAuxEntForDWARF());
auxSymMapping(IO, *cast<XCOFFYAML::SectAuxEntForDWARF>(AuxSym.get()));
break;
case XCOFFYAML::AUX_STAT:
if (Is64)
IO.setError(
"an auxiliary symbol of type AUX_STAT cannot be defined in XCOFF64");
- AuxSym.reset(new XCOFFYAML::SectAuxEntForStat());
+ if (!IO.outputting())
+ AuxSym.reset(new XCOFFYAML::SectAuxEntForStat());
auxSymMapping(IO, *cast<XCOFFYAML::SectAuxEntForStat>(AuxSym.get()));
break;
}
@@ -334,8 +342,7 @@ void MappingTraits<XCOFFYAML::Symbol>::mapping(IO &IO, XCOFFYAML::Symbol &S) {
IO.mapOptional("Type", S.Type);
IO.mapOptional("StorageClass", S.StorageClass);
IO.mapOptional("NumberOfAuxEntries", S.NumberOfAuxEntries);
- if (!IO.outputting())
- IO.mapOptional("AuxEntries", S.AuxEntries);
+ IO.mapOptional("AuxEntries", S.AuxEntries);
}
void MappingTraits<XCOFFYAML::StringTable>::mapping(IO &IO, XCOFFYAML::StringTable &Str) {
diff --git a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml
index cd1e88dec11d29b..fbd5fa0629d10bd 100644
--- a/llvm/test/tools/obj2yaml/XCOFF/aix.yaml
+++ b/llvm/test/tools/obj2yaml/XCOFF/aix.yaml
@@ -52,12 +52,30 @@
# CHECK32-NEXT: Type: 0x0
# CHECK32-NEXT: StorageClass: C_EXT
# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_CSECT
+# CHECK32-NEXT: ParameterHashIndex: 0
+# CHECK32-NEXT: TypeChkSectNum: 0
+# CHECK32-NEXT: SymbolAlignmentAndType: 0
+# CHECK32-NEXT: StorageMappingClass: XMC_PR
+# CHECK32-NEXT: SectionOrLength: 0
+# CHECK32-NEXT: StabInfoIndex: 0
+# CHECK32-NEXT: StabSectNum: 0
# CHECK32-NEXT: - Name: .data
# CHECK32-NEXT: Value: 0x70
# CHECK32-NEXT: Section: .data
# CHECK32-NEXT: Type: 0x0
# CHECK32-NEXT: StorageClass: C_HIDEXT
# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_CSECT
+# CHECK32-NEXT: ParameterHashIndex: 0
+# CHECK32-NEXT: TypeChkSectNum: 0
+# CHECK32-NEXT: SymbolAlignmentAndType: 0
+# CHECK32-NEXT: StorageMappingClass: XMC_PR
+# CHECK32-NEXT: SectionOrLength: 0
+# CHECK32-NEXT: StabInfoIndex: 0
+# CHECK32-NEXT: StabSectNum: 0
# CHECK64: --- !XCOFF
# CHECK64-NEXT: FileHeader:
@@ -106,12 +124,28 @@
# CHECK64-NEXT: Type: 0x0
# CHECK64-NEXT: StorageClass: C_EXT
# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_CSECT
+# CHECK64-NEXT: ParameterHashIndex: 0
+# CHECK64-NEXT: TypeChkSectNum: 0
+# CHECK64-NEXT: SymbolAlignmentAndType: 0
+# CHECK64-NEXT: StorageMappingClass: XMC_PR
+# CHECK64-NEXT: SectionOrLengthLo: 0
+# CHECK64-NEXT: SectionOrLengthHi: 0
# CHECK64-NEXT: - Name: .data
# CHECK64-NEXT: Value: 0x70
# CHECK64-NEXT: Section: .data
# CHECK64-NEXT: Type: 0x0
# CHECK64-NEXT: StorageClass: C_HIDEXT
# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_CSECT
+# CHECK64-NEXT: ParameterHashIndex: 0
+# CHECK64-NEXT: TypeChkSectNum: 0
+# CHECK64-NEXT: SymbolAlignmentAndType: 0
+# CHECK64-NEXT: StorageMappingClass: XMC_PR
+# CHECK64-NEXT: SectionOrLengthLo: 0
+# CHECK64-NEXT: SectionOrLengthHi: 0
--- !XCOFF
FileHeader:
@@ -140,9 +174,13 @@ Symbols:
Type: 0x0
StorageClass: C_EXT
NumberOfAuxEntries: 1
+ AuxEntries:
+ - Type: AUX_CSECT
- Name: .data
Value: 0x70
Section: .data
Type: 0x0
StorageClass: C_HIDEXT
NumberOfAuxEntries: 1
+ AuxEntries:
+ - Type: AUX_CSECT
diff --git a/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml b/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml
new file mode 100644
index 000000000000000..a4d1cb1d33aeda3
--- /dev/null
+++ b/llvm/test/tools/obj2yaml/XCOFF/aux-symbols.yaml
@@ -0,0 +1,264 @@
+## Check that obj2yaml can parse auxiliary symbols for XCOFF object file correctly.
+
+## 32-bit
+# RUN: yaml2obj %s --docnum=1 -o %t32
+# RUN: obj2yaml %t32 | FileCheck %s --check-prefix=CHECK32
+
+# CHECK32: --- !XCOFF
+# CHECK32-NEXT: FileHeader:
+# CHECK32-NEXT: MagicNumber: 0x1DF
+# CHECK32-NEXT: NumberOfSections: 0
+# CHECK32-NEXT: CreationTime: 0
+# CHECK32-NEXT: OffsetToSymbolTable: 0x14
+# CHECK32-NEXT: EntriesInSymbolTable: 13
+# CHECK32-NEXT: AuxiliaryHeaderSize: 0
+# CHECK32-NEXT: Flags: 0x0
+# CHECK32-NEXT: Symbols:
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_FILE
+# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_FILE
+# CHECK32-NEXT: FileNameOrString: FileName
+# CHECK32-NEXT: FileStringType: XFT_CD
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_HIDEXT
+# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_CSECT
+# CHECK32-NEXT: ParameterHashIndex: 1
+# CHECK32-NEXT: TypeChkSectNum: 2
+# CHECK32-NEXT: SymbolAlignmentAndType: 41
+# CHECK32-NEXT: StorageMappingClass: XMC_PR
+# CHECK32-NEXT: SectionOrLength: 3
+# CHECK32-NEXT: StabInfoIndex: 4
+# CHECK32-NEXT: StabSectNum: 5
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_EXT
+# CHECK32-NEXT: NumberOfAuxEntries: 2
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_FCN
+# CHECK32-NEXT: OffsetToExceptionTbl: 1
+# CHECK32-NEXT: SizeOfFunction: 2
+# CHECK32-NEXT: SymIdxOfNextBeyond: 3
+# CHECK32-NEXT: PtrToLineNum: 4
+# CHECK32-NEXT: - Type: AUX_CSECT
+# CHECK32-NEXT: ParameterHashIndex: 1
+# CHECK32-NEXT: TypeChkSectNum: 2
+# CHECK32-NEXT: SymbolAlignmentAndType: 17
+# CHECK32-NEXT: StorageMappingClass: XMC_PR
+# CHECK32-NEXT: SectionOrLength: 4
+# CHECK32-NEXT: StabInfoIndex: 5
+# CHECK32-NEXT: StabSectNum: 6
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_DWARF
+# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_SECT
+# CHECK32-NEXT: LengthOfSectionPortion: 44
+# CHECK32-NEXT: NumberOfRelocEnt: 1
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_STAT
+# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_STAT
+# CHECK32-NEXT: SectionLength: 1
+# CHECK32-NEXT: NumberOfRelocEnt: 2
+# CHECK32-NEXT: NumberOfLineNum: 3
+# CHECK32-NEXT: - Name: ''
+# CHECK32-NEXT: Value: 0x0
+# CHECK32-NEXT: Section: N_UNDEF
+# CHECK32-NEXT: Type: 0x0
+# CHECK32-NEXT: StorageClass: C_BLOCK
+# CHECK32-NEXT: NumberOfAuxEntries: 1
+# CHECK32-NEXT: AuxEntries:
+# CHECK32-NEXT: - Type: AUX_SYM
+# CHECK32-NEXT: LineNumHi: 1
+# CHECK32-NEXT: LineNumLo: 2
+
+--- !XCOFF
+FileHeader:
+ MagicNumber: 0x01DF
+Symbols:
+ - StorageClass: C_FILE
+ AuxEntries:
+ - Type: AUX_FILE
+ FileNameOrString: FileName
+ FileStringType: XFT_CD
+ - StorageClass: C_HIDEXT
+ AuxEntries:
+ - Type: AUX_CSECT
+ ParameterHashIndex: 1
+ TypeChkSectNum: 2
+ SymbolAlignmentAndType: 41
+ SectionOrLength: 3
+ StabInfoIndex: 4
+ StabSectNum: 5
+ - StorageClass: C_EXT
+ AuxEntries:
+ - Type: AUX_FCN
+ OffsetToExceptionTbl: 1
+ SizeOfFunction: 2
+ SymIdxOfNextBeyond: 3
+ PtrToLineNum: 4
+ - Type: AUX_CSECT
+ ParameterHashIndex: 1
+ TypeChkSectNum: 2
+ SymbolAlignmentAndType: 17
+ SectionOrLength: 4
+ StabInfoIndex: 5
+ StabSectNum: 6
+ - StorageClass: C_DWARF
+ AuxEntries:
+ - Type: AUX_SECT
+ LengthOfSectionPortion: 44
+ NumberOfRelocEnt: 1
+ - StorageClass: C_STAT
+ AuxEntries:
+ - Type: AUX_STAT
+ SectionLength: 1
+ NumberOfRelocEnt: 2
+ NumberOfLineNum: 3
+ - StorageClass: C_BLOCK
+ AuxEntries:
+ - Type: AUX_SYM
+ LineNumHi: 1
+ LineNumLo: 2
+
+## 64-bit
+# RUN: yaml2obj %s --docnum=2 -o %t64
+# RUN: obj2yaml %t64 | FileCheck %s --check-prefix=CHECK64
+
+# CHECK64: --- !XCOFF
+# CHECK64-NEXT: FileHeader:
+# CHECK64-NEXT: MagicNumber: 0x1F7
+# CHECK64-NEXT: NumberOfSections: 0
+# CHECK64-NEXT: CreationTime: 0
+# CHECK64-NEXT: OffsetToSymbolTable: 0x18
+# CHECK64-NEXT: EntriesInSymbolTable: 12
+# CHECK64-NEXT: AuxiliaryHeaderSize: 0
+# CHECK64-NEXT: Flags: 0x0
+# CHECK64-NEXT: Symbols:
+# CHECK64-NEXT: - Name: ''
+# CHECK64-NEXT: Value: 0x0
+# CHECK64-NEXT: Section: N_UNDEF
+# CHECK64-NEXT: Type: 0x0
+# CHECK64-NEXT: StorageClass: C_FILE
+# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_FILE
+# CHECK64-NEXT: FileNameOrString: FileName
+# CHECK64-NEXT: FileStringType: XFT_CD
+# CHECK64-NEXT: - Name: ''
+# CHECK64-NEXT: Value: 0x0
+# CHECK64-NEXT: Section: N_UNDEF
+# CHECK64-NEXT: Type: 0x0
+# CHECK64-NEXT: StorageClass: C_HIDEXT
+# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_CSECT
+# CHECK64-NEXT: ParameterHashIndex: 1
+# CHECK64-NEXT: TypeChkSectNum: 2
+# CHECK64-NEXT: SymbolAlignmentAndType: 41
+# CHECK64-NEXT: StorageMappingClass: XMC_PR
+# CHECK64-NEXT: SectionOrLengthLo: 3
+# CHECK64-NEXT: SectionOrLengthHi: 4
+# CHECK64-NEXT: - Name: ''
+# CHECK64-NEXT: Value: 0x0
+# CHECK64-NEXT: Section: N_UNDEF
+# CHECK64-NEXT: Type: 0x0
+# CHECK64-NEXT: StorageClass: C_EXT
+# CHECK64-NEXT: NumberOfAuxEntries: 3
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_FCN
+# CHECK64-NEXT: SizeOfFunction: 3
+# CHECK64-NEXT: SymIdxOfNextBeyond: 2
+# CHECK64-NEXT: PtrToLineNum: 1
+# CHECK64-NEXT: - Type: AUX_EXCEPT
+# CHECK64-NEXT: OffsetToExceptionTbl: 1
+# CHECK64-NEXT: SizeOfFunction: 2
+# CHECK64-NEXT: SymIdxOfNextBeyond: 3
+# CHECK64-NEXT: - Type: AUX_CSECT
+# CHECK64-NEXT: ParameterHashIndex: 1
+# CHECK64-NEXT: TypeChkSectNum: 2
+# CHECK64-NEXT: SymbolAlignmentAndType: 17
+# CHECK64-NEXT: StorageMappingClass: XMC_PR
+# CHECK64-NEXT: SectionOrLengthLo: 3
+# CHECK64-NEXT: SectionOrLengthHi: 4
+# CHECK64-NEXT: - Name: ''
+# CHECK64-NEXT: Value: 0x0
+# CHECK64-NEXT: Section: N_UNDEF
+# CHECK64-NEXT: Type: 0x0
+# CHECK64-NEXT: StorageClass: C_DWARF
+# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_SECT
+# CHECK64-NEXT: LengthOfSectionPortion: 44
+# CHECK64-NEXT: NumberOfRelocEnt: 1
+# CHECK64-NEXT: - Name: ''
+# CHECK64-NEXT: Value: 0x0
+# CHECK64-NEXT: Section: N_UNDEF
+# CHECK64-NEXT: Type: 0x0
+# CHECK64-NEXT: StorageClass: C_BLOCK
+# CHECK64-NEXT: NumberOfAuxEntries: 1
+# CHECK64-NEXT: AuxEntries:
+# CHECK64-NEXT: - Type: AUX_SYM
+# CHECK64-NEXT: LineNum: 1
+
+--- !XCOFF
+FileHeader:
+ MagicNumber: 0x1F7
+Symbols:
+ - StorageClass: C_FILE
+ AuxEntries:
+ - Type: AUX_FILE
+ FileNameOrString: FileName
+ FileStringType: XFT_CD
+ - StorageClass: C_HIDEXT
+ AuxEntries:
+ - Type: AUX_CSECT
+ ParameterHashIndex: 1
+ TypeChkSectNum: 2
+ SymbolAlignmentAndType: 41
+ SectionOrLengthLo: 3
+ SectionOrLengthHi: 4
+ - StorageClass: C_EXT
+ AuxEntries:
+ - Type: AUX_FCN
+ SizeOfFunction: 3
+ SymIdxOfNextBeyond: 2
+ PtrToLineNum: 1
+ - Type: AUX_EXCEPT
+ OffsetToExceptionTbl: 1
+ SizeOfFunction: 2
+ SymIdxOfNextBeyond: 3
+ - Type: AUX_CSECT
+ ParameterHashIndex: 1
+ TypeChkSectNum: 2
+ SymbolAlignmentAndType: 17
+ SectionOrLengthLo: 3
+ SectionOrLengthHi: 4
+ - StorageClass: C_DWARF
+ AuxEntries:
+ - Type: AUX_SECT
+ LengthOfSectionPortion: 44
+ NumberOfRelocEnt: 1
+ - StorageClass: C_BLOCK
+ AuxEntries:
+ - Type: AUX_SYM
+ LineNum: 1
diff --git a/llvm/tools/obj2yaml/xcoff2yaml.cpp b/llvm/tools/obj2yaml/xcoff2yaml.cpp
index 882c410496012a1..1960513c611e8e7 100644
--- a/llvm/tools/obj2yaml/xcoff2yaml.cpp
+++ b/llvm/tools/obj2yaml/xcoff2yaml.cpp
@@ -29,6 +29,11 @@ class XCOFFDumper {
XCOFFDumper(const object::XCOFFObjectFile &obj) : Obj(obj) {}
Error dump();
XCOFFYAML::Object &getYAMLObj() { return YAMLObj; }
+
+ template <typename T> const T *getAuxEntPtr(uintptr_t AuxAddress) {
+ Obj.checkSymbolEntryPointer(AuxAddress);
+ return reinterpret_cast<const T *>(AuxAddress);
+ }
};
} // namespace
@@ -106,6 +111,70 @@ Error XCOFFDumper::dumpSections(ArrayRef<Shdr> Sections) {
return Error::success();
}
+static void
+dumpStatAuxSym(std::vector<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> *AuxEntTbl,
+ const object::XCOFFSectAuxEntForStat *AuxEntPtr) {
+ XCOFFYAML::SectAuxEntForStat StatAuxSym;
+ StatAuxSym.SectionLength = AuxEntPtr->SectionLength;
+ StatAuxSym.NumberOfLineNum = AuxEntPtr->NumberOfLineNum;
+ StatAuxSym.NumberOfRelocEnt = AuxEntPtr->NumberOfRelocEnt;
+ AuxEntTbl->push_back(
+ std::make_unique<XCOFFYAML::SectAuxEntForStat>(StatAuxSym));
+}
+
+static void
+dumpFunAuxSym(std::vector<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> *AuxEntTbl,
+ const object::XCOFFFunctionAuxEnt32 *AuxEntPtr) {
+ XCOFFYAML::FunctionAuxEnt FunAuxSym;
+ FunAuxSym.OffsetToExceptionTbl = AuxEntPtr->OffsetToExceptionTbl;
+ FunAuxSym.PtrToLineNum = AuxEntPtr->PtrToLineNum;
+ FunAuxSym.SizeOfFunction = AuxEntPtr->SizeOfFunction;
+ FunAuxSym.SymIdxOfNextBeyond = AuxEntPtr->SymIdxOfNextBeyond;
+ AuxEntTbl->push_back(std::make_unique<XCOFFYAML::FunctionAuxEnt>(FunAuxSym));
+}
+
+static void
+dumpFunAuxSym(std::vector<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> *AuxEntTbl,
+ const object::XCOFFFunctionAuxEnt64 *AuxEntPtr) {
+ XCOFFYAML::FunctionAuxEnt FunAuxSym;
+ FunAuxSym.PtrToLineNum = AuxEntPtr->PtrToLineNum;
+ FunAuxSym.SizeOfFunction = AuxEntPtr->SizeOfFunction;
+ FunAuxSym.SymIdxOfNextBeyond = AuxEntPtr->SymIdxOfNextBeyond;
+ AuxEntTbl->push_back(std::make_unique<XCOFFYAML::FunctionAuxEnt>(FunAuxSym));
+}
+
+static void
+dumpExpAuxSym(std::vector<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> *AuxEntTbl,
+ const object::XCOFFExceptionAuxEnt *AuxEntPtr) {
+ XCOFFYAML::ExcpetionAuxEnt ExceptAuxSym;
+ ExceptAuxSym.OffsetToExceptionTbl = AuxEntPtr->OffsetToExceptionTbl;
+ ExceptAuxSym.SizeOfFunction = AuxEntPtr->SizeOfFunction;
+ ExceptAuxSym.SymIdxOfNextBeyond = AuxEntPtr->SymIdxOfNextBeyond;
+ AuxEntTbl->push_back(
+ std::make_unique<XCOFFYAML::ExcpetionAuxEnt>(ExceptAuxSym));
+}
+
+static void dumpCscetAuxSym(
+ std::vector<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>> *AuxEntTbl,
+ const object::XCOFFCsectAuxRef &AuxEntPtr, bool Is64bit) {
+ XCOFFYAML::CsectAuxEnt CsectAuxSym;
+ CsectAuxSym.ParameterHashIndex = AuxEntPtr.getParameterHashIndex();
+ CsectAuxSym.TypeChkSectNum = AuxEntPtr.getTypeChkSectNum();
+ CsectAuxSym.SymbolAlignmentAndType = AuxEntPtr.getSymbolAlignmentAndType();
+ CsectAuxSym.StorageMappingClass = AuxEntPtr.getStorageMappingClass();
+ if (Is64bit) {
+ CsectAuxSym.SectionOrLengthLo =
+ static_cast<uint32_t>(AuxEntPtr.getSectionOrLength64());
+ C...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/70642
More information about the llvm-commits
mailing list