[llvm] [XCOFF][obj2yaml] support parsing auxiliary symbols for XCOFF (PR #70642)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 07:24:13 PST 2023


================
@@ -106,6 +126,210 @@ Error XCOFFDumper::dumpSections(ArrayRef<Shdr> Sections) {
   return Error::success();
 }
 
+Error XCOFFDumper::dumpFileAuxSym(XCOFFYAML::Symbol &Sym,
+                                  const XCOFFSymbolRef &SymbolEntRef) {
+  for (uint8_t I = 1; I <= Sym.NumberOfAuxEntries; ++I) {
+    uintptr_t AuxAddress = XCOFFObjectFile::getAdvancedSymbolEntryAddress(
+        SymbolEntRef.getEntryAddress(), I);
+    const XCOFFFileAuxEnt *FileAuxEntPtr =
+        getAuxEntPtr<XCOFFFileAuxEnt>(AuxAddress);
+    auto FileNameOrError = Obj.getCFileName(FileAuxEntPtr);
+    if (!FileNameOrError)
+      return FileNameOrError.takeError();
+
+    XCOFFYAML::FileAuxEnt FileAuxSym;
+    FileAuxSym.FileNameOrString = FileNameOrError.get();
+    FileAuxSym.FileStringType = FileAuxEntPtr->Type;
+    Sym.AuxEntries.push_back(
----------------
diggerlin wrote:

for all the 64-bits auxiliary symbol entries, there is a field named `x_auxtype` , I think  we need to print it out too, although the field can derived from the content of  the auxiliary by user.    obj2yaml is dump tool , we need to display all the fields in the auxiliary symbol entries 


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


More information about the llvm-commits mailing list