Prevent trampoline entrypoints from being stripped out during LTO (#5773)

This works around a `rustc` bug where compiling with LTO
will sometimes strip out some of the trampoline entrypoint
symbols resulting in a linking failure.
This commit is contained in:
Koute
2023-02-15 00:16:27 +09:00
committed by GitHub
parent 6df3bbbe60
commit e40a838beb

View File

@@ -122,6 +122,17 @@ pub mod trampolines {
Err(panic) => crate::traphandlers::resume_panic(panic),
}
}
// This works around a `rustc` bug where compiling with LTO
// will sometimes strip out some of these symbols resulting
// in a linking failure.
#[allow(non_upper_case_globals)]
#[used]
static [<impl_ $name _ref>]: unsafe extern "C" fn(
*mut VMContext,
$( $pname : libcall!(@ty $param), )*
) $( -> libcall!(@ty $result))? = [<impl_ $name>];
)*
}};