[llvm] [XCOFF][obj2yaml] support parsing auxiliary symbols for XCOFF (PR #70642)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 01:10:07 PDT 2023
================
@@ -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) {
----------------
jh7370 wrote:
Nit: it might be slightly easier to read if there was a blank line before this `if`.
https://github.com/llvm/llvm-project/pull/70642
More information about the llvm-commits
mailing list