Skip to content

stdenv: armv6-m cross config doesn't result in armv6-m wrapped-cc. #401170

@RossSmyth

Description

@RossSmyth

Nixpkgs version

  • Unstable (25.05)

Describe the bug

When building a cross-stdenv for armv6-m, it is generally expected that the wrapped cc provided targets armv6-m. The wrapped cc provided through the stdenv does not though, and in fact targets armv6kz. Armv6kz is an extension of armv6, an arch that supports ARM and some extensions, while armv6-m is the thumb-only embedded architecture. This means that the armv6-m config generates ARM instructions, which cannot be executed on an armv6-m processor.

Steps to reproduce

  1. Use the following pkgs definition:
crossPkgs = import nixpkgs {
    inherit currentSystem;
    crossSystem.config = "armv6m-none-eabi";
};
  1. Expose crossPkgs.stdenv.cc
  2. Run $ NIX_DEBUG=1 armv6m-none-eabi-gcc

You can optionally objdump a trivial program and notice that the instructions are all 32-bit ARM instructions. If you force thumb decoding (arm-none-eabi-objdump -Mforce-thumb), they are invalid.

Expected behaviour

The extra flags before would be -march=armv6-m

Screenshots

Image

objdump with force-thumb
Image

objdump without force-thumb. The movne instruction does not exist in thumbv1, there are not enough bits to encode the "ne". And also notice the second column is 32-bits wide.
Image

Relevant log output

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 5.15.167.4-microsoft-standard-WSL2, NixOS, 25.05 (Warbler), 25.05.20250421.c11863f
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.28.1
  • nixpkgs: /nix/store/kcmmd6alr3lx56vkf72503h3pxgf6iv4-source

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions