Commit Graph

1051 Commits

Author SHA1 Message Date
Robert Scott
40868719b0 cc-wrapper: add zerocallusedregs hardening flag
this uses the value `used-gpr` which seems to be a commonly
chosen value for general use
2024-01-20 13:48:33 +00:00
K900
967d49b8a8 Merge remote-tracking branch 'origin/staging-next' into staging 2024-01-18 19:15:32 +03:00
Uri Baghin
1cf2d7357c gcc: fix c++ headers when same triplet cross compiling
When build platform and host platform differ, but have the same
triple, the code in nixpkgs will consider it a cross compilation,
but gcc won't. This will lead some derivations to look for c++
headers in the wrong place. To solve this always output the headers
in the non-cross location, like we do for the other gcc headers
already.
2024-01-18 09:01:04 +00:00
Sergei Trofimovich
d0fe73a2d5 gcc: extend crtn workaround to alpha target
Without the change `alpha-unknown-linux-gnu` target is failing to build
`gcc`:

```
$ NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix build -f ./. re2c --arg crossSystem '{ config = "alpha-unknown-linux-gnu"; }'
...
make[1]: *** No rule to make target '../../../gcc-12.3.0/libgcc/config/alpha/crti.S', needed by 'crti.o'.  Stop.
...
cc1: error: fp software completion requires '-mtrap-precision=i' [-Werror]
```

After the change it is able to produce working binaries:

```
$ NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix build -f ./. re2c --arg crossSystem '{ config = "alpha-unknown-linux-gnu"; }'
...
$ qemu-alpha ./result/bin/re2c --version
re2c 3.1

$ file result/bin/re2c
result/bin/re2c: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), dynamically linked, interpreter ...-glibc-alpha-unknown-linux-gnu-2.38-27/lib/ld-linux.so.2, for GNU/Linux 3.10.0, not stripped
```
2024-01-18 08:30:39 +00:00
Weijia Wang
b384f04673 gcc13: add patch for PR110280 2024-01-12 20:54:25 +01:00
Guillaume Girol
ae17622fa3
Merge pull request #279455 from symphorien/dont-mangle-debuginfo
Draft: gcc: prevent runtime references via __FILE__ but in a reversible manner
2024-01-08 21:06:38 +01:00
Guillaume Girol
9cb3614007 gcc: prevent runtime references via __FILE__ but in a reversible manner
the mangling done by mangle-NIX_STORE-in-__FILE__.patch also applies to
source paths embedded in debug symbols. When putting a breakpoint in a
template instanciation from another lib, the path that gdb looks for is
therefore mangled (/nix/store/eeeeeee;...-the-lib-dev/include/foo.h)
This severely degrades the debugging experience. To alleviate that, it's
possible to make the mangling reversible: a debuginfod server can then
reverse the mangling. I plan to implement that in nixseparatedebuginfod.
The reversible mangling that was chosen in making the hash of the store
path uppercase.
2024-01-07 12:00:00 +00:00
Robert Scott
1a5bd697ad mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper
this makes it a lot easier to create a modified stdenv with a
different set of defaultHardeningFlags and as a bonus allows us
to inject the correct defaultHardeningFlags into toolchain wrapper
scripts, reducing repetition.

while most hardening flags are arguably more of a compiler thing,
it works better to put them in bintools-wrapper because cc-wrapper
can easily refer to bintools but not vice-versa.

mkDerivation can still easily refer to either when it is constructed.

this also switches fortran-hook.sh to use the same defaults for
NIX_HARDENING_ENABLE as for C. previously NIX_HARDENING_ENABLE
defaults were apparently used to avoid passing problematic flags
to a fortran compiler, but this falls apart as soon as mkDerivation
sets its own NIX_HARDENING_ENABLE - cc.hardeningUnsupportedFlags
is a more appropriate mechanism for this as it actively filters
out flags from being used by the wrapper, so switch to using that
instead.

