[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>";
----------------
labath wrote:

Done. Right now, we bail out in `getSectionRefsByNameOrIndex`, so I've also changed the code to use `cantFail`. I think it'd make sense for `getSectionRefsByNameOrIndex` to not bail out in this case (for one, because it also supports selecting sections by index), but that's a job for a different patch.

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


More information about the llvm-commits mailing list