Place unwind info directly after the text section, even when debug info is enabled

When debug info was enabled, we would put the debug info sections in between the
text section and the unwind info section. But the unwind info is encoded in a
position-independent manner (so that we don't need relocs for it) that relies on
it directly following the text section. The result of the misplacement was some
crashes inside the unwinder.
This commit is contained in:
Nick Fitzgerald
2021-09-09 12:38:25 -07:00
parent 0499cca2fa
commit 4b256ab968
3 changed files with 55 additions and 12 deletions

View File

@@ -25,6 +25,12 @@ impl UnwindRegistration {
unwind_info: *mut u8,
unwind_len: usize,
) -> Result<UnwindRegistration> {
debug_assert_eq!(
unwind_info as usize % region::page::size(),
0,
"The unwind info must always be aligned to a page"
);
let mut registrations = Vec::new();
if cfg!(any(
all(target_os = "linux", target_env = "gnu"),