Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove __aeabi_uldivmod stub #779

Open
wants to merge 2 commits into
base: rust
Choose a base branch
from
Open

Commits on Nov 1, 2022

  1. rust: make compiler-builtin stubs non-global

    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.
    
    Signed-off-by: Gary Guo <gary@garyguo.net>
    nbdd0121 committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    2d98d37 View commit details
    Browse the repository at this point in the history
  2. rust: replace __aeabi_uldivmod stub with actual implementation

    Rust's libcore genuinely needs 64-bit division for formatting, but we
    can't change these to use kernel's division routine; so `__aeabi_uldivmod`
    calls will be generated.
    
    Instead of redirecting these calls to a panicking stub, forward them to
    `div64_u64_rem`.
    
    Signed-off-by: Gary Guo <gary@garyguo.net>
    nbdd0121 committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    17ea967 View commit details
    Browse the repository at this point in the history