A backport of a fix for GCC bug 80431 was stored in-tree, while it is
available to download from the GCC upstream.
The advantage of fetching the patch is more obvious provenance.
The previous patch didn't apply anymore for 14.3.0.
Currently there is no branch for 14.3.0 in https://github.com/iains/gcc-14-branch
nor in homebrew. This lead me to use the -pre branch with a custom target.
Passing --with-ld causes problems when injecting a custom linker
wrapper (similar to useMoldLinker) because it causes collect2 to
check the --with-ld path (which is a hardcoded path to the standard
linker wrapper) before $PATH, whereas with custom linker wrappers we
want gcc to search $PATH.
Because binutils-wrapper is not guaranteed to be present in $PATH,
prepend it to $PATH in cc-wrapper.
I verified that -print-prog-name=ld still prints an appropriate
value. For example, when cross compiling for x86_64 on an aarch64
machine, the following is printed by the util-linux configure script
(which uses -print-prog-name=ld [1]):
checking for ld used by x86_64-unknown-linux-gnu-gcc... x86_64-unknown-linux-gnu-ld
We still pass --with-as because the gcc spec file relies on this
to find the assembler. This is probably fine for now as it is less
common to want to override the assembler than the linker.
[1] https://sources.debian.org/src/util-linux/2.41-4/m4/lib-ld.m4/?hl=59#L59
They are not doing anything right now. This is in preparation for their
complete removal from the tree.
Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.
Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
`gcc-14.3.0` will likely release around the end of April
(https://gcc.gnu.org/develop.html) which is a bit late for
nixos-25.05 release.
We can update to `gcc-14.3.0` after a branch-off, but let's
make the delca smaller by picking the current snapshot.
While at it:
- fix `flex` dependency propagation and use it for snapshots
- fix `version` to always contain the base version as
cc-wrapper constructs paths to libraries based in `version`
attribute
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
In libgcc.nix, `targetPlatformSlash` is set by checking if hostPlatform == targetPlatform.
In default.nix, `targetConfig` (which is also going to be part of the path) is also set by checking if hostPlatform == targetPlatform.
However, in common.nix, the recently added `isCross` is set by checking if hostPlatform.config == targetPlatform.config.
This means that for platforms like '-nolibc' the paths in common.nix are not set up correctly for libgcc.nix to find and move libgcc_s.so .
Changing isCross to also check hostPlatform == targetPlatform fixes this issue.
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev 78e9caf153
result/bin/apply-formatting $NIXPKGS_PATH
I think this was a rebase mishap and causes a ton of rebuilds.
Not sure if we actually need the Darwin condition any more (or to be
using the older `isl` version?), but `master` isn’t the place to
find out :)
Fixes: 90474914ee