this is still an imperfect mechanism because it doesn't handle a
compiler which has both langFortran *and* langC very well - applying
the superset of the two's hardeningUnsupportedFlags to either
compiler's invocation. however this is nothing new - cc-wrapper
already poorly handles a langFortran+langC compiler, applying two
setup hooks that have contradictory options.
2023-12-09 16:30:45 +00:00
Dmitry Kalinkin
025a278148 Merge remote-tracking branch 'origin/master' into staging
Conflicts:
	pkgs/tools/networking/ofono/default.nix
2023-12-08 12:27:28 -05:00
github-actions[bot]
367355c966
Merge master into staging-next 2023-12-08 12:01:36 +00:00
Rick van Schijndel
87e5690bba
Merge pull request #271919 from emilytrau/avr-gcc8-aarch64-darwin
gcc8: support avr cross compilation on aarch64-darwin, qmk aarch64-darwin support pt. 1
2023-12-08 07:26:37 +01:00
github-actions[bot]
035a649a67
Merge master into staging-next 2023-12-06 06:01:30 +00:00
Rick van Schijndel
ba75066821
Merge pull request #271362 from pbsds/rm-dead-patches
treewide: remove unreferenced patch files
2023-12-06 03:28:15 +01:00
Fabián Heredia Montiel
5b8deaceca Merge remote-tracking branch 'origin/master' into staging-next
Fixed conflict in pkgs/applications/graphics/krita/

krita: 5.1.5 -> 5.2.0
7a40fdc288
, and
treewide: use kde mirror everywhere, don't use pname in download urls
aa15f5066d
2023-12-04 17:44:17 -06:00
Emily Trau
f6e48acfa2 gcc8: support avr cross compilation on aarch64-darwin 2023-12-04 06:32:32 +11:00
Randy Eckenrode
f2a7764cab
gcc{6,7,8,9,10,11}: fix cross-compiler build on x86_64-darwin
Building a cross-compiler fails due to register storage class specifier
errors when building with clang 16 due to its defaulting to C++17.
Downgrading the error allows the older cross-compilers to build.
2023-12-02 18:43:00 -05:00
Randy Eckenrode
4a538d6b3d
gcc11: mark as bad on aarch64-darwin when building a cross-compiler 2023-12-02 18:42:00 -05:00
Randy Eckenrode
fe27958aed
gcc{6,7,8,9}: use target bintools on Darwin
Using the host bintools results in evaluation errors when building an
AVR cross-compiler due to trying to build cctools for AVR.
2023-12-02 18:32:15 -05:00
Randy Eckenrode
db20831951
gcc11: drop AVR patch on Darwin (no longer needed) 2023-12-02 18:30:46 -05:00
github-actions[bot]
5d5c0a00c7
Merge master into staging-next 2023-12-02 00:02:19 +00:00
Adam Joseph
62dbf14a30 gcc: put environment variables in drvAttrs.env 2023-12-01 22:03:09 +00:00
Vladimír Čunát
305cd929fd
Merge branch 'staging' into staging-next 2023-12-01 07:33:49 +01:00
Peder Bergebakken Sundt
f41aba3739 treewide: remove unreferenced patch files
Found with `fd \\.patch$ pkgs/ -x bash -c 'rg -F "{/}" pkgs/ -q || echo {}'`
2023-12-01 06:11:20 +01:00
Sergei Trofimovich
68aaaec7d2 gcc12, gcc13: fix typos in comments around __FILE__ patch
Noticed by Robert Schütz.
2023-11-30 10:24:57 +00:00
Randy Eckenrode
34da65ba2a gcc6: don’t link libstdc++ to CoreFoundation
Using flat namespaces causes libstdc++ to link CoreFoundation, but
that fails after #265102. Since CoreFoundation is not actually needed,
disable flat namespaces to avoid linking it unnecessarily.

Disabling flat namespaces matches the behavior of newer versions of
libstdc++ (GCC 7+) when building for newer Darwin hosts (10.5+).
2023-11-30 08:53:50 +00:00
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