clang: don't set -march for overridden target#291901
clang: don't set -march for overridden target#291901vcunat merged 1 commit intoNixOS:staging-nextfrom
Conversation
83b4ca3 to
a939653
Compare
a939653 to
337069b
Compare
|
This issue seems similar (user-specified |
This change wouldn't make any sense for GCC, because GCC is a single-target compiler. There's no overriding of targets like there is in GCC. That issue is something else. |
|
@ofborg build ananicy-cpp below dae pwru suricata |
|
Can somebody please smoke test this on Darwin, since OfBorg can't? |
|
I checked out this PR and was able to build It's currently most of the way through: Do you have a more specific test in mind? |
|
Not really — I just needed to know that I hadn't somehow completely broken the compiler wrapper. That sounds like a decent test — let me know when it's done? |
|
It ran to completion with no troubles. |
If -target is explicitly passed to clang, we shouldn't pass our -march value for the default target, because it probably won't exist for the target being used. Up until now, clang has been lenient with this, but it's a hard error with clang 17, so since gcc.arch is always set on aarch64, fixing this is a hard requirement for upgrading our default clang to 17. Before (with clang 17 on aarch64-linux): $ clang -target bpf -c -o /dev/null test.bpf.c clang: warning: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Woption-ignored] clang: error: unsupported option '-march=' for target 'bpf' clang: warning: argument unused during compilation: '--gcc-toolchain=/nix/store/cngak08nb1yk44gnjipv5rg1ahh1xkax-gcc-13.2.0' [-Wunused-command-line-argument] After: $ clang -target bpf -c -o /dev/null test.bpf.c clang: warning: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Woption-ignored] clang: warning: argument unused during compilation: '--gcc-toolchain=/nix/store/cngak08nb1yk44gnjipv5rg1ahh1xkax-gcc-13.2.0' [-Wunused-command-line-argument]
|
looks like this might be effecting the swift aarch64-darwin build? https://hydra.nixos.org/build/251794147 |
|
I don't really have any capacity/ability to investigate Darwin, I'm afraid. I see that the Swift build involves building and wrapping its own Clang. Before, -march wasn't set on aarch64-darwin at all, because GCC and Clang's system names are incompatible. Now it is set, but only for Clang. We could revert to not setting it on aarch64-darwin at all, but it seems a shame to do that when it only seems to cause problems for Swift… |
|
Also aarch64-linux: https://hydra.nixos.org/build/251767188 |
|
@vcunat This seems to have been a breaking change for Darwin/apple sliicon users. Is anyone actively working on fix? I would be happy to help but will need some guidance. would a revert for now be an option? |
|
I'm not aware of anyone working on a fix, but this seems a good place to ask. Perhaps specify what in particular is broken. |
|
have a for swfit by adding an argument to disable the -march arg in cc-wrapper. #296082 |
Description of changes
If -target is explicitly passed to clang, we shouldn't pass our -march value for the default target, because it probably won't exist for the target being used. Up until now, clang has been lenient with this, but it's a hard error with clang 17, so since gcc.arch is always set on aarch64, fixing this is a hard requirement for upgrading our default clang to 17.
Before (with clang 17 on aarch64-linux):
After:
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.