Commit Graph

1026 Commits

Author SHA1 Message Date
github-actions[bot]
d49b3ff9e3
Merge staging-next into staging 2023-11-08 12:02:19 +00:00
github-actions[bot]
263a89fa08
Merge master into staging-next 2023-11-08 12:01:20 +00:00
Adam Joseph
a738046341 Update pkgs/development/compilers/gcc/patches/default.nix 2023-11-08 10:50:07 +00:00
Randy Eckenrode
299c06a0f5 gcc{48,49,6,7,8,9,10}: improve cctools-llvm compatibility
darwin.cctools defaults to `llvm-strip` when the version of LLVM in the
stdenv is 12 or newer. This strip implementation does not support the
`-c` flag required by older versions of GCC. Use the cctools-port
version for compatibility when building older versions of GCC.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
bec14225ab gcc{48,49,6,7,8,9,10}: fix missing symbol errors on x86_64-darwin
The x86_64-darwin build fails with the following symbol errors when
building gencondmd:

    Undefined symbols for architecture x86_64:
      "_ix86_excess_precision", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_fpmath", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_isa_flags", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_unsafe_math_optimizations", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_target_flags", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o

This commit applies a workaround posted to the GCC BugZilla.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92061.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
93153208cc gcc{8,9}: don’t pass --gstabs to clang assembler
Darwin uses the clang integrated assembler, which does not support
`--gstabs`. While the `configure` script detects whether the assembler
supports it, Darwin passes `--gstabs` unconditionally. This patch is
backported to make the bootstrap only use it when supported.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
d4f8aac2c5 gcc{48,49,6}: don’t use -pipe with clang assembler
Older versions of GCC use `-pipe` on Darwin due to compatibility
problems with older cctools assemblers. Darwin now uses the clang
integrated assembler. While it is possible to pipe input into it, the
wrapper used in nixpkgs is not set up for it.

Fixing the wrapper would cause all of Darwin to rebuild, which is not
desirable, so just disable `-pipe` in the bootstrap configuration. The
clang integrated assembler doesn’t have the bug anyway.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
e06f05d23c gcc11: fix build on aarch64-darwin
The libgcc configure script was middetecting aarch64-darwin and trying
to use a deployment target of 10.5, which is not valid for that
platform. The build was failing because the linker was looking for stubs
that don’t exist (neither as part of the source releases nor as part of
the official SDK from Apple).

Backporting the `config.host` check and `t-darwin-rpath` from GCC 12
allows GCC 11 to build again on aarch64-darwin.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
b09f87fb0d gcc48: disable on x86_64-darwin
According to Hydra, the last time GCC 4.8 successfully built on Darwin
was October 2014. It is possible to make the first stage build
successfully with clang, but the resulting GCC is not capable of reading
the Darwin SDK headers due to their use of `__can_include`.

It’s been broken for almost a decade, so just disable it.
2023-11-08 07:32:47 +00:00
github-actions[bot]
599850da55
Merge staging-next into staging 2023-11-07 12:01:25 +00:00
github-actions[bot]
bed56440cb
Merge master into staging-next 2023-11-07 12:00:57 +00:00
Adam Joseph
b9c6f5b754 gcc: move version iteration out of all-packages.nix
This resolves a TODO previously in all-packages.nix.
2023-11-07 09:57:54 +00:00
Adam Joseph
78706a9184 gcc: move version information to gcc/versions.nix 2023-11-07 09:57:54 +00:00
github-actions[bot]
b90e2fc451
Merge staging-next into staging 2023-11-04 06:01:49 +00:00
github-actions[bot]
10d3ba75f0
Merge master into staging-next 2023-11-04 06:01:18 +00:00
Adam Joseph
36f5b2e42b gcc.libgcc: compare host and target platforms, rathern than their triples
The rest of our gcc expression prepends "${targetPlatform.config}-"
to paths and binaries if `hostPlatform!=targetPlatform`.  The
`libgcc.nix` expression was using
'hostPlatform.config!=targetPlatform.config`, which caused it to
look in the wrong place when moving files.  This commit corrects that.
2023-11-04 05:58:23 +00:00
Artturi
4693035911
Merge pull request #240596 from amjoseph-nixpkgs/pr/gcc/stage-rename 2023-10-27 17:13:59 +03:00
Adam Joseph
1904125877 gcc: change "-stage-static" to "-nolibc" and "-stage-final" to ""
This commit changes the target suffix for the first-stage cross
compiler from `-stage-static` to `-nolibc`, and eliminates the
target suffix from the final-stage cross compiler (previously
`-stage-final`).

Co-authored-by: Artturi <Artturin@artturin.com>
Co-authored-by: John Ericson <git@JohnEricson.me>
2023-10-26 20:07:18 -07:00
Vladimír Čunát
d811555465
Merge branch 'staging' into staging-next 2023-10-26 10:36:50 +02:00
Adam Joseph
425cac96bf gcc: create dummy crtstuff on S390 as well
This commit replicates the fix in
https://github.com/NixOS/nixpkgs/pull/258032 for S390 as well.

Co-authored-by: Artturi <Artturin@artturin.com>
2023-10-25 08:36:22 +00:00
github-actions[bot]
4312247c19
Merge staging-next into staging 2023-10-22 12:01:52 +00:00
Weijia Wang
0a8e3e0748 gcc: create dummy crtstuff on loongarch64 2023-10-22 09:48:16 +00:00
github-actions[bot]
aca616eec2
Merge staging-next into staging 2023-10-11 12:01:48 +00:00
github-actions[bot]
0e9411554d
Merge master into staging-next 2023-10-11 12:01:09 +00:00
Alyssa Ross
69b9532a74
gcc: always inhibit libc in cross with same configs
It's not just gcc->clang cross compilation that produces different
platforms with equal configs — dynamic->static cross compilation can
have the same result (e.g. pkgsMusl.pkgsStatic).  So, remove the check
for LLVM, but keep the check that the configs match.

This fixes pkgsMusl.nix on x86_64-linux, which depends on
pkgsMusl.pkgsStatic.buildPackages.gccWithoutTargetLibc.cc.

Fixes: 926c920c12 ("gcc: tighten condition for inhibit_libc=true")
2023-10-10 10:58:44 +00:00
github-actions[bot]
81871f4c87
Merge staging-next into staging 2023-10-08 12:01:52 +00:00
Fabián Heredia Montiel
7f16b623fc Merge remote-tracking branch 'origin/master' into staging-next 2023-10-08 00:18:22 -06:00
Artturi
b64b1ed759
Merge pull request #255192 from trofi/cc-wrapper-no-__FILE_-refs 2023-10-08 04:30:09 +03:00
Artturin
fa54cb146a gcc: add fallback to condition
```
> pkgsMusl.nix
error: attribute 'useLLVM' missing

$ nix eval -f . pkgsMusl.pkgsStatic.stdenv.targetPlatform.useLLVM
error: attribute 'useLLVM' in selection path 'pkgsMusl.pkgsStatic.stdenv.targetPlatform.useLLVM' not found
```
2023-10-07 18:26:49 +03:00
Alyssa Ross
a838aa244f
Merge remote-tracking branch 'origin/master' into staging-next
The hash for pytensor is not correct, but that's also the case in
master, so a merge commit isn't the place to fix it.

Conflicts:
	pkgs/development/python-modules/faadelays/default.nix
	pkgs/development/python-modules/pytensor/default.nix
	pkgs/tools/admin/rset/default.nix
2023-10-05 08:02:48 +00:00
Artturi
c748544b2f
Merge pull request #241206 from amjoseph-nixpkgs/tighten-inhibit_libc-condition 2023-10-05 04:43:53 +03:00
Sergei Trofimovich
537176760c gcc12, gcc13: always mangle __FILE__ into invalid store path
Without the change `__FILE__` used in static inline functions in headers
embed paths to header files into executable images. For local headers
it's not a problem, but for headers in `/nix/store` this causes `-dev`
inputs to be retained in runtime closure.

Typical examples are `nix` -> `nlonhmann_json` and `pipewire` ->
`lttng-ust.dev`.

Ideally we would like to use `-fmacro-prefix-map=` feature of `gcc` as:

  -fmacro-prefix-map=/nix/store/$hash1-nlohmann-json-ver=/nix/store/eeee.eee-nlohmann-json-ver
  -fmacro-prefix-map=/nix/...

In practice it quickly exhausts argument lengtth limit due to `gcc`
deficiency: https://gcc.gnu.org/PR111527

Until it;s fixed let's hardcode header mangling if $NIX_STORE variable
is present in the environment.

Tested as:

    $ printf "# 0 \"/nix/store/01234567890123456789012345678901-pppppp-vvvvvvv\" \nconst char * f(void) { return __FILE__; }" | NIX_STORE=/nix/store ./gcc/xgcc -Bgcc -x c - -S -o -
    ...
    .string "/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-pppppp-vvvvvvv"
    ...

Mangled successfully.
2023-10-04 21:16:13 +01:00
github-actions[bot]
ab895db907
Merge staging-next into staging 2023-09-22 00:02:40 +00:00
Adam Joseph
ea61be413c gcc: set GFORTRAN_FOR_TARGET on cross-built native compilers
For a cross-built native compiler, i.e. build!=(host==target), the
bundled libgfortran needs a gfortran which can run on the
buildPlatform and emit code for the targetPlatform.  The compiler
which is built alongside gfortran in this configuration doesn't meet
that need: it runs on the hostPlatform.

