Skip to content

GCC wrapper makes specifying some -march values for MIPS impossible #290621

@0n-s

Description

@0n-s

Describe the bug

The nixpkgs GCC compilers force -march based on the target triple, as seen here:

# Always add -march based on cpu in triple. Sometimes there is a

GCC, however, errors out when -march flags conflict, at least for MIPS.

This is exceptionally important for the Linux kernel, which very much depends on being able to set these flags to compile for a specific machine at all. The machine I tried was the Nintendo 64, which forces -march=r4300.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Obtain a MIPS cross toolchain:
nix shell nixpkgs#pkgsCross.mips64-linux-gnuabi64.stdenv.cc
  1. Compile a program manually with e.g. -march=r4300:
$ mips64-unknown-linux-gnuabi64-gcc -march=r4300 aslrtest.c
cc1: error: ‘-mips64r2’ conflicts with the other architecture options, which specify a mips3 processor

Expected behavior

I would expect the compiler to use the user-specified -march.

Notify maintainers

Not quite sure who to ping for the Nixpkgs cross compiler infrastructure.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/g09jbj92l7j0wsvnch87z93mz9s8pz4i-nix-info
copying path '/nix/store/g09jbj92l7j0wsvnch87z93mz9s8pz4i-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.4, Gentoo, noversion, nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.19.3`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions