[llvm] [obj2yaml] Add Obj2Yaml ability to dump GOFF ESD records (PR #216151)

Yusra Syeda via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 08:47:40 PDT 2026


================
@@ -74,7 +74,145 @@ Error GOFFDumper::dumpHeader(ArrayRef<uint8_t> Data) {
 }
 
 Error GOFFDumper::dumpExternalSymbol(ArrayRef<uint8_t> Data) {
-  // TODO: Implement dumping ESD records
+  GOFFYAML::ESDRecord Sym;
+  // Flattened data contains PTV header (bytes 0-2) + bytes 3-72 (prefix) + name
+  // data Use DataExtractor to read fields with correct endianness (big-endian
+  // for GOFF)
+  DataExtractor DE(Data, false); // false = big-endian
+  DataExtractor::Cursor C(0);
+
+  // Skip PTV header (bytes 0-2)
+  C.seek(3);
+
+  // ESD fields starting from byte 3:
+  // Byte 3: Symbol Type
+  Sym.SymbolType = DE.getU8(C);
+
+  // Bytes 4-7: ESD ID
+  Sym.ESDID = DE.getU32(C);
+
+  // Bytes 8-11: Parent ESD ID
+  uint32_t ParentEsdId = DE.getU32(C);
+  if (ParentEsdId)
----------------
ysyeda wrote:

Yes, both sides are tested in esd-basic.test. When a field is non-zero, it is printed in the YAML (e.g., ParentESDID: 1), and when it is zero, the field is omitted (e.g., records with no ParentESDID).

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


More information about the llvm-commits mailing list