This commit passes the necessary compiler via `GFORTRAN_FOR_TARGET`,
using `pkgsBuildTarget.gfortran`.
2023-09-21 09:24:56 +03:00
Artturi
2e705d027f
Merge pull request #250498 from amjoseph-nixpkgs/gcc/deduplicate/simplify2 2023-09-19 07:47:50 +03:00
github-actions[bot]
b4fdbf27f2
Merge master into staging-next 2023-09-09 06:01:15 +00:00
John Ericson
e829eca886
Merge pull request #253939 from angerman/angerman/ucrt64
Add ucrt64 mingw toolchain.
2023-09-08 22:40:14 -04:00
github-actions[bot]
a376e04925
Merge master into staging-next 2023-09-09 00:02:10 +00:00
Adam Joseph
aafab3b5b6 gcc: for cross compilers, don't build libgcc twice
Cross-compiled binaries currently end up with two different libgcc
outpaths in their closure.  This is harmless, but confusing.

The two libgccs are:

- One of them is the "first" targetPlatform libgcc, which is built
  by the "first" cross-compiler.  This "first libgcc" and "first
  compiler" are used to build the targetPlatform glibc.

- Once glibc is built, we *rebuild* the cross-compiler, since gcc
  can't enable most of its features unless you give it an
  already-compiled targetPlatform glibc.  When this "second"
  compiler is built, it also builds an extra copy of libgcc.

This commit discards the second, extra libgcc, and instead puts a
reference to the first (correct) libgcc into the "second compiler"
`.passthru.libgcc`, so that anybody expecting `stdenv.cc.cc.libgcc`
to exist will still find it there.

Closes #249680
2023-09-08 16:07:50 +03:00
Moritz Angermann
a81e3dcd75 treewide: replace libc == "msvcrt" with isMinGW
msvcrt is only one of the libcs in MinGW. We therefore
replace explictly testing for msvcrt with the isMinGW
predicate. This lays the foundation for ucrt64 support.
2023-09-08 10:56:08 +00:00
Artturi
161bf63234
Merge pull request #250496 from amjoseph-nixpkgs/simplify 2023-09-06 02:44:34 +03:00
Artturin
5c63f69ed2 gcc.patches: For gcc49 apply libsanitizer-no-cyclades-9 patch later
otherwise there is a conflict
2023-09-02 21:49:08 +03:00
Artturin
3d4e0708a0 gcc: move dll.a in lib64 to lib output too
same as c304c1e7d0
2023-08-29 01:04:15 +03:00
marius david
2eeb227d77 gcc: move dll to output 2023-08-27 21:40:34 +03:00
Adam Joseph
af319af225 gcc: unescapify backslash 2023-08-23 21:47:12 -07:00
Adam Joseph
80198b835b gcc: remove backticks-used-as-quotes (error prone) 2023-08-23 21:47:12 -07:00
Adam Joseph
040cf4248d gcc: simplify expression by applying workarounds more broadly
This commit simplifies our gcc expression by applying various
workarounds unconditionally, rather than only to exactly the
versions which applied them prior to the deduplication cleanup.

Unlike its predecessors https://github.com/NixOS/nixpkgs/pull/249707
and https://github.com/NixOS/nixpkgs/pull/250489 this commit *does*
affect eval.
2023-08-23 21:47:12 -07:00
Adam Joseph
6c8b8bc2f1 gcc: limit gcc12 isMips --disable-libsanitizer to abi=="gnu" 2023-08-23 14:32:50 -07:00
Sergei Trofimovich
a62c92ab9b gcc12: disable libsanitizer for mips64
Without the change build on mips64-unknown-linux-gnu fails as:

        $ nix-build -A buildPackages.gcc12 --argstr crossSystem mips64-linux

        In file included from ...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/bits/stat.h:25,
                         from ...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/fcntl.h:78,
                         from ../../../../gcc-12.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:55:
        ...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/bits/struct_stat.h:190:8: error: redefinition of 'struct stat64'
          190 | struct stat64
              |        ^~~~~~
2023-08-23 14:30:54 -07:00
Adam Joseph
62c676ce6f gcc: patches: reorganize and simplify
This PR sorts the huge pile of patches and deduplicates it.  Unlike
its predecessors https://github.com/NixOS/nixpkgs/pull/249707 and
https://github.com/NixOS/nixpkgs/pull/250489 this commit *does*
affect eval.

Patches below are organized into three general categories:

1. Patches relevant to gcc>=12 on every platform
2. Patches relevant to gcc>=12 on specific platforms
3. Patches relevant only to gcc<12, sorted by the newest version to
   which they might be relevant
2023-08-21 02:18:57 -07:00