Commit graph

990 commits

Author SHA1 Message Date
Adam Joseph 86a0e46ed4 gcc: fix implication order in assertion
In 6812dd98c4 I mistakenly had the
implication order reversed.  This commit corrects that mistake.

The original assertion (which is correct) was the following, which
asserts that if you enable the GDB plugin, you must enable plugins
generally (there is shared infrastructure):

```
assert enableGdbPlugin -> enablePlugin;
```

When the option name was changed to `disableGdbPlugin`, I
incorrectly wrote:

```
assert disableGdbPlugin -> enablePlugin;
```

And then again incorrectly wrote:

```
assert disableGdbPlugin -> !enablePlugin;
```

This commit uses the correct equivalent for the first statement,
which is the contrapositive:

```
assert !enablePlugin -> disableGdbPlugin;
```
2023-02-23 22:54:49 -08:00
github-actions[bot] 3cdd771820
Merge staging-next into staging 2023-02-23 18:01:49 +00:00
Adam Joseph 24b07fc9e5 gcc/common: add disableGdbPlugin option
This commit adds an option `disableGdbPlugin` which controls whether
or not the plugin *for* GDB will be built.  This plugin contains a
copy of `gcc`.

The configure flag that this option controls is called
`--disable-libcc1`.  This flag name is slightly confusing: it is
used only by GDB (and apparently unmaintained), yet the flag name
does not mention GDB.  This is why the option name is different from
the configure flag name.

The primary motivation for this commit is to allow the following PR
(which is not yet merged) to pass `--disable-libcc1` when building
the final native (build=host=target) compiler as part of the stdenv
bootstrap:

  https://github.com/NixOS/nixpkgs/pull/209870

We need to `--disable-libcc1` in this scenario because gcc's build
machinery links `libcc1` against the `libstdc++` that is part of the
*compiler used to compile gcc*, rather than against the `libstdc++`
that is built *by* gcc.  In an FHS distribution this distinction is
not terribly important because dynamically linked libraries are
late-bound (ld.so resolution).  However in nixpkgs this causes a
reference back to the bootstrapFiles to leak all the way through to
the final stdenv.

More details can be found in the comment in
`pkgs/stdenv/linux/default.nix` of the PR linked above.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-02-22 19:30:34 -08:00
Artturin f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
github-actions[bot] 8c0220980d
Merge staging-next into staging 2023-02-19 00:03:03 +00:00
Yureka 3a2b7bd7d7 gcc: add missing libucontext buildInput for pkgsMusl.gccgo12 2023-02-18 23:51:32 +01:00
Sergei Trofimovich 2ea3482502
Merge pull request #216136 from amjoseph-nixpkgs/pr/gcc/enableBootstrap
gcc: expose --disable-bootstrap as disableBootstrap
2023-02-18 08:51:38 +00:00
Robert Scott 0eedcfc3f4
Merge pull request #212498 from risicle/ris-fortify3
hardening flags: add `FORTIFY_SOURCE=3` support
2023-02-16 21:19:30 +00:00
Adam Joseph 37fe1613cf gcc: expose --disable-bootstrap as disableBootstrap 2023-02-15 23:32:19 -08:00
Felix Buehler cdb39a86e0 treewide: use optionalString 2023-02-13 21:52:34 +01:00
Vladimír Čunát a6767ed934
Merge #212363: gcc11: apply upstream patch
...into staging-next
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103910
2023-02-13 13:36:01 +01:00
github-actions[bot] 87f957b5e2
Merge master into staging-next 2023-02-12 16:02:45 +00:00
Adam Joseph b83f032ffc gcc/11: apply upstream fix 103910 so openjdk builds
Our openjdk derivations fail to build with `-march=opteron` (via
either `NIX_CFLAGS_COMPILE` or `hostPlatform.gcc.arch`).  This was
fixed upstream in gcc12 but not carried back to gcc11:

  https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d243f4009d8071b734df16cd70f4c5d09a373769

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103910

Since gcc11 is still nixpkgs' primary compiler, this PR cherry-picks
the fix out of gcc12.

Unfortunately since `-march=` can be added after the `gcc11`
derivation is built we can't apply this patch conditionally (which
we don't usually do anyways).
2023-02-12 07:40:05 -08:00
Artturin 6986717510 gcc: add common/meta.nix
inherit has to be used otherwise makeOverridable attributes are added
2023-02-12 05:44:34 +02:00
Artturin e277984d0b gcc: add callFile to make it more convenient to call files
inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gccX.cc.override)" | jq '.[]' --raw-output'
2023-02-11 21:17:30 +02:00
github-actions[bot] c76e040c19
Merge master into staging-next 2023-02-09 12:01:30 +00:00
Artturin 951c2fb2dd gcc10,gcc11,gcc12: move dependencies to common/dependencies.nix 2023-02-08 04:07:48 +02:00
Artturin c4269cd7bf gcc7,gcc8: move dependencies to common/dependencies.nix 2023-02-08 04:07:48 +02:00
Artturin 18f9f26a79 gcc6: move dependencies to common/dependencies.nix
the (vc4 redox) flex conditional was missing in all other gcc version
because gcc6 was the default at the time it was added

that is one of the problems common/dependencies.nix fixes
2023-02-08 04:06:21 +02:00
Artturin 5564beebfe gcc: add common/dependencies.nix
there is a duplication issue in the gcc's so this will help with that

gcc49,gcc48: move dependencies to common/dependencies.nix
2023-02-08 04:03:55 +02:00
Vladimír Čunát 9e2af38827
Merge branch 'staging' into staging-next 2023-02-01 17:05:25 +01:00
Sergei Trofimovich b8b5fc1463 gcc: revert "provide both native and cross forms of gcc.libs libraries"
This reverts commit 2c931bd5f4.

The https://github.com/NixOS/nixpkgs/pull/209153 reverted --sysroot=/
change as it broke other astects of library search paths.

While it might still be useful to pull in gcc libraries when
non-standard --sysroot= is passed there are no meaningful use cases of
it in `nixpkgs` yet. Let's revert it for now.
2023-02-01 07:42:11 +00:00
Sergei Trofimovich 8212ae0455
Merge pull request #213909 from amjoseph-nixpkgs/pr/gcc/comment
gcc/common/configure-flags.nix: fix comment
2023-02-01 07:30:32 +00:00
Adam Joseph b02da45b3c gcc/common/configure-flags.nix: fix comment
On a native (host==build==target) build, `${with_build_sysroot}` can
be omitted.  In that case, the line modified by this commit is
correct.

However, if `--with-build-sysroot=` is passed to `./configure`, then
`${with_build_sysroot}` will be used, similar to the cross case, and
the headers will be taken from:

  ${with_build_sysroot}${native_system_header_dir}

See:

  https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=62bc908b991ff0b700225aef32743cd3d7c4daaf;hb=HEAD#l2439

