Skip to content

disable CFI in the cross compiler to drop the unused .eh_frame - #182

Draft
samoht wants to merge 1 commit into
mirage:mainfrom
samoht:disable-cfi
Draft

disable CFI in the cross compiler to drop the unused .eh_frame#182
samoht wants to merge 1 commit into
mirage:mainfrom
samoht:disable-cfi

Conversation

@samoht

@samoht samoht commented Jul 10, 2026

Copy link
Copy Markdown
Member

OCaml native exceptions unwind through their own trap stack rather than DWARF, so the CFI the compiler emits is dead weight in a unikernel: a ~0.5 MiB .eh_frame that nothing ever reads. Because it is SHF_ALLOC in a PT_LOAD segment, strip cannot reclaim it either.

This builds the cross compiler with --disable-cfi, so ocamlopt never emits the .cfi_* directives in the first place and the section disappears from the target objects and the final image.

OCaml's native exceptions unwind through its own trap stack, not DWARF, so
the CFI the compiler emits ends up as a ~0.5 MiB .eh_frame that the unikernel
never reads. It is SHF_ALLOC in a PT_LOAD segment, so strip cannot reclaim it.
Configure the cross compiler with --disable-cfi so it is never emitted.
@samoht
samoht marked this pull request as draft July 10, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant