Commit Graph

1073 Commits

Author SHA1 Message Date
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
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
Robert Scott
4a91b3e798 cc-wrapper: add trivialautovarinit hardening flag support
this equates to -ftrivial-auto-var-init=pattern

clang has removed support for -ftrivial-auto-var-init=zero and
are unlikely to re-add it, so use -ftrivial-auto-var-init=pattern
on both compilers if only to make behaviour more consistent
between the two.

add to pkgsExtraHardening's defaultHardeningFlags.
2024-02-24 12:00:09 +00:00
Mario Rodas
c7cd3aa49c
Merge pull request #285662 from trofi/gcc-amend-__FILE__-just-for-macro-prefix
gcc: amend __FILE__ mangling patch to only affect `-fmacro-prefix-map=`
2024-02-18 20:57:42 -05:00
Sergei Trofimovich
be41f86a80 gcc: amend __FILE__ mangling patch to only affect -fmacro-prefix-map=
THe initial intent of the change was to only affect
`-fmacro-prefix-map=` option.

Due to the bug of `if (maps == macro_prefix_maps)` condition of initial
setting all three of:

    static file_prefix_map *macro_prefix_maps; /* -fmacro-prefix-map  */
    static file_prefix_map *debug_prefix_maps; /* -fdebug-prefix-map  */
    static file_prefix_map *profile_prefix_maps; /* -fprofile-prefix-map  */

matches the comparison and applied the mangling (as long as on options
were passed into those before).

As a result not only (intended) `__FILE__` embedding happened in `.data`
section, but also (unintended) debugging symbols (`-fdebug-prefix-map`)
and profiling data (`-fprofile-prefix-map`) were broken by mangling.

The patch update fixes it by explicitly passing a boolean that controls
the mangling in a single call site relevant to `-fmacro-prefix-map`.

While at it fixed `int / size_t` mismatch that caused build failure on
upcoming `gcc-14`.

Tested as:

- `nix` still has no `nlohmann_json` retention
- `gdb` can now resolve `stdc++` debugging symbols in templates
- `--coverage` has working source file paths
2024-02-02 20:59:41 +00:00
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