Commit Graph

1113 Commits

Author SHA1 Message Date
Emily
cf71af6176 gcc: restore dropped isl line
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
2024-11-26 10:07:23 +00:00
Sergei Trofimovich
90474914ee gcc: do not allow version skew when cross-building gcc
When `gcc` is cross-built (`build` != `target` && `host` == `target`)
`gcc` assumes that it has a compatible cross-compiler in the environment
that can build target libraries. Version of a cross-compiler has to
match the compiler being cross-built as libraries frequently use fresh
compiler features, like `-std=c++26` or target-specific types like
`_Bfloat16`.

Version mismatch causes build failures like:

    https://github.com/NixOS/nixpkgs/issues/351905

Similar problems (but on a smaller scale) happen when a `gcc`
cross-compiler is built (`build` == `host` && `host` != `target`) built
by a mismatching version of a native compiler (`build` == `host` &&
`host` == `target`). That was worked around by forcing `gcc9Stdenv` for
older compiler versions.

Let's fix both problems by requiring the same compiler version for
cross-case.

Closes: https://github.com/NixOS/nixpkgs/issues/351905
2024-11-25 09:11:38 +00:00
Emily
86b5f88a2f {gcc8{,Stdenv},gfortran8}: drop
Release branch from 6½ years ago, no update in 3½ years, unsupported
upstream, and unused in tree.

This finally resolves the tangled conditionals in `all.nix`, albeit in
a way I assume amjoseph wouldn’t have been too fond of. `default.nix`
still has some gnarly stuff in there. So it goes…
2024-11-22 18:03:01 +00:00
Emily
d3d474e85c {gcc7{,Stdenv},gfortran7}: drop
Release branch from 7½ years ago, no update in 5 years, unsupported
upstream, and unused in tree.
2024-11-22 18:03:01 +00:00
Emily
ac283f30a5 gcc: remove GCC < 7 detritus 2024-11-22 18:03:01 +00:00
piegames
ae207af82b treewide: More string indentation fixes
Follow-up on #350296 with the packages that cause big rebuilds and need
to go through staging.
2024-10-23 21:52:18 +02:00
Randy Eckenrode
e50074418d
gcc: set up sysroot for the Darwin SDK
The GCC bootstrap builds each stage with an unwrapped GCC, which needs
to correctly handle looking for libraries and headers in sysroot.
Setting the native header folder to `/usr/include` will actually cause
GCC to search `<sysroot>/usr/include`, which is the SDKROOT in nixpkgs.
2024-10-10 17:04:36 -04:00
Randy Eckenrode
a77d0eb819
gcc: fix extraLDFlags logic after undoing staging-next workaroud
The original logic was prepending to the array, but this one prepends
the array to itself, which breaks the x86_64-linux stdenv bootstrap. The
correct thing to do is build up the arguments in a temporary array and
prepend it like the original code was doing.
2024-10-10 17:04:36 -04:00
Randy Eckenrode
ac31fb7505
gcc: remove staging-next workaround 2024-10-10 01:07:29 -04:00
K900
e3bf09623f Merge remote-tracking branch 'origin/master' into staging-next 2024-10-01 15:09:28 +03:00
Sergei Trofimovich
58e115dc53 gcc11: drop libgcc-aarch64-darwin-detection upstreamed patch
Randy notes that it was already upstream in latest patches and is not
needed anymore:

