Skip to content

Commit f95e9a9

Browse files
committed
Hide items generate by entry_point macro from static/fn namespace
1 parent 9cf9c4c commit f95e9a9

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

api/src/lib.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,25 @@ macro_rules! entry_point {
112112
$crate::entry_point!($path, config = &$crate::BootloaderConfig::new_default());
113113
};
114114
($path:path, config = $config:expr) => {
115-
#[link_section = ".bootloader-config"]
116-
pub static __BOOTLOADER_CONFIG: [u8; $crate::BootloaderConfig::SERIALIZED_LEN] = {
117-
// validate the type
118-
let config: &$crate::BootloaderConfig = $config;
119-
config.serialize()
120-
};
115+
const _: () = {
116+
#[link_section = ".bootloader-config"]
117+
pub static __BOOTLOADER_CONFIG: [u8; $crate::BootloaderConfig::SERIALIZED_LEN] = {
118+
// validate the type
119+
let config: &$crate::BootloaderConfig = $config;
120+
config.serialize()
121+
};
121122

122-
#[export_name = "_start"]
123-
pub extern "C" fn __impl_start(boot_info: &'static mut $crate::BootInfo) -> ! {
124-
// validate the signature of the program entry point
125-
let f: fn(&'static mut $crate::BootInfo) -> ! = $path;
123+
#[export_name = "_start"]
124+
pub extern "C" fn __impl_start(boot_info: &'static mut $crate::BootInfo) -> ! {
125+
// validate the signature of the program entry point
126+
let f: fn(&'static mut $crate::BootInfo) -> ! = $path;
126127

127-
// ensure that the config is used so that the linker keeps it
128-
$crate::__force_use(&__BOOTLOADER_CONFIG);
128+
// ensure that the config is used so that the linker keeps it
129+
$crate::__force_use(&__BOOTLOADER_CONFIG);
129130

130-
f(boot_info)
131-
}
131+
f(boot_info)
132+
}
133+
};
132134
};
133135
}
134136

0 commit comments

Comments
 (0)