Define a leaf function that just returns. With `preserve_frame_pointers` on, this is enough to make cranelift emit a System V FDE for it.
(module: &mut ObjectModule, name: &str)
| 338 | /// Define a leaf function that just returns. With `preserve_frame_pointers` |
| 339 | /// on, this is enough to make cranelift emit a System V FDE for it. |
| 340 | fn define_leaf(module: &mut ObjectModule, name: &str) -> FuncId { |
| 341 | let sig = Signature { |
| 342 | params: vec![], |
| 343 | returns: vec![], |
| 344 | call_conv: CallConv::SystemV, |
| 345 | }; |
| 346 | let func_id = module.declare_function(name, Linkage::Local, &sig).unwrap(); |
| 347 | let mut ctx = Context::new(); |
| 348 | ctx.func = Function::with_name_signature(UserFuncName::user(0, func_id.as_u32()), sig); |
| 349 | let mut func_ctx = FunctionBuilderContext::new(); |
| 350 | { |
| 351 | let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx); |
| 352 | let block = bcx.create_block(); |
| 353 | bcx.switch_to_block(block); |
| 354 | bcx.ins().return_(&[]); |
| 355 | bcx.seal_all_blocks(); |
| 356 | bcx.finalize(); |
| 357 | } |
| 358 | module.define_function(func_id, &mut ctx).unwrap(); |
| 359 | func_id |
| 360 | } |
| 361 | |
| 362 | /// Iterate the entries in `.eh_frame` bytes, returning `(cie_count, fde_count)`. |
| 363 | fn count_entries(data: &[u8]) -> (usize, usize) { |
no test coverage detected