Re: [PATCH v3] rust: compiler_builtins: make stubs non-global

From: Miguel Ojeda
Date: Mon Jan 16 2023 - 18:35:30 EST


On Mon, Dec 5, 2022 at 10:45 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> Currently we define a number of stubs for compiler-builtin intrinsics
> that compiled libcore generates. The defined stubs are weak so they will
> not conflict with genuine implementation of these intrinsics, but their
> effect is global and will cause non-libcore code that accidently
> generate these intrinsics calls compile and bug on runtime.
>
> Instead of defining a stub that can affect all code, this patch uses
> objcopy's `--redefine-sym` flag to redirect these calls (from libcore
> only) to a prefixed version (e.g. redirect `__multi3` to `__rust_multi3`),
> so we can define panciking stubs that are only visible to libcore.
>
> This patch was previously discussed on GitHub [1].
>
> Link: https://github.com/Rust-for-Linux/linux/pull/779 [1]
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>

Applied to rust-next, thanks all!

Cheers,
Miguel