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

regression/thumb: memcmp is missing from compiler-builtins #56814

Closed
japaric opened this issue Dec 14, 2018 · 3 comments
Closed

regression/thumb: memcmp is missing from compiler-builtins #56814

japaric opened this issue Dec 14, 2018 · 3 comments
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@japaric
Copy link
Member

japaric commented Dec 14, 2018

STR

$ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart --name app
$ cd app
$ # modify main
$ cat src/main.rs
#![no_std]
#![no_main]

extern crate panic_halt;

use cortex_m::asm;
use cortex_m_rt::entry;

#[entry]
fn main() -> ! {
    let x: &[i32] = &[0, 1, 2, 3];
    let y: &[i32] = &[0, 1, 2, 3, 4];

    if x == y {
        asm::nop();
    }

    loop {}
}
$ cargo build
error: linking with `rust-lld` failed: exit code: 1
(..)
  = note: rust-lld: error: undefined symbol: memcmp

Meta

$ rustc -V
rustc 1.32.0-nightly (f4a421ee3 2018-12-13)

It seems that all the unmangled mem* symbols are gone in newer nightlies.

$ nm -C $(rustc --print sysroot)/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-*.rlib | grep mem
00000001 W __aeabi_memclr
00000001 W __aeabi_memclr4
00000001 W __aeabi_memclr8
00000001 W __aeabi_memcpy
00000001 W __aeabi_memcpy4
00000001 W __aeabi_memcpy8
00000001 W __aeabi_memmove
00000001 W __aeabi_memmove4
00000001 W __aeabi_memmove8
00000001 W __aeabi_memset
00000001 W __aeabi_memset4
00000001 W __aeabi_memset8
00000001 T compiler_builtins::mem::memcmp
00000001 T compiler_builtins::mem::memcpy
00000001 T compiler_builtins::mem::memset
00000001 T compiler_builtins::mem::memmove

$ # older nightly
$ nm -C $(rustc +nightly-2018-12-08 --print sysroot)/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-*.rlib | grep mem
00000001 W __aeabi_memclr
00000001 W __aeabi_memclr4
00000001 W __aeabi_memclr8
00000001 W __aeabi_memcpy
00000001 W __aeabi_memcpy4
00000001 W __aeabi_memcpy8
00000001 W __aeabi_memmove
00000001 W __aeabi_memmove4
00000001 W __aeabi_memmove8
00000001 W __aeabi_memset
00000001 W __aeabi_memset4
00000001 W __aeabi_memset8
00000001 T memcmp
00000001 T memcpy
00000001 T memmove
00000001 T memset

I think it's fine to remove memcpy, memmove and memset because llvm uses the aeabi counterparts but memcmp is required.

cc @alexcrichton

@japaric japaric added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Dec 14, 2018
@alexcrichton
Copy link
Member

Sorry for the breakage! I think I've found the issue (almost fure sure a regression from #56092), and am testing out a fix locally

@alexcrichton
Copy link
Member

Ok should be fixed in #56825!

japaric added a commit to rtic-rs/rtic that referenced this issue Dec 15, 2018
@japaric
Copy link
Member Author

japaric commented Dec 16, 2018

This appears to be fixed in the latest nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

2 participants