Skip to content

Native CPU is not reported on Raspbian #84890

Open
@kryptan

Description

@kryptan

Executing rustc --print target-cpus or rustc -Ctarget-cpu=help on Raspberry Pi 4 prints the following:

Available CPUs for this target:
    arm1020e
    arm1020t
    arm1022e
    ...

In contrast, executing the same command on Windows or Ubuntu on x86-64 also prints native CPU:

Available CPUs for this target:
    native         - Select the CPU of the current host (currently skylake).
    alderlake
    amdfam10
    athlon
    ...

In source code there is check for cross compilation. Native CPU is only printed when not cross compiling:

  printf("Available CPUs for this target:\n");
  if (HostArch == TargetArch) {
    const StringRef HostCPU = sys::getHostCPUName();
    printf("    %-*s - Select the CPU of the current host (currently %.*s).\n",
      MaxCPULen, "native", (int)HostCPU.size(), HostCPU.data());
  }

However I'm not cross compiling. I'm using rust installed from rustup and don't have any additional targets installed.

rustup show:

Default host: armv7-unknown-linux-gnueabihf
rustup home:  /home/pi/.rustup

nightly-armv7-unknown-linux-gnueabihf (default)
rustc 1.54.0-nightly (716394d65 2021-05-03)

lsb_release -a:

No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

rustc --version --verbose:

rustc 1.54.0-nightly (716394d65 2021-05-03)
binary: rustc
commit-hash: 716394d6581b60c75cfdd88b8e5b876f2db88b62
commit-date: 2021-05-03
host: armv7-unknown-linux-gnueabihf
release: 1.54.0-nightly
LLVM version: 12.0.0

Relevant #44393 #44407

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-targetsArea: Concerning the implications of different compiler targetsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions