From b212070c2e5f10c18692e5be6418359c7da147b8 Mon Sep 17 00:00:00 2001 From: Jack May Date: Tue, 1 Dec 2020 02:56:26 -0800 Subject: [PATCH] Use msg! in program entrypoint (#13889) (cherry picked from commit 57dd60f671b9bc4dbcc4f6f0c7646bad3cc86239) # Conflicts: # sdk/program/src/entrypoint.rs --- sdk/program/src/entrypoint.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sdk/program/src/entrypoint.rs b/sdk/program/src/entrypoint.rs index 588cb65b0e132b..db97560d8ddd6f 100644 --- a/sdk/program/src/entrypoint.rs +++ b/sdk/program/src/entrypoint.rs @@ -55,6 +55,24 @@ macro_rules! entrypoint { len: $crate::entrypoint::HEAP_LENGTH, }; +<<<<<<< HEAD +======= + /// A program can provide their own custom panic implementation by + /// adding a `custom-panic` feature to `Cargo.toml` and implementing + /// their own `custom_panic`. + /// + /// A good way to reduce the final size of the program is to provide a + /// `custom_panic` implementation that does nothing. Doing so will cut + /// ~25kb from a noop program. That number goes down the more the + /// programs pulls in Rust's libstd for other purposes. + #[cfg(all(not(feature = "custom-panic"), target_arch = "bpf"))] + #[no_mangle] + fn custom_panic(info: &core::panic::PanicInfo<'_>) { + // Full panic reporting + $crate::msg!("{}", info); + } + +>>>>>>> 57dd60f67... Use msg! in program entrypoint (#13889) /// # Safety #[no_mangle] pub unsafe extern "C" fn entrypoint(input: *mut u8) -> u64 {