Expand description
lsda is a library for reading and writing the language-specific data
area (LSDA) of GCC-compatible exception handling, as stored in the
.gcc_except_table section.
An LSDA describes, for one function, which call sites may throw, where
their landing pads are, and which exception types each landing pad
handles. The personality routine (such as __gxx_personality_v0) finds it
through the L augmentation of the function’s FDE in .eh_frame, or,
on Arm, at the end of the function’s .ARM.extab entry.
The format has no standalone specification. It is defined by its producers and consumers, which this crate follows:
- GCC
gcc/except.cc(output_one_function_exception_table), the original producer; - libstdc++
libsupc++/eh_personality.ccand libgccunwind-pe.h, the reference consumer, including its Arm EHABI and SJLJ variants; - LLVM
CodeGen/AsmPrinter/EHStreamer.cppand libc++abicxa_personality.cpp.
Pointer encodings are the DW_EH_PE_* values of the Linux Standard Base
Core Specification 5.0, “Exception Frames”.
The API is organised as follows:
-
The
readmodule parses an LSDA at a given offset through theReadertrait, with zero-copyEndianSliceas the usual implementation. Iterators returnResult<Option<T>>. -
The
writemodule builds an in-memoryGccExceptTableand writes it to aWritersuch asEndianVec, optionally recording relocations.
The read and write module documentation each start with
a complete example.
§Cargo features
read(default): thereadmodule.write(default): thewritemodule.fallible-iterator: implementfallible_iterator::FallibleIteratorfor the iterators.
The crate is no_std and requires alloc. The error types implement
core::error::Error.
Modules§
- constants
- Constant definitions.
- leb128
- LEB128 encoding, as used throughout the LSDA.
- read
read - Read LSDAs from
.gcc_except_table(or.ARM.extab). - write
write - Write LSDAs to
.gcc_except_table.
Structs§
- Base
Addresses - The base addresses that relative pointer encodings are resolved against.
- BigEndian
- Big endian byte order.
- Encoding
- A
DW_EH_PE_*pointer encoding. - Format
- The target properties needed to parse or write an LSDA.
- Little
Endian - Little endian byte order.
- Lsda
Offset - An offset into the section that holds the LSDAs.
Enums§
- Base
- One of the base addresses in
BaseAddresses. - RunTime
Endian - Byte order that is selectable at runtime.
- Unwinder
- The unwinder that the tables are used with.
Traits§
- Endianity
- A trait describing the endianity of some buffer.
Type Aliases§
- Native
Endian Little-endian - The native endianity for the target platform.