Skip to content

Nightly 2025-02-03 to 2025-02-04: "Error loading target specification: target feature sse2 is required by the ABI but gets disabled in target spec" with JSON target specification #136544

Closed as not planned
@fmckeogh

Description

@fmckeogh

Code

I have the following target JSON (same as x86_64-unknown-none but with dynamic linking enabled) for a kernel (https://github.com/avisi-group/borg/tree/main/brig):

{
  "arch": "x86_64",
  "code-model": "kernel",
  "cpu": "x86-64",
  "crt-objects-fallback": "false",
  "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
  "disable-redzone": true,
  "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float",
  "is-builtin": false,
  "dynamic-linking": true,
  "linker": "rust-lld",
  "linker-flavor": "gnu-lld",
  "llvm-target": "x86_64-unknown-none-elf",
  "max-atomic-width": 64,
  "metadata": {
    "description": null,
    "host_tools": null,
    "std": null,
    "tier": null
  },
  "panic-strategy": "abort",
  "plt-by-default": false,
  "position-independent-executables": true,
  "relro-level": "full",
  "stack-probes": {
    "kind": "inline"
  },
  "static-position-independent-executables": true,
  "supported-sanitizers": [
    "kcfi",
    "kernel-address"
  ],
  "target-pointer-width": "64"
}

In nightlies earlier and including 2025-02-03 this compiles correctly. Today, nightly-2025-02-04 gives the following error:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/fm208/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C force-frame-pointers=yes -C link-arg=-z -C link-arg=nostar)
  --- stderr
  error: Error loading target specification: target feature `sse2` is required by the ABI but gets disabled in target spec. Run `rustc --print target-list` for a list of built-in targets

I believe this might be related to #134794, but I am not sure what the fix would be for my code?

Version it worked on

It most recently worked on: nightly-2025-02-03

Version with regression

I don't understand the following, however. When I run the 2025-02-04 binary, it reports the same commit hash and LLVM version as 2025-02-03 but I'm definitely experiencing different behavior when I switch between them. Either with rust-toolchain.toml or cargo +<toolchain>.

rustc --version --verbose:

$ ~/.rustup/toolchains/nightly-2025-02-04-x86_64-unknown-linux-gnu/bin/rustc  --version --verbose
rustc 1.86.0-nightly (f027438f8 2025-02-03)
binary: rustc
commit-hash: f027438f8bc6b747528dca8b8de13043544d7238
commit-date: 2025-02-03
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.A-target-specsArea: Compile-target specificationsC-discussionCategory: Discussion or questions that doesn't represent real issues.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