- 8eef9a10b4/libgcc/config.host (L229-L231)
- https://github.com/iains/gcc-11-branch/blob/gcc-11-5-darwin/libgcc/config/t-darwin-rpath
2024-09-26 22:19:02 +01:00
Sergei Trofimovich
8e9cb69da9 gcc11: update darwin support patch to 11.5.0
https://github.com/NixOS/nixpkgs/pull/328380 updated `gcc11` from
`11.4.0` to `11.5.0` but the darwin patch was not ready then. Let's
update it in hopes that it fixed `darwin` build.
2024-09-26 22:18:22 +01:00
Artturin
f0e657f3b1 Merge branch 'master' into staging-next 2024-09-25 06:05:01 +03:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
K900
5a9d1835e1
glibc: 2.39-52 -> 2.40-36 (#342073) 2024-09-20 19:42:37 +03:00
Maximilian Bosch
35d12c9cfc
gcc: remove "fixed" pthread.h
Fixes

    /nix/store/8pq96x5qsczrmc926795lf7j4dzy2c8q-binutils-patchelfed-ld-2.43.1/bin/ld: ../../src/liblzma/.libs/liblzma.so: undefined reference to `__pthread_cond_timedwait64'
    collect2: error: ld returned 1 exit status

while building `xz` for `stdenv`. The root cause is that glibc replaced
`__USE_TIME_BITS64` with `__USE_TIME64_REDIRECTS`[1]. However, the
stage3 GCC seems to use the bootstrap headers from glibc for
`fixincludes`, i.e. headers w/o this change. Because of that, the xz
build with stage3 stdenv gets a header that looks like this:

    # ifndef __USE_TIME_BITS64
    /* ... */
    # else
    #  ifdef __REDIRECT
    /* ... */
    #  else
    #   define pthread_cond_timedwait __pthread_cond_timedwait64
    #  endif
    # endif

Since __USE_TIME_BITS64 doesn't exist anymore because a new glibc is used
for building, the preprocessor ends up in the condition defining
`__pthread_cond_timedwait64` even though it's not supposed to end up
there since __pthread_cond_timedwait64 doesn't exist on x86_64[2].

I decided to just kill the header here since GCC claims that all the
`pthread.h` only very old glibc versions or platform-specific libcs we
don't use[3].

[1] https://sourceware.org/git/?p=glibc.git%3Ba%3Dcommit%3Bh%3Ddd535f4f19ef2b5c367a362af445ecadcf45401e
[2] https://inbox.sourceware.org/libc-stable/50c0269d-b73c-4e8a-9816-65f72d6082c0@linaro.org/
[3] https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/fixincludes/inclhack.def
2024-09-15 15:36:48 +02:00
Emily
e55bae7882 gcc{7,8}: use gcc9Stdenv for cross‐compilation
No reason to use `gcc7Stdenv` here that I can see.
2024-09-15 02:45:00 +01:00
Emily
de4388c609 {cc-wrapper,gcc}: drop unused logic and patches 2024-09-15 02:45:00 +01:00
Sergei Trofimovich
88950412bc gcc49, gcc49Stdenv, gfortran49: remove old implementation
gcc-4.9.4 was released in Aug 3, 2016, 8 years ago. It's a branch that
went out of support years ago. Numerous bugs never get backported to
this version.

Let's remove it.
2024-09-12 10:32:19 +01:00
Sergei Trofimovich
1db443abb7 gcc48: remove old implementation
gcc-4.8.5 was released in June 23, 2015, 9 years ago. It's a branch that
went out of support years ago. Numerous bugs never get backported to
this version.

Let's remove it.
2024-09-10 22:05:47 +01:00
Peder Bergebakken Sundt
975ba1bed8
Merge pull request #331603 from trofi/gcc14-update
gcc14: 14.1.0 -> 14.2.0
2024-08-19 22:39:43 +02:00
Sergei Trofimovich
3001940a90 gcc14: 14.1.0 -> 14.2.0 2024-08-18 22:29:37 +01:00
github-actions[bot]
261f1edcbd
Merge master into staging-next 2024-08-14 06:01:07 +00:00
kirillrdy
e4839f5ea6
Merge pull request #328380 from trofi/gcc11-update
gcc11: 11.4.0 -> 11.5.0
2024-08-14 12:46:27 +10:00
github-actions[bot]
e80257fbed
Merge master into staging-next 2024-08-07 00:02:22 +00:00
Daniel Nagy
4f85840d25 gcc: provide build support for gccrs
Patches from the gccrs project are being upstreamed into gcc. With
these changes we are now able to build a gcc with rust support like
this:

```nix
wrapCC (gcc14.cc.override {
  langRust = true;
});
```

More info:

https://rust-gcc.github.io/

https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608387.html
2024-08-06 20:26:34 +02:00
Robert Scott
48bde3a189 cc-wrapper: add support for pacret hardening flag on aarch64 2024-07-28 19:27:14 +01:00
Emily
8a837af302
Merge pull request #326819 from risicle/ris-shadowstack
cc-wrapper: add support for `shadowstack` hardening flag
2024-07-28 19:07:52 +01:00
Vladimír Čunát
64c6a981fe
Merge branch 'master' into staging-next 2024-07-27 09:18:58 +02:00
Randy Eckenrode
a3341d6946
gcc12: update aarch64-darwin patch for GCC 12.4 2024-07-22 18:39:20 -04:00
Randy Eckenrode
151776fbfc
gcc10: enable build on aarch64-darwin 2024-07-22 13:34:38 -04:00
Randy Eckenrode
33f416e434
gcc6: add x86_64-darwin to badPlatforms
ld64 crashes when trying to link during the GCC bootstrap.
2024-07-22 12:17:06 -04:00
Randy Eckenrode
621d0e188e
gcc{6,7,8,9}: fix compatibility with Darwin headers
The version of `AvailabilityInternal.h` used in newer SDKs does not work with older versions of GCC that do not support `__has_builtin`. Apply a fixinclude on those versions to allow them to build against the newer version of that header (also used in the source-based SDK after the ld64 update).
2024-07-22 12:17:06 -04:00
Randy Eckenrode
ea889da7e6
gcc: drop rpath from build on platforms that don’t set rpaths
Darwin uses absolute path install names, so setting rpaths is unnecessary. This fixes breakage on older versions of GCC that try to set a deployment target that does not support rpaths.
2024-07-22 12:17:05 -04:00
Sergei Trofimovich
242593b0a0 gcc11: 11.4.0 -> 11.5.0 2024-07-19 09:23:03 +01:00
Randy Eckenrode
f9b7f4ec09
tree-wide: use top-level cctools 2024-07-17 22:36:19 -04:00
Robert Scott
b207b6ef74 cc-wrapper: add support for shadowstack hardening flag 2024-07-14 21:25:47 +01:00
Martin Weinelt
9b79a05ae1
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
- pkgs/development/python-modules/flexcache/default.nix
- pkgs/development/python-modules/flexparser/default.nix
- pkgs/development/python-modules/odp-amsterdam/default.nix
- pkgs/development/python-modules/pint/default.nix
- pkgs/development/python-modules/uncertainties/default.nix
- pkgs/top-level/python-packages.nix
2024-07-01 01:07:21 +02:00
Atemu
dd83e3e407
Merge pull request #316334 from trofi/gcc-libgcc-musl-strip
gcc: provide a $libgcc/$target/lib -> $libgcc/lib symlink
2024-06-30 22:41:10 +02:00
Vladimír Čunát
12df9ba6c3
Merge #321340: gcc12: 12.3.0 -> 12.4.0
...into staging
2024-06-24 09:37:35 +02:00
Sergei Trofimovich
833a9841fe gcc12: 12.3.0 -> 12.4.0 2024-06-20 21:45:43 +01:00
Rick van Schijndel
43ce0f9ee0
Merge pull request #318256 from risicle/ris-stack-clash-protection
cc-wrapper: add stack clash protection hardening flag
2024-06-19 19:54:30 +02:00
Alyssa Ross
0a71bbb64a gcc: fix building with gcc.cpu on some platforms
This fixes, for example, cross compiling to
{ system = "riscv64-linux"; gcc.cpu = "sifive-u74"; }.
2024-06-15 08:03:18 +02:00
Franz Pletz
3db93c351d cc-wrapper: add stack clash protection hardening flag
Most Linux distributions are enabling this these days and it does
protect against real world vulnerabilities as demonstrated by
CVE-2018-16864 and CVE-2018-16865.

Fix #53753.

Information on llvm version support gleaned from
6609892a2d
68e07da3e5
092507a730

Information on gcc version support a lot harder to gather,
but both 32bit and 64bit arm do appear to be supported
based on the test suite.
2024-06-07 20:23:46 +01:00
Sergei Trofimovich
c682f2b491 gcc: provide a $libgcc/$target/lib -> $libgcc/lib symlink
The primary reason for the layout change is for `gcc.libgcc` to match
closer `gcc.lib` layout. That way we allow `$STRIP_FOR_TARGET` to strip
`libgcc_s.so.1` file moved to $libgcc output. Otherwise `$STRIP` (for
host) fails to do it and leaves debug strings like references to headers
in it and bloats HOST closure with BUILD inputs.

The change shrinks `aarch64-multiplatform-musl.coreutils` closure from
50MB down to 10MB:

Before:

    $ nix path-info -rsSh $(nix-build -A pkgs.pkgsCross.aarch64-multiplatform-musl.coreutils) |& unnix
    /<<NIX>>/xgcc-13.2.0-libgcc                              155.8K  155.8K
    /<<NIX>>/musl-aarch64-unknown-linux-musl-1.2.3             3.8M    3.8M
    /<<NIX>>/libunistring-1.1                                  1.7M    1.7M
    /<<NIX>>/libidn2-2.3.7                                   352.7K    2.1M
    /<<NIX>>/glibc-2.39-52                                    28.7M   31.0M
    /<<NIX>>/bash-5.2p26                                       1.5M   32.5M
    /<<NIX>>/musl-aarch64-unknown-linux-musl-1.2.3-bin        69.4K    3.8M
    /<<NIX>>/linux-headers-6.7                                 6.2M    6.2M
    /<<NIX>>/musl-aarch64-unknown-linux-musl-1.2.3-dev       550.2K   43.1M
    /<<NIX>>/aarch64-unknown-linux-musl-gcc-13.2.0-libgcc    579.7K   43.6M
    /<<NIX>>/aarch64-unknown-linux-musl-gcc-13.2.0-lib         3.8M   47.4M
    /<<NIX>>/gmp-with-cxx-aarch64-unknown-linux-musl-6.3.0   653.4K   48.1M
    /<<NIX>>/attr-aarch64-unknown-linux-musl-2.5.2            73.8K    3.8M
    /<<NIX>>/acl-aarch64-unknown-linux-musl-2.3.2            156.4K    4.0M
    /<<NIX>>/coreutils-aarch64-unknown-linux-musl-9.5          1.6M   49.9M

After:

    $ nix path-info -rsSh $(nix-build -A pkgs.pkgsCross.aarch64-multiplatform-musl.coreutils) |& unnix
    /<<NIX>>/musl-aarch64-unknown-linux-musl-1.2.3             3.8M    3.8M
    /<<NIX>>/aarch64-unknown-linux-musl-gcc-13.2.0-libgcc    147.9K  147.9K
    /<<NIX>>/aarch64-unknown-linux-musl-gcc-13.2.0-lib         3.8M    7.7M
    /<<NIX>>/gmp-with-cxx-aarch64-unknown-linux-musl-6.3.0   653.4K    8.4M
    /<<NIX>>/attr-aarch64-unknown-linux-musl-2.5.2            73.8K    3.8M
    /<<NIX>>/acl-aarch64-unknown-linux-musl-2.3.2            156.4K    4.0M
    /<<NIX>>/coreutils-aarch64-unknown-linux-musl-9.5          1.6M   10.1M
2024-06-01 05:59:59 +01:00
Vladimír Čunát
5d44b1a800
Merge #313489: gcc13: 13.2.0 -> 13.3.0
...into staging
2024-05-30 11:13:42 +02:00
Sergei Trofimovich
ce5cc26328 gcc13: 13.2.0 -> 13.3.0
Changes: https://gcc.gnu.org/gcc-13/changes.html
2024-05-30 09:52:02 +01:00
Weijia Wang
fbe324ceae
Merge pull request #305387 from wegank/mcfgthread-12-drop
windows.mcfgthreads_pre_gcc_13: drop
2024-05-22 20:05:33 +02:00
Weijia Wang
10a5379763 gnat14: fix build on x86_64-darwin 2024-05-21 17:52:45 +02:00
Randy Eckenrode
44e55797be gcc14: add x86_64-darwin support 2024-05-21 12:08:26 +02:00