[llvm] [Object] Beginnings of SFrame parser and dumper (PR #147294)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 02:22:41 PDT 2025


================
@@ -6428,6 +6432,62 @@ template <typename ELFT> void ELFDumper<ELFT>::printMemtag() {
   printMemtag(DynamicEntries, AndroidNoteDesc, GlobalDescriptors);
 }
 
+template <typename ELFT>
+void ELFDumper<ELFT>::printSectionsAsSFrame(ArrayRef<std::string> Sections) {
+  constexpr endianness E = ELFT::Endianness;
+  for (object::SectionRef Section :
+       getSectionRefsByNameOrIndex(ObjF, Sections)) {
+    StringRef SectionName;
+    if (Error Err = Section.getName().moveInto(SectionName)) {
+      SectionName = "<error>";
+      reportWarning(std::move(Err), FileName);
+    }
+
+    DictScope SectionScope(W,
+                           formatv("SFrame section '{0}'", SectionName).str());
+
+    StringRef SectionContent;
+    if (Error Err = Section.getContents().moveInto(SectionContent)) {
+      reportWarning(std::move(Err), FileName);
----------------
labath wrote:

Done. The ShSize thingy is quite neat.

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


More information about the llvm-commits mailing list