[llvm] [SFrames] Add FDEs for functions with .cfi_startproc (PR #154213)

Indu Bhagat via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 22:49:47 PDT 2025


================
@@ -36,16 +87,22 @@ class SFrameEmitterImpl {
                .getObjectFileInfo()
                ->getSFrameABIArch()
                .has_value());
+    FDEs.reserve(Streamer.getDwarfFrameInfos().size());
     SFrameABI = *Streamer.getContext().getObjectFileInfo()->getSFrameABIArch();
+
     FDESubSectionStart = Streamer.getContext().createTempSymbol();
     FRESubSectionStart = Streamer.getContext().createTempSymbol();
     FRESubSectionEnd = Streamer.getContext().createTempSymbol();
   }
 
+  void BuildSFDE(const MCDwarfFrameInfo &DF) {
+    FDEs.emplace_back(DF, Streamer.getContext().createTempSymbol());
+  }
+
   void emitPreamble() {
     Streamer.emitInt16(Magic);
     Streamer.emitInt8(static_cast<uint8_t>(Version::V2));
-    Streamer.emitInt8(0);
+    Streamer.emitInt8(static_cast<uint8_t>(Flags::FDEFuncStartPCRel));
----------------
ibhagatgnu wrote:

The sections emitted after linking have SFRAME_F_FDE_SORTED set (FDEs are sorted on start PC of function).  But currently GAS avoids the extra work of sorting FDEs on start PC as it was unnecessary to do.  Just FYI for now, in case that helps in laying out some abstractions better

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


More information about the llvm-commits mailing list