blob: f8f39a3e685514f3d49d27c185fff0f7a7a97172 [file] [log] [blame]
// SPDX-License-Identifier: GPL-2.0
//! Our own `compiler_builtins`.
//! Rust provides [`compiler_builtins`] as a port of LLVM's [`compiler-rt`].
//! Since we do not need the vast majority of them, we avoid the dependency
//! by providing this file.
//! At the moment, some builtins are required that should not be. For instance,
//! [`core`] has 128-bit integers functionality which we should not be compiling
//! in. We will work with upstream [`core`] to provide feature flags to disable
//! the parts we do not need. For the moment, we define them to [`panic!`] at
//! runtime for simplicity to catch mistakes, instead of performing surgery
//! on `core.o`.
//! In any case, all these symbols are weakened to ensure we do not override
//! those that may be provided by the rest of the kernel.
//! [`compiler_builtins`]:
//! [`compiler-rt`]:
macro_rules! define_panicking_intrinsics(
($reason: tt, { $($ident: ident, )* }) => {
pub extern "C" fn $ident() {
define_panicking_intrinsics!("`f32` should not be used", {
define_panicking_intrinsics!("`f64` should not be used", {
define_panicking_intrinsics!("`i128` should not be used", {
define_panicking_intrinsics!("`u128` should not be used", {