This commit adjusts the comment to account for the case where
`--with-build-sysroot` is passed to a native compiler.
2023-01-31 21:40:48 -08:00
Robert Scott c09e1fa406 gcc: mark hardeningUnsupportedFlags fortify3 for all but gcc 12 2023-01-24 21:52:12 +00:00
github-actions[bot] cd6a5f6c46
Merge staging-next into staging 2023-01-24 00:02:42 +00:00
github-actions[bot] 727e365f02
Merge master into staging-next 2023-01-24 00:02:11 +00:00
Sandro 2696d7e4a6
Merge pull request #208657 from tpwrules/darwin-fix-avr 2023-01-23 23:48:21 +01:00
John Ericson 791c80ae74
Merge pull request #212271 from alyssais/gcc-uclibc-libgomp
gcc: don't disable libgomp for uclibc targets
2023-01-23 16:59:17 -05:00
John Ericson 8240bc77e8
Merge pull request #212275 from alyssais/libdl
treewide: remove -ldl linker flags
2023-01-23 16:28:21 -05:00
Alyssa Ross 12d2821bf5
treewide: remove -ldl linker flags
With all libcs I'm aware of, libdl is now either empty (Glibc, musl,
uclibc, illumos), a symlink to libc or equivalent (Apple), or does not
exist (FreeBSD, NetBSD).  So explicitly linking libdl now does nothing
for the former platforms, and breaks the build for the latter
platforms.

With this patch I've removed -ldl from all overridden linker flags for
all free packages in Nixpkgs.  Everything still seems to build.
2023-01-23 15:34:53 +00:00
Alyssa Ross 5b22ff71e1
gcc: don't disable libgomp for uclibc targets
I'm reasonably confident this is no longer necessary, as uclibc's
libdl.a is empty, and I can cross-build stdenv.cc.cc for
x86_64-unknown-linux-uclibc with libgomp enabled.
2023-01-23 14:44:06 +00:00
Sergei Trofimovich b9b1d958d0 Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
	pkgs/development/libraries/qt-6/modules/qtbase.nix
	pkgs/stdenv/linux/make-bootstrap-tools.nix
2023-01-20 21:56:57 +00:00
Alyssa Ross 4ed0e1a743 gcc: use as(1) from binutils with LLVM bintools
LLVM does not provide a drop-in replacement for as(1).

This makes it possible to build a GNU Fortran cross compiler from GNU
to LLVM — e.g. buildPackages.gfortran for
{ system = "aarch64-linux"; useLLVM = true; }
2023-01-20 18:35:25 +01:00
John Ericson 2c48770293
Merge pull request #210816 from obsidiansystems/gcc-fix-bug-80431
gcc: Backport fix of GCC Issue 80431 from version 12
2023-01-17 11:45:29 -05:00
John Ericson d6d1897904 gcc: Backport fix of GCC Issue 80431 from version 12
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431

This bug annoys me because I hit it when working on Nix. It causes
miscompilations in such a way that I am hard-pressed to think how a
program could inadvertainly rely on the bug (such that it would be
broken by the fix).

The bug is longstanding, and the (quite small) applies without
modification to many older GCCs. I have confirmed by running the test in
that commit that does indeed fix the bug with the backports too.
2023-01-14 22:33:57 -05:00
Sergei Trofimovich ca4da963f8 Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
    pkgs/development/libraries/audio/roc-toolkit/default.nix
2023-01-14 11:07:42 +00:00
Sergei Trofimovich 1bc0b7ad62
Merge pull request #209153 from trofi/gcc-libs-cross-link
gcc: provide both native and cross forms of gcc.libs libraries
2023-01-14 08:18:19 +00:00
github-actions[bot] 49722fd14a
Merge master into staging-next 2023-01-13 18:01:34 +00:00
Boey Maun Suang c7ce0c86a6 gnat12: Fix GNAT Darwin dylib install names 2023-01-11 09:03:43 +11:00
Boey Maun Suang 3d64e7edbb gnat12: Add support for x86_64-darwin 2023-01-07 18:32:12 +11:00
Sergei Trofimovich b18eedcdab
Merge pull request #208859 from trofi/gcc-builder-cleanup
gcc/builder.sh: drop dead RPATH clobbering code
2023-01-05 18:42:01 +00:00
Sergei Trofimovich 2c931bd5f4 gcc: provide both native and cross forms of gcc.libs libraries
I would like to use --sysroot=/nix/store/does/not/exist hack
for both `gcc` and `clang` drivers to remove default include
(and library) search paths when we override them with libc.

For `gcc` it works as is. But for `clang` it also drops some of
`gcc` search paths`. Let'sconsider 2 lookups.

Successful lookup (no `--sysroot`):

    $ printf "int main(){}" | clang++ -x c++ - -Wl,--verbose |& grep -F stdc++
    attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
    attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
    attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
    attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
    attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.so failed
    /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.a

Failed lookup (has `--sysroot`):

    $ printf "int main(){}" | clang++ --sysroot=/does/not/exist -x c++ - -Wl,--verbose |& grep -F stdc++
    attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
    attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
    attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
    attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
    /nix/store/...-binutils-2.39/bin/ld: cannot find -lstdc++: No such file or directory

Note how `clang` starts the search roughly from
`gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib` in both cases. I think
it's our preferred location for both native and cross cases.

The change adds such a symlink:

    `gcc-11.3.0-lib` -> `gcc-11.3.0-lib/x86_64-unknown-linux-gnu`
2023-01-05 14:41:35 +00:00
github-actions[bot] 789ae2c93d
Merge staging-next into staging 2023-01-04 18:01:36 +00:00
Yureka 0319a561ec pkgsMusl.gccgo: fix build 2023-01-04 13:21:20 +01:00
Sergei Trofimovich 99b56a9139 gcc/builder.sh: drop dead RPATH clobbering code
The code was intended to use something like
    [ $buildConfig == *linux* ]
but never did and use always-false
    [ buildConfig == *linux* ]

As it's in nixpkgs for a few years let's just delete it instead of
restoring.
2023-01-03 10:30:30 +00:00
Thomas Watson 1f4feb7c6f avr-gcc: fix build on Darwin
Adds a patch which fixes a compilation error generated by Clang 11
compiling GCC 11.3.
2023-01-01 11:12:23 -06:00
github-actions[bot] dc7ebb0163
Merge staging-next into staging 2022-12-18 18:01:41 +00:00
figsoda ec8cb34358 treewide: fix typos 2022-12-17 19:39:44 -05:00
Artturin adc8900df1 treewide: fix some core package structuredAttrs 2022-12-08 21:05:28 +02:00
Vladimír Čunát befa1f2dc6
Merge #196565: gcc11: Update back to 11.3 on Darwin
...into staging
2022-11-22 12:42:23 +01:00
Jörg Thalheim 890d0576c5 cross/mingw: make threading library configureable 2022-11-14 12:50:04 +01:00
Zhaofeng Li ddb5ea3e69 gcc11: Update back to 11.3 on Darwin 2022-10-28 00:54:35 -06:00
Martin Weinelt 21c552eaf6
gcc12: fix build with libxcrypt 2022-10-09 18:10:38 +02:00
Martin Weinelt aac6de8d31
gcc10: fix build with libxcrypt 2022-10-09 18:10:38 +02:00
Franz Pletz 0097f57b1f
gcc11: fix build with libxcrypt 2022-10-09 18:07:54 +02:00
Theodore Ni 816cb20bd3
gcc12: switch to Homebrew patch on aarch64-darwin
We can presume that this patch is better tested and better maintained.
2022-09-04 11:07:54 -07:00
Martin Weinelt 249398ffa8 Merge remote-tracking branch 'origin/staging-next' into staging 2022-08-25 00:32:27 +02:00
github-actions[bot] 9179666d33
Merge master into staging-next 2022-08-23 12:01:12 +00:00
Vladimír Čunát f8eb3f491f
Merge #187418: gcc12: 12.1.0 -> 12.2.0 2022-08-23 07:52:03 +02:00
Sergei Trofimovich 657075f9fa gcc12: 12.1.0 -> 12.2.0
Co-authored-by: Robert Scott <github@humanleg.org.uk>
2022-08-21 13:56:21 +01:00
github-actions[bot] a6c886b7fd
Merge master into staging-next 2022-08-21 06:01:17 +00:00
Theodore Ni 1b0a51cbb7
gcc49: mark unsupported on aarch64-darwin
It's not supported and likely too old to be supported.
2022-08-20 15:11:53 -07:00
github-actions[bot] 77394c111b
Merge staging-next into staging 2022-08-20 18:02:00 +00:00
Sergei Trofimovich 1f7186ab5c libgccjit: don't try to enter into non-existent $lib output
Fixes build failure on `staging-next` introduced by commit c817efe6
("gcc: extend stripping of .a libraries and .o objects"):

    ...-bootstrap-stage3-stdenv-linux/setup: line 106: pushd: no other directory

Build failure happens because `libgccjit` has different `outputs` layout
compared to the rest of `gcc` derivations:

     outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";

The change carves out `$lib` lib handling part to avoid `gcc` rebuild
in `staging-next`.
2022-08-20 12:51:36 +01:00
Sergei Trofimovich 7f458e5c50
Merge pull request #187234 from trofi/drop-libelf-from-gcc
gcc: drop unused libelf dependency
2022-08-19 19:16:35 +01:00
Artturi 9adf0c2035
Merge pull request #185972 from Artturin/gccstrictdeps
gcc/: correct gnused conditionals
2022-08-19 20:50:23 +03:00
github-actions[bot] c00ace1204
Merge master into staging-next 2022-08-19 12:01:31 +00:00
Sergei Trofimovich 3b60b31d60 gcc: drop unused libelf dependency
gcc stopped using libelf in commit 48215350c24 ("re PR lto/46273 (Failed
to bootstrap)") around 2010, before gcc-4.6.0.
2022-08-18 08:35:41 +01:00
Artturin f16be229dc gcc/: correct gnused conditionals and move to nativeBuildInputs
hostPlatform changes were done in commits like 7a13457253

it should have been buildPlatform instead according to the comment
2022-08-17 21:03:40 +03:00
Vladimír Čunát ddc75d1843
Merge #185284: gcc: fix bootstrapTools.mips64el-linux-gnuabin32
...into staging
2022-08-16 13:12:01 +02:00
Theodore Ni 74b420b612
gcc12: apply working patch for darwin-aarch64 2022-08-13 12:04:03 -07:00
Theodore Ni cf206e9d00
gcc11: pick up bugfixes for darwin-aarch64
Amongst others, this picks up the fix for:

    https://github.com/iains/gcc-darwin-arm64/issues/54
2022-08-13 11:37:09 -07:00
github-actions[bot] 67f5b5a85d
Merge staging-next into staging 2022-08-08 18:02:11 +00:00
adisbladis 5cc12aa8cb
Merge pull request #182187 from adisbladis/newlib-nano-cc
newlib-nano: Set same flags as regular newlib in cc-wrapper/gcc config
2022-08-08 22:07:57 +08:00
Adam Joseph a6daffb118 gcc: factor out $linkLib64toLib, move it from bash to nix
This commit factors out the conditional which creates the `lib64->lib`
symlink in the `preInstall` phase, and calculates its value in nix
code rather than bash code so touching it doesn't cause a global
rebuild on every platform.
2022-08-05 13:52:25 -07:00
Adam Joseph dfba0bf93b gcc: do not create lib64->lib links on mips64n32
On mips, gcc follows the somewhat awkward IRIX convention of putting
mips64 binaries in `lib64` and mips64n32 binaries in `lib32`.  So on
mips64n32 we do not want the `lib64` symlinks.
2022-08-05 11:07:16 -07:00
Adam Joseph cbc80ff32b gcc: add linkLib32toLib to create lib32->lib links
Our gcc builder creates lib64->lib links to ensure that the "primary"
libraries for the targetPlatform wind up in $PREFIX/lib.  This is
required in order for make-bootstrap-files.nix to work correctly.

On mips, gcc follows the somewhat awkward IRIX convention of putting
mips32 binaries in `lib` and mips64n32 binaries in `lib32`.  So we
need similar symlinks there.  This may come up on other ILP32
platforms as well, so a general-purpose variable name is provided.
2022-08-05 11:07:14 -07:00
Sergei Trofimovich c817efe660 gcc: extend stripping of .a libraries and .o objects
The initial intent was to strip .a and .o files, not .a.o files.
While at it expanded stripping for $lib output as well.

Without the change `libgcc.a` was not stripped and `.debug*` sections
made into final binaries. It's not a problem on it's own, but it's an
unintended side-effect. Noticed on `crystal_1_0` test failure where
`crystal` was not able to handle `dwarf-5`.

While at it allowed absolute file names to be passed to stripDebugList
and friends.
2022-08-03 22:28:47 +01:00
Bernardo Meurer 88c63ca65a
Merge pull request #182513 from trofi/strip-for-host-and-target
gcc: enable stripping for cross-compilers
2022-07-28 00:30:49 -07:00
Sergei Trofimovich eece5d0dc0 gcc: enable stripping for cross-compilers
With explicit support for distinction between Host and Target strip paths
we can now safely strip ELF binaries with their according strip tools
without fear of damaging binaries due to architecture mismatch.

Closure size change for `pkgsCross.mingwW64.gcc12Stdenv.cc.cc`:

    # before:
    $ nix path-info -Sh $(nix-build -A pkgsCross.mingwW64.gcc12Stdenv.cc.cc) | unnix
    /<<NIX>>/x86_64-w64-mingw32-stage-final-gcc-debug-12.1.0           2.5G

    # after:
    $ nix path-info -Sh $(nix-build -A pkgsCross.mingwW64.gcc12Stdenv.cc.cc) | unnix
    /<<NIX>>/x86_64-w64-mingw32-stage-final-gcc-12.1.0         1.5G
2022-07-25 11:06:58 +01:00
Sergei Trofimovich c7062b9769
Merge pull request #181994 from trofi/gcc-drop-outdated-sed
gcc: drop outdated sed for system headers clobber
2022-07-24 15:01:22 +01:00
Sergei Trofimovich ea8e124000 gcc: always enable inhibit_libc=true for --without-headers builds
It's a follow-up to the breakage caused by 21966e13d2
("gcc: pass --with-build-sysroot=/"). It caused `pkgsLLVM`
cross-toolchain bootstrap breakage:

    $ nix build --no-link -f. pkgsLLVM.hello
    ...
    failed: /nix/store/...-x86_64-unknown-linux-gnu-stage-static-gcc-13.0.0.drv:
    ...
    configure flags: ... --enable-languages=c --disable-multilib \
      --disable-shared --enable-plugin ... --disable-libssp --disable-nls \
      --without-headers --disable-threads --disable-libgomp --disable-libquadmath \
      --disable-shared --disable-libatomic --disable-decimal-float --disable-libmpx \
      --disable-bootstrap \
      \
      --build=x86_64-unknown-linux-gnu \
      --host=x86_64-unknown-linux-gnu \
      --target=x86_64-unknown-linux-gnu
    ...
    The directory that should contain system headers does not exist:
      /usr/include
    make[2]: *** [Makefile:3279: stmp-fixinc] Error 1 shuffle=1658621302
    rm gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod gpl.pod cpp.pod gcov.pod lto-dump.pod
    make[2]: Leaving directory '/build/build/gcc'

Note: it's a no-libc build. It's not expected to use any libc headers.
But in this case fixincludes tries to run and uses default /usr/include
location.

Fixinsludes is not normally expected to run during cross-compilation
on --without-headers. gcc/configure.ac:

    : ${inhibit_libc=false}
    if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
           test x$with_newlib = xyes ; } &&
         { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
           inhibit_libc=true
    fi

The change explicitly passes inhibit_libc=true to configure to disable
include fixing on such cases.

Fixed `nix build --no-link -f. pkgsLLVM.hello` toolchain bootstrap.
2022-07-24 09:54:49 +01:00
John Ericson 21966e13d2
Merge pull request #181943 from trofi/fix-cross-built-gcc
gcc: pass --with-build-sysroot=/
2022-07-23 23:52:07 -04:00
Sergei Trofimovich 34636efced gcc: pass --with-build-sysroot=/ for gcc builds
Without this change cross-built gcc fails to detect stack protector style:

    $ nix log -f pkgs/stdenv/linux/make-bootstrap-tools-cross.nix powerpc64le.bootGCC | fgrep __stack_chk_fail
    checking __stack_chk_fail in target C library... no
    checking __stack_chk_fail in target C library... no

It happens because gcc treats search paths differently:

    https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=446747311a6aec3c810ad6aa4190f7bd383b94f7;hb=HEAD#l2458

     if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x ||
        test x$build != x$host || test "x$with_build_sysroot" != x; then
       ...
       if test "x$with_build_sysroot" != "x"; then
         target_header_dir="${with_build_sysroot}${native_system_header_dir}"
       elif test "x$with_sysroot" = x; then
         target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
       elif test "x$with_sysroot" = xyes; then
         target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
       else
         target_header_dir="${with_sysroot}${native_system_header_dir}"
       fi
     else
       target_header_dir=${native_system_header_dir}
     fi

By passing --with-build-sysroot=/ we trick cross-case to use
`target_header_dir="${with_sysroot}${native_system_header_dir}"`
which makes it equivalent to non-cross
`target_header_dir="${with_build_sysroot}${native_system_header_dir}"`

Tested the following setups:
- cross-compiler without libc headers (powerpc64le-static)
- cross-compiler with libc headers (powerpc64le-debug)
- cross-build compiler with libc headers (powerpc64le bootstrapTools)

Before the change only 2 of 3 compilers detected libc headers.
After the change all 3 compilers detected libc headers.

For darwin we silently ignore '-syslibroot //' argument as it does not
introduce impurities.

While at it dropped mingw special case for no-libc build. Before the change
we passed both '--without-headers --with-native-system-headers-dir' for
no-libc gcc-static builds. This tricked darwin builds to find sys/sdt.h
and fail inhibid_libc builds. Now all targets avoid passing native headers
for gcc-static builds.

While at it fixed correct headers passing to
--with-native-system-headers-dir= in host != target case: we were passing
host's headers where intention was to pass target's headers.
Noticed the mismatch as a build failure on pkgsCross.powernv.stdenv.cc
on darwin where `sys/sdt.h` is present in host's headers (libSystem)
but not target's headers (`glibc`).

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2022-07-23 18:40:07 +01:00
Sergei Trofimovich cb63ee9ff8
Merge pull request #181999 from trofi/gcc-clean-up-configureFlags
gcc: turn configureFlags into a sigle list, not nested list
2022-07-20 15:46:36 +01:00
adisbladis facbbae4b7 gcc: Set --with-newlib when using newlib-nano 2022-07-20 16:41:48 +08:00
Sergei Trofimovich 69da37a8fd gcc: turn configureFlags into a sigle list, not nested list
Before the change:

    $ nix repl pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
    nix-repl> :p powerpc64le.bootGCC.configureFlags
    [ ... "--enable-targets=powerpcle-linux" [ "--with-long-double-128" ] "--target=powerpc64le-unknown-linux-gnu" ]

After the change:

    nix-repl> :p powerpc64le.bootGCC.configureFlags
    [ ... "--enable-targets=powerpcle-linux" "--with-long-double-128" "--target=powerpc64le-unknown-linux-gnu" ]
2022-07-18 19:10:22 +01:00
Sergei Trofimovich 769956d65b gcc: drop outdated sed for system headers clobber
When reviewing https://github.com/NixOS/nixpkgs/pull/181802#issuecomment-1186834504
I noticed outdated code that attempted to override /usr/include.

    sed -i \
        -e "s,glibc_header_dir=/usr/include,glibc_header_dir=$libc_dev/include", \
        gcc/configure

`glibc_header_dir` was removed from `gcc-4.6` and later in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6961669f48aa18168b2d7daa7e2235fbec7cb636
(Dec 2010, "(gcc_cv_ld_eh_frame_hdr): Only check GNU ld for  --eh-frame-hdr.").

Since then gcc got `--with-native-system-header-dir=` which `nixpkgs` uses
for all packaged `gcc` versions.

The change should be a no-op.
2022-07-18 18:55:58 +01:00
github-actions[bot] 05798fee88
Merge staging-next into staging 2022-07-10 18:01:55 +00:00
Sergei Trofimovich 8f00857bf9 pkgsMusl.gcc12: backport build fix (PR106102)
Without the change gcc-12 on musl fails to build due to system headers
poisoning:

    /build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc
        In file included from /<<NIX>>/musl-1.2.3-dev/include/pthread.h:30,
                 from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35,
                 ....
                 from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77,
                 from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24,
                 from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25,
                 from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23,
                 from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32:
    /<<NIX>>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc"
       84 | void *calloc(size_t, size_t);
          |       ^
    /<<NIX>>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc"
      124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
          |                                    ^

The change pulls upstream fix as is.
2022-07-09 09:35:25 +01:00
Vladimír Čunát 43f9c191bf
Merge #110571: treewide: migrate to -fno-common
...into staging
2022-07-07 10:06:38 +02:00
Gaelan Steele 5b47eb13ac gcc, clang11: don't force -fcommon on GCC 10 or clang11
GCC 10 sets -fno-common by default. This broke some packages, so
when moving to GCC 10 we initially disabled this behavior. This
commit reverts that, bringing us closer to the standard and
upstream.

Co-authored-by: Sergei Trofimovich <slyich@gmail.com>
2022-07-06 08:37:00 +01:00
Vladimír Čunát 3f88d51e02
gcc10: 10.3.0 -> 10.4.0
Patches: the two seemed included in the release;
I also checked that the conditional patches still all apply.
2022-06-29 10:07:32 +02:00
Shea Levy 8e6206f9c9
gcc49: Fix build on darwin 2022-06-23 10:42:39 -04:00
Vladimír Čunát 06b472c49f
gcc9: 9.3.0 -> 9.5.0
The issue from 9.4.0 on aarch64-linux seems gone.
2022-06-05 23:24:46 +02:00
Vladimír Čunát cb4e7fd9bc
gdc: nicer eval failure from versions >= 12
12 will also be copied into future versions;
these parts seem OK to be copied by default.
2022-05-23 16:24:25 +02:00
Francesco Gazzetta 6436bdeb7f gcc: add langD support to gcc 10 2022-05-23 16:09:25 +02:00
Sergei Trofimovich 857a06674d
Merge pull request #173817 from trofi/fix-gcc-12-on-darwin
gcc12: fix substituteInPlace on darwin
2022-05-21 06:42:58 +00:00
Sergei Trofimovich 5d2d60e3e2 gcc12: fix substituteInPlace on darwin
gcc-12 did a mass rename from .c to .cc c++ files. As a result build fails as:

    substitute(): ERROR: file 'gcc/config/darwin-c.c' does not exist

Closes: https://github.com/NixOS/nixpkgs/issues/172877
2022-05-20 23:59:36 +01:00
Francesco Gazzetta c6ea401438 gdc: match gcc version
Programs compiled with gdc (such as tumiki-fighters and torus-trooper)
that depend on c++ libraries were failing with errors such as

/nix/store/3fqi6nigj8dkbvjnw8y4dy59gkq8vsj4-binutils-2.38/bin/ld: /nix/store/36960p41h83cwkcs2vpzg8ni39w4sc5m-bulletml-0.0.6/lib/libbulletml.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'

because of the mismatch with the gcc version used to compile the
libraries.

This commit unpins the gcc version gdc is based on, so they are kept in
sync.

gdc9 was removed since no other package depends specifically on that
version
2022-05-20 13:49:55 +02:00
Vladimír Čunát 148df9e42e
Merge #171830: gcc12, gfortran12, gnat12: init at 12.1.0 2022-05-10 10:59:28 +02:00
Sergei Trofimovich c34a8024bf gcc12, gfortran12, gnat12: init at 12.1.0
A copy of gcc11 with minor patch changes:
- follow .c/.cc rename upstream
- made patches unconditional

Changes: https://www.gnu.org/software/gcc/gcc-12/changes.html
2022-05-07 13:50:47 +01:00
Vladimír Čunát 005e2edc05
Merge #171792: gcc11: downgrade to 11.2.0 on x86_64-darwin
...into staging-next
2022-05-07 08:19:02 +02:00
github-actions[bot] 6e0aca3c43
Merge master into staging-next 2022-05-06 12:02:02 +00:00
Vladimír Čunát 976e65456a
gcc11: downgrade to 11.2.0 also on x86_64-darwin
https://hydra.nixos.org/build/175546330
2022-05-06 11:43:07 +02:00
Thomas Watson ec87e38d65 Revert "gcc: 11.2.0 -> 11.3.0" for aarch64-darwin
Patches to support GCC 11.3.0 on aarch64-darwin are not available. Homebrew
also is skipping the 11.3.0 upgrade.
2022-05-05 08:11:09 -05:00
Sergei Trofimovich cb03b37927 pkgsCross.mingw32.gcc11Stdenv: update mcfgthread patches for gcc-11
Without the change mingw32-gcc fails to build as:

    In file included from /build/gcc-11.2.0/libstdc++-v3/libsupc++/cxxabi.h:49,
                     from ../../../../gcc-11.2.0/libstdc++-v3/libsupc++/atexit_thread.cc:24:
    ../../../../gcc-11.2.0/libstdc++-v3/libsupc++/atexit_thread.cc:36:3: error: 'int __cxxabiv1::__cxa_thread_atexit(void (*)(void*), void*, void*)' should have been declared inside '__cxxabiv1'
       36 |   _GLIBCXX_NOTHROW
          |   ^~~~~~~~~~~~~~~~
    ../../../../gcc-11.2.0/libstdc++-v3/libsupc++/atexit_thread.cc:34:1: error: conflicting declaration of C function 'int __cxxabiv1::__cxa_thread_atexit(void (*)(void*), void*, void*)'
       34 | __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
          | ^~~~~~~~~~

The change follows upstream change introduced in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=7fc0f78c3f43af1967cb7b1ee8f4947f3b890aa2
2022-05-01 15:34:22 +01:00
Vladimír Čunát cfcccfa572
Merge #170121: gcc: 11.2.0 -> 11.3.0 (into staging) 2022-04-29 08:18:04 +02:00
Sergei Trofimovich e35682b207 gcc: 11.2.0 -> 11.3.0
Bug fix release.

Changes: https://gcc.gnu.org/gcc-11/changes.html (11.3 link below).
2022-04-24 19:12:51 +01:00
Malo Bourgon 0d0feaa4fc gcc{4..10}: add aarch64-darwin to badPlatforms 2022-04-14 10:02:19 -07:00
Simon Chatterjee 9b310e61b4 gcc10: fix cross-compilation from aarch64-darwin host
Without this patch, linking when cross-compiling fails:

    Undefined symbols for architecture arm64:
      "_host_hooks", referenced from:
          gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o)
          gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o)
          toplev::main(int, char**) in libbackend.a(toplev.o)
    ld: symbol(s) not found for architecture arm64
2022-04-06 21:55:56 +01:00
Vladimír Čunát f91a565fe3
gnat*: fixup build with glibc-2.34 2022-04-04 18:58:13 +02:00
John Ericson ed07c3b1a2
Merge pull request #163489 from alyssais/gcc-static-lib
pkgsStatic.stdenv.cc.cc: put static libs in $lib
2022-03-22 22:07:50 -04:00
Alyssa Ross 12c37aec37
pkgsStatic.stdenv.cc.cc: put static libs in $lib
libtool requires the library files its .la files describe to be in the
same directory as those files.  We only do this for compilers without
shared libraries, so that the libraries in $lib are always the
libraries the package set is supposed to use.

Fixes: https://github.com/NixOS/nixpkgs/issues/76873
Fixes: https://github.com/NixOS/nixpkgs/issues/108534
2022-03-22 17:56:11 +00:00
Alyssa Ross c6dd11ca39
Revert "gcc: Always pass --enable-shared by default"
This reverts commit 8e48232180.

Since pkgsStatic.stdenv.cc can only produce static binaries, there's
no reason to include that compilers e.g. libstdc++.so.
2022-03-22 17:56:08 +00:00
github-actions[bot] e452d308f5
Merge staging-next into staging 2022-03-22 12:02:02 +00:00
Alyssa Ross cb040db7ab pkgsStatic.gcc: fix build
LTO requires building a compiler plugin, which is a shared object.

The closure is a bit wild but it builds and can compile programs.
2022-03-22 10:52:36 +00:00
Maximilian Bosch e10ea9608a
gcc{7,9,10}: apply patches for asan w/glibc-2.34
This should fix a few broken cc-wrapper tests that also check for
libasan[1][2][3]:

    [...]
    checking whether sanitizers are fully functional... ==243==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
    [...]

The underlying issue is that `SIGSTKSZ` isn't a compile-time constant
anymore, but in this case the uninitialized `kAltStackSize` was
initialized early enough to evalute to `0`[4].

The issue is already fixed in gcc11 and there's  GCC 8.5 which also
contains the patch, however the backports to v9 and v10 aren't released
yet, so we have to apply patches on our own here.

For GCC 7.5 I applied the patch from gcc8 as it doesn't seem as if
there's an official upstream backport.

[1] https://hydra.nixos.org/build/163102264
[2] https://hydra.nixos.org/build/163624687
[3] https://hydra.nixos.org/build/163619227
[4] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100114
2022-02-27 10:26:58 +01:00
Zhaofeng Li 2fca45565d
gcc9: Add no-sys-dir patch for RISC-V (#154230)
Same as in gcc{10,11} (#147942).
2022-01-12 06:27:48 -05:00
Dmitry Kalinkin 1a9297102c
Merge branch 'master' into staging-next 2021-12-23 16:58:33 -05:00
Vladimír Čunát 28e731742c
Revert "Merge #142792: gcc9: 9.3.0 -> 9.4.0"
This reverts commit d71611fb72, reversing
changes made to cae9272c92.

The update caused an issue on aarch64-linux where it's the default
compiler, many packages got broken (usually through `mariadb`; I think).
File lib/gcc/aarch64-unknown-linux-gnu/9.4.0/include/arm_acle.h
got unbalanced braces (look at `cplusplus` lines), e.g. see in
/nix/store/fvkdvx69sf8h99xgx0m42dzfd5ly5csr-gcc-9.4.0/

I don't know how exactly it happened, as in the source this header is OK
and hasn't even changed between 9.3.0 and 9.4.0.  I assume that some
post-processing on headers got broken.  Anyway, I don't have much
motivation to dig deeper here, but perhaps someone else will.
2021-12-19 10:36:57 +01:00
oxalica 0d1750e9c0
gcc{10,11}: add no-sys-dir patch for RiscV
RiscV has an individual STARTFILE_PREFIX_SPEC macro which also need to
be patched.
2021-11-30 16:58:45 +08:00
Vladimír Čunát d71611fb72
Merge #142792: gcc9: 9.3.0 -> 9.4.0 (into staging) 2021-11-25 09:09:06 +01:00
Alyssa Ross 3f01b576af
Merge remote-tracking branch 'nixpkgs/staging-next' into staging
Conflicts:
	nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
	nixos/doc/manual/release-notes/rl-2111.section.md
2021-10-28 16:07:38 +00:00
ajs124 4080dff4f6 gcc8: 8.4.0 -> 8.5.0 2021-10-27 17:49:56 +02:00
ajs124 81394b0ad8 gcc9: 9.3.0 -> 9.4.0 2021-10-25 00:24:08 +02:00
Ivan Babrou e8abd9cc16 gcc11: 11.1.0 -> 11.2.0
The cyclades patch has been applied upstream:

* https://github.com/gcc-mirror/gcc/commit/2bf34b9f4e4
2021-10-23 12:12:18 -07:00
Peter Simons 476635afe1 Drop myself from meta.maintainers for most packages.
I'd like to reduce the number of Github notifications and
review requests I receive.
2021-10-14 11:01:27 +02:00
Sergei Trofimovich 46951d9527
gcc48, gcc49: apply upstream fix for gcc-11 (#138979)
Without the change build fails against gcc-11 as:

```
../../gcc-4.8.5/gcc/reload1.c:89:24:
  error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   89 |   (this_target_reload->x_spill_indirect_levels)
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
```

Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>

Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
2021-09-24 02:17:09 -04:00
github-actions[bot] 55c0ac1484
Merge staging-next into staging 2021-09-24 06:01:40 +00:00
r-burns 188dad47ca
Merge pull request #135360 from r-burns/gcc-musl-libgomp
gcc: enable libgomp for musl targets
2021-09-23 17:22:21 -07:00
Sergei Trofimovich 974e68a7ad gcc: remove <cyclades.h> from libsanitizer
linux-headers-5.13 removed <cyclades.h> along with device support.
Backport a single https://gcc.gnu.org/PR100379  upstream change to
fix gcc build.

Use local (unmodified) upstream patches to avoid fetchpatch dependency.
2021-09-20 19:37:19 +01:00
Vladimír Čunát c5f4e54e1d
Merge #135692: pkgsCross.avr.buildPackages.gcc: work around
... for log limit on hydra
2021-09-05 16:47:18 +02:00
polykernel ca20a96b5f treewide: concatStrings (intersperse ...) -> concatStringsSep ...
Update all usage of lib.concatStrings (lib.intersperse ...) to
lib.concatStringsSep. This produces the same result as per https://github.com/NixOS/nixpkgs/pull/135843,
however it yields a performance benefit on Nix versions that
support the builtins.concatStringsSep primop.
2021-08-28 11:57:59 -04:00
sternenseemann d01533ceab pkgsCross.avr.buildPackages.gcc{10,11}: avoid log limit on hydra
When upgrading from gcc 9 to 10, avr-gcc started to hit the hydra log
limit, preventing the binary cache from being populated.

This commit tries to workaround this issue by passing `-s` to make for
avr-gcc 10 and 11 which seem to exhibit this problem.

Reference #135605.
2021-08-26 00:36:58 +02:00
Ryan Burns ccc96a4c44 gcc: enable libgomp for musl targets
libgomp has been disabled on musl since musl support was first added to
nixpkgs (15d401dcfa), but seems to work
fine. Tested down to gcc 6 (gcc 4.8 already doesn't build for musl)
2021-08-22 20:44:51 -07:00
Ryan Burns 7364241a6a gcc: update powerpc-specific configuration
* support -m32 on (big-endian) powerpc64-linux
* fix compilation to powerpc*-musl targets with
  incomplete decimal-float support
2021-08-16 19:42:10 -07:00
sternenseemann 1508ea5708 gnat{6,9,10,11}: don't build libada when building a cross compiler
According to https://wiki.osdev.org/GNAT_Cross-Compiler building
libada is not possible when building a cross compiler. Unfortunately I
haven't been able to determine if this is upstream's position as well,
but sure enough disabling libada lets us build a GNAT cross compiler.
2021-07-28 12:44:49 +02:00
sternenseemann d3e05d191f gnat{6,9,10,11}: move gnatboot into nativeBuildInputs 2021-07-28 12:44:49 +02:00
Alyssa Ross 77f3a9a3aa gcc: broaden platforms
Okay, GCC might not technically support _every_ platform in
platforms.unix, but I think it would be easier to subtract those as
they're discovered, if that even matters, rather than trying to
exhaustively list every Unix it does support.

(I ran into this because I wanted to build GCC for NetBSD, which it
definitely supports.)
2021-06-09 10:28:01 +00:00
Patrick Hilhorst 3e91f422fd
gcc11: use maintainer team 2021-05-24 15:02:14 +02:00
Patrick Hilhorst c913e53bdb
gcc*: use maintainer team 2021-05-24 15:01:05 +02:00
Jonathan Ringer f7a112f6c4
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
  pkgs/applications/graphics/emulsion/default.nix
  pkgs/development/tools/misc/texlab/default.nix
  pkgs/development/tools/rust/bindgen/default.nix
  pkgs/development/tools/rust/cargo-udeps/default.nix
  pkgs/misc/emulators/ruffle/default.nix
  pkgs/tools/misc/code-minimap/default.nix
2021-05-18 08:57:16 -07:00
sternenseemann 2d176b593b gcc*: force building a cross compiler if host and target platform differ
gcc's configure system has the nasty habit (for us) of judging for
itself if it is building a cross compiler (or cross compiling), but on
the limited information of the build, host and target platforms' config
which only contains a subset of the information we encode in
`stdenv.*Platform`. The practical consequence was that prior to this
change building `pkgsLLVM.buildPackages.gcc` actually fails because it
refuses to use `--with-headers` with something it believes to not be a
cross compiler.

As a workaround we force the appropriate variable in the configure
script to always be `yes` regardless of its own conditional check.

At some point we probably should report this issue in some capacity, so
future gcc versions don't force us into workarounds like this and
acdc783418.
2021-05-18 00:16:54 +02:00
Vladimír Čunát 8eabe2ecc5
Merge #115235: gcc: native aarch64-darwin support 2021-05-11 12:12:04 +02:00
Vladimír Čunát 79762fcb4a
Merge #121772: gcc*: do not modify code in prePatch 2021-05-11 12:01:38 +02:00
Ivan Babrou 4aa95e3312 gcc: native aarch64-darwin support 2021-05-10 19:07:30 -07:00
github-actions[bot] 61fa3fdde8
Merge master into staging-next 2021-05-10 18:28:17 +00:00
Ivan Babrou 99d0c004d1 gcc6, gcc7, gcc8, gcc9, gcc10, gcc11: do not modify code in prePatch
Doing any modifications before patching risks invalidating patch base.
2021-05-04 22:53:21 -07:00
Ivan Babrou 8cf144d139 gnat11: extract gnat-cflags-11.patch from gnat-cflags.patch 2021-05-04 20:14:01 -07:00
github-actions[bot] c6548b2832
Merge staging-next into staging 2021-04-30 06:21:40 +00:00
Ivan Babrou d75d0b9c62 gcc11: init at 11.0.0
Pretty much copy-pasted from gcc10 with changed version and sha256.
2021-04-29 22:05:32 -07:00
Vladimír Čunát 537d9687d1
Merge #119219: gcc10: 10.2 -> 10.3 (into staging) 2021-04-29 10:38:18 +02:00
Arnout Engelen 48c952c039
Merge pull request #112928 from baloo/baloo/gcc/reproducible
stdenv: provide a deterministically built gcc
2021-04-26 11:07:34 +02:00
github-actions[bot] cdece2032d
Merge staging-next into staging 2021-04-22 18:14:30 +00:00
Alyssa Ross 407e448114 gcc8,gcc9: fix ctypes on NetBSD
This patch was applied to gcc7 in aab8c7ba43 ("netbsd: add cross target"),
but it hasn't been brought forward to newer compilers that have the
same problem.

GCC 6 and (probably) GCC 4.9 also have the issue, but the patch
doesn't apply cleanly to them so I'm leaving them alone for now.

GCC 10, our current default, appears to have finally fixed this.
2021-04-22 12:23:55 +00:00
github-actions[bot] ea5bd4364e
Merge staging-next into staging 2021-04-19 18:11:54 +00:00
Alyssa Ross 7eb3d024ae
gcc: don't build libssp on NetBSD
On NetBSD, this is provided by libc, and the GCC version clashes with it.
Disabling it matches the behaviour of pkgsrc on NetBSD.

Fixes: https://github.com/NixOS/nixpkgs/issues/119839
2021-04-19 14:11:05 +00:00
sternenseemann acdc783418 gcc*: always force --program-prefix and pass --target
Don't rely on gcc detecting from the passed platforms which prefix to
use, but always specify the prefix nixpkgs expects (or doesn't). This
allows us to work around problems where the configure script would add
prefix where nixpkgs doesn't expect one (if `--target` was specified,
but the same as `--host`) or doesn't add one if nixpkgs expects one (if
`--target` and `--host` are the same, but we are actually cross
compiling, but the relevant parts of the platform are not encoded into
the platform config.

See also ca9be0511b.
2021-04-16 22:54:05 +02:00
Tobias Mayer d09936ea84
gcc10: 10.2 -> 10.3 2021-04-12 12:22:31 +02:00
John Ericson e6ca7b6e5b
Merge pull request #113747 from r-burns/nixpkgs-gcc-decfloat
gcc: don't disable decimal-float when cross-compiling
2021-03-21 13:27:43 -04:00
Arthur Gautier a961aeadae stdenv: provide a deterministically built gcc
Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-03-01 05:06:39 +00:00
Jörg Thalheim 766246c6df
Merge pull request #112843 from r-burns/gcc-ppc-m32
gcc: support -m32 on ppc64le
2021-02-27 22:23:36 +00:00
adisbladis a439e0ef6e
gcc10: Pass langJit to preConfigure
This should fix libgccjit on darwin.
2021-02-26 12:10:44 +02:00
Ryan Burns f74c281386 gcc: don't disable decimal-float when cross-compiling
This causes some minor ugliness during stdenv bootstrap on powerpc64le
using cross-compiled bootstrap tools. MPFR wants to use decimal floats
by default so they have to be manually disabled in the configure flags
when using cross-compiled bootstrap tools.

The lineage of this particular configure flag traces back to 2010 (!)
It was added in commit: 9b1d5353a9
I've built various cross bootstrap tools and they seem to work fine,
so I don't think this is needed anymore.
2021-02-19 18:42:25 -08:00
Symphorien Gibol d68dee04b7 gcc: fix cross compilation to musl32 2021-02-12 21:11:16 +01:00
Walter Franzini 733d24b50b add stackprotector support on musl32
In order to support stackprotector on musl32, this change import a
couple of patches from alpinelinux:
1. libssp_nonshared.a is built alongside musl's libc
2. the above library is automatically linked when compiling with gcc6
   or gcc7
2021-02-12 21:11:16 +01:00
Ryan Burns f2ac16ec28 gcc: support -m32 on ppc64le
This is needed to build grub2 for powerpc64le hosts. Running powerpcle code
on powerpc64le is somewhat analogous to running multiarch i686 code on x86_64,
so it's also useful to have in general.
2021-02-11 17:33:24 -08:00
John Ericson 5fc5e83808
Merge pull request #111345 from r-burns/ppc64-big-endian
Enable PPC64 (big-endian)
2021-01-30 16:26:06 -05:00
Ryan Burns 5530a3adbe gcc: fix powerpc64-linux
Long-double-128 is a hardware feature independent of endianness
2021-01-30 12:34:30 -08:00
github-actions[bot] 2137c13b40
Merge master into staging-next 2021-01-27 12:24:05 +00:00
Ben Siraphob 3bbad8b041 treewide: remove inherited stdenv.lib 2021-01-27 12:44:43 +07:00
Jan Tojnar 01ee4ea574
Merge branch 'master' into staging-next 2021-01-24 00:09:45 +01:00
John Ericson 12881a7aa7
Merge pull request #110544 from Ericson2314/no-platform
top-level, lib: Remove platform attribute of platforms
2021-01-23 16:32:36 -05:00
John Ericson 9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
github-actions[bot] 58752914f4
Merge master into staging-next 2021-01-23 12:40:13 +00:00
Ben Siraphob acc5f7b18a pkgs/development/compilers: stdenv.lib -> lib 2021-01-23 08:57:37 +07:00
Jonathan Ringer 0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson 8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Matthew Bauer 4bdcddf9aa gcc: allow stripping gcc libraries
When cross compiling to the same kernel / arch combination, it is safe
to use strip of libraries. This happens when cross-compiling musl
programs. dontStrip is now set in each gcc compiler instead of in
gcc/builder.sh.

Fixes #75476
2021-01-21 16:25:48 -06:00
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00
github-actions[bot] 92f5b04596
Merge staging-next into staging 2021-01-04 06:25:40 +00:00
Kira Bruneau f0c6e40948 gcc10: fix MinGW build & use local copy of mcfgthread patches 2021-01-03 23:04:37 -05:00
github-actions[bot] 581059aed4
Merge staging-next into staging 2021-01-04 00:57:38 +00:00
John Ericson 8e48232180 gcc: Always pass --enable-shared by default
I am actually a bit skeptical about this, but @matthewbauer makes the
case for this in
https://github.com/NixOS/nixpkgs/pull/107238#discussion_r546454453 and
I'm happy to go with it not being as in the loop on static linking stuff
as he is.
2021-01-03 19:19:09 +00:00
John Ericson f52263ced0 treewide: Start to break up static overlay
We can use use `stdenv.hostPlatform.isStatic` instead, and move the
logic per package. The least opionated benefit of this is that it makes
it much easier to replace packages with modified ones, as there is no
longer any issue of overlay order.

CC @FRidh @matthewbauer
2021-01-03 19:18:16 +00:00
John Ericson 0df75bc04e gcc 8, 10: tabs -> spaces 2021-01-03 19:14:56 +00:00
Jörg Thalheim c417247cf1
Merge pull request #107596 from Mic92/fix-static-pie-take2
bintools-wrapper: skip dynamic linker for static binaries
2020-12-30 06:23:09 +00:00
luc65r f6fceb321b Remove trailing whitespaces and fix indentation 2020-12-28 08:43:32 +01:00
luc65r b1b3ca7907 gcc: make -fcommon default on gcc10 2020-12-28 08:43:31 +01:00
Jörg Thalheim 61bbbcd1af
bintools-wrapper: skip dynamic linker for static binaries 2020-12-27 16:42:11 +01:00
Daniël de Kok c81a429fb7 gcc9: apply gcc PR 96796 to avoid cycling on certain subreg reloads
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96796

This may have caused the AArch64 build failure of PyTorch in:

https://github.com/NixOS/nixpkgs/pull/101917
2020-11-02 20:06:53 +01:00
Vladimír Čunát 336bc8283b
Re-Revert "Merge #101508: libraw: 0.20.0 -> 0.20.2"
This reverts commit c778945806.

I believe this is exactly what brings the staging branch into
the right shape after the last merge from master (through staging-next);
otherwise part of staging changes would be lost
(due to being already reachable from master but reverted).
2020-10-26 08:19:17 +01:00
Vladimír Čunát c778945806
Revert "Merge #101508: libraw: 0.20.0 -> 0.20.2"
I'm sorry; I didn't notice it contained staging commits.

This reverts commit 17f5305b6c, reversing
changes made to a8a018ddc0.
2020-10-25 09:41:51 +01:00
Vladimír Čunát 5aca3498a6
Merge #92704: gcc: Improve manpage symlinks 2020-10-18 11:56:39 +02:00
Vladimír Čunát 51ccf2d4ba
gcc10: 10.1.0 -> 10.2.0
It's supposed to be just bugfixes.  I tested building some projects with
gcc10.  Also gfortran10 still builds.  I don't expect issues.
This causes basically no rebuilds, as we use 9 by default.
2020-09-12 11:54:39 +02:00
adisbladis 6fc3562432
Merge pull request #94637 from antifuchs/gccemacs-on-darwin
emacs: Make gccemacs build on darwin
2020-09-02 18:30:58 +02:00
Andreas Fuchs 41e34e76d8 gcc: Only use strip -x if building libgccjit on darwin
It's not necessary to use strip -x otherwise, so let's just use it for
the JIT library.
2020-08-29 23:10:38 -04:00
Matthew Bauer 0b8312660a gcc10: fix building darwin->linux cross compiler
same as 459c60dda2 but for gcc10
2020-08-26 16:15:05 -05:00