[llvm] [Object] Parsing and dumping of SFrame FDEs (PR #149828)
Indu Bhagat via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 09:52:53 PDT 2025
================
@@ -19,24 +19,37 @@ namespace object {
template <endianness E> class SFrameParser {
public:
- static Expected<SFrameParser> create(ArrayRef<uint8_t> Contents);
+ static Expected<SFrameParser> create(ArrayRef<uint8_t> Contents,
+ uint64_t SectionAddress);
const sframe::Preamble<E> &getPreamble() const { return Header.Preamble; }
const sframe::Header<E> &getHeader() const { return Header; }
+ Expected<ArrayRef<uint8_t>> getAuxHeader() const;
+
bool usesFixedRAOffset() const {
return getHeader().ABIArch == sframe::ABI::AMD64EndianLittle;
}
bool usesFixedFPOffset() const {
return false; // Not used in any currently defined ABI.
}
+ using FDERange = ArrayRef<sframe::FuncDescEntry<E>>;
+ Expected<FDERange> fdes() const;
+
+ // Decodes the start address of the given FDE, which must be one of the
+ // objects returned by the `fdes()` function.
+ uint64_t getAbsoluteStartAddress(typename FDERange::iterator FDE) const;
+
private:
ArrayRef<uint8_t> Data;
+ uint64_t SectionAddress;
const sframe::Header<E> &Header;
- SFrameParser(ArrayRef<uint8_t> Data, const sframe::Header<E> &Header)
- : Data(Data), Header(Header) {}
+ SFrameParser(ArrayRef<uint8_t> Data, uint64_t SectionAddress, const sframe::Header<E> &Header)
+ : Data(Data), SectionAddress(SectionAddress), Header(Header) {}
+
+ uint64_t getFDEBegin() const { return sizeof(Header) + Header.AuxHdrLen + Header.FDEOff; }
----------------
ibhagatgnu wrote:
@labath the SFrame FDE offset is the offset of the FDE sub-section from the end of the SFrame header. So, the omission in the sframe_decode is harmless, but should be done for doc purposes and clarity.
https://github.com/llvm/llvm-project/pull/149828
More information about the llvm-commits
mailing list