Commit Graph

1104 Commits

Author SHA1 Message Date
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
Weijia Wang
d851de2647 gcc14: add aarch64-darwin support 2024-05-21 12:08:26 +02:00
Sergei Trofimovich
75104490c0 gcc14, gfortran14, gnat14, gccgo14: init at 14.1.0
Changes: https://gcc.gnu.org/gcc-14/changes.html
2024-05-21 12:08:26 +02:00
Randy Eckenrode
dbe34b193d
gnat{11,12,13}: fix build on x86_64-darwin
- gnat11: make sure to use the gnat-bootstrap gcc in the stdenv; and
- Drop the dual assemblers. x86_64-darwin uses the clang assembler by
  default, so it no longer needs the workaround for the GNU assembler.
2024-05-09 17:35:07 -04:00
Weijia Wang
58b98e9a25 windows.mcfgthreads_pre_gcc_13: drop 2024-04-28 04:43:28 +02:00
github-actions[bot]
c3b3326391
Merge staging-next into staging 2024-04-06 00:02:50 +00:00
Weijia Wang
d3985f53bb gnat13: fix build on x86_64-darwin 2024-04-02 10:12:47 +02:00
Philip Taron
64f4bdb7e1 Avoid top-level with ...; in pkgs/development/compilers/gcc/default.nix
I didn't fix the whitespace and indenting, but I really wanted to.

The global `with` was masking that `fetchFromGitHub` wasn't injected!
2024-03-28 03:04:49 +01:00
Philip Taron
8616de2279 Avoid top-level with ...; in pkgs/development/compilers/gcc/common/meta.nix 2024-03-28 03:04:49 +01:00
Adam Joseph
b81284ec71 gcc: link $lib/lib -> $lib/$targetConfig correctly and consistently
When native-compiling, gcc will install libraries into:

  /nix/store/...-$targetConfig-gcc-$version-lib/lib

When cross-compiling, gcc will install libraries into:

  /nix/store/...-$targetConfig-gcc-$version-lib/$targetConfig

When cross-compiling, we intended to create a link from $lib/lib to
$lib/$targetConfig, so that downstream users can always safely
assume that "${lib.getLib stdenv.cc.cc}/lib" is where the gcc
libraries are, regardless of whether `stdenv.cc.cc` is a cross
compiler or a native compiler.

Unfortunately, there were two problems with how we were trying to
create these links:

1. The link would be created only when `enableLibGccOutput==true`

2. The link was being created from the incorrect source
   `$lib/lib/lib` instead of `$lib/lib`.

Both of these mistakes are my fault.  This commit corrects them by
creating the link using `ln -Ts` (which is more predictable) and by
creating the link from `gcc/common/builder.nix` rather than from
`gcc/common/libgcc.nix`.
2024-03-15 18:18:24 +00:00