cc-wrapper: Allow user to override -target for clang#176152
cc-wrapper: Allow user to override -target for clang#176152Ericson2314 merged 3 commits intoNixOS:stagingfrom
Conversation
|
ping @Mindavi for review too |
|
I couldn't find anything in the repo that sets |
32afeff to
c109773
Compare
|
@06kellyjac give this a try |
|
This needs to point at staging instead. |
|
Also I don't think this is a good fix for #176128, because clang might try to produce a far binary for both arches instead. What you want is logic in cc-wrapper itself to only add a |
I find this surprising if true, got any links to documentation? So far everything I've seen to generate fat binaries or bundles is very much opt in with either clang args (clang offload bundler) or different tools (lipo, but I think this is osx only)
Setting aside the fat binaries, I think this makes sense anyway so will look into updating |
263f994 to
b7ae4b6
Compare
|
Hey @Ericson2314 I've rebased on-top of staging and re-targted the PR accordingly. Also made it so -target should only show up once in the final params just once. This ends up causing a full rebuild of clang which then ripples out, this did not happen with the previous approach, just an fyi. |
b7ae4b6 to
b1d3216
Compare
|
I feel like there was a reason for the if, elif chaining, but maybe it's just how it was written. Could that be because we're using a very old bash on MacOS and this is used during bootstrap or something? Hopefully someone else can confirm or deny. @happysalada do you know? |
I thought it might have been due to sh vs bash, but I verified that dash supports case and so I'd suspect old bash would too. |
|
The if/elif chaining makes more sense in the other params handling further down (for paths) because of the extra conditionals. The if/elif I replaced had a few of them too but I think the nested case works just fine for them. I got rid of the |
b1d3216 to
6faae98
Compare
|
|
|
Thanks for checking! It does look nicer with case IMO, so that's good. Could you point me to where clang sets the target? I cannot find it in a pinch. |
This enables users to make use of clang's multi-platform/target support without having to go through full cross system setup. This is especially useful for generating bpf object files, I'm not even usre what would a no-userland cross compile system tuple even look like to even try going that route. Fixes NixOS#176128
a4a2ab7 to
19b6ccd
Compare
|
@Ericson2314 how does this look? |
789ba28 to
0b039ef
Compare
|
I would tweak the names and make them consistent, but otherwise looks good! |
Can you elaborate? I copied the naming scheme used in bintools-wrapper: Do you want me to prefix |
|
Does this file already exist or is it missing: add-local-cflags-before.sh? |
|
@mmlb I don't know why bintools wrapper uses two different names either. Do you, @thefloweringash? |
Are we looking at extra "ld" in "add-local-ldflags-before.sh" that's not in "add-flags.sh"? If I was the one that introduced those (and history seems to indicate it was), then it was just an oversight. |
Does not exist. default.nix will create it for clang, if gcc ever needs a gcc only flag at runtime we could have a
Are we talking about the reason for |
|
I'm going to modify the commit so the files have |
This way gcc doesn't need to be rebuilt because of clang. This also avoids rebuilding clang when only the wrapper needs to be tweaked.
0b039ef to
0fdc72b
Compare
|
or do you mean I should have named |
|
I don't understand why the file in the Nixpkgs src has one name (with .sh) and the file "installed" as part of the built wrapper has a different name (still with .sh). I get it when we strip the .sh on install (e.g. installing something to I also don't understand why anything is called "local". What does "local" mean here? Finally, I don't like the use of "clang" because this applies equally well to any compiler that would accept |
|
ah gotcha. Yeah I think the idea is that there's an "interface" and clang and gcc can both implement it by having a file named I took re clang vs more fine grained names. I can rename so its just for target, but some of the other files here are specific to the tool not to the features so I went with that too since only clang does -target and thus yagni. Sounds like you want me to rename from clang -> target and maybe come up with something else more relevant than |
|
OK that makes some sense we can live with this for now. |
|
(the approval |
what do you mean? |
|
John means that he had some comments in an 'open review' and they were submitted when he merged/approved. That wasn't the intention since they were stale. |
|
Yes exactly. Thanks. |
|
ah, gotcha. |
Also simplified the package since after NixOS#176152 the tracee build process can now pass in a -target of bpf without weird overrides
Description of changes
Only sets -target in wrapped compiler if none is provided by the user. This is especially helpful for generating bpf objects.
Fixes #176128
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes