pub fn build_lsda_section(
lsda_data: Vec<Option<FunctionLsdaData>>,
pointer_bytes: u8,
tag_offsets: &HashMap<u32, u32>,
tag_section_index: Option<SectionIndex>,
) -> (Option<CustomSection>, Vec<Option<u32>>)Expand description
Build the LSDA custom section and record the offset for each function.
Returns the section (if any) and a vector mapping each function index to its LSDA offset inside the section. Even when utilizing the same landing pad for exception tags, Cranelift generates separate landing pad locations. These locations are essentially small trampolines that redirect to the basic block we established (the EH dispatch block).
The section can be dumped using the elfutils’ readelf tool:
objcopy -I binary -O elf64-x86-64 --rename-section .data=.gcc_except_table,alloc,contents lsda.bin object.o && eu-readelf -w object.o