summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2023-04-26 18:31:35 +0200
committerVladimír Čunát <v@cunat.cz>2023-04-26 18:35:28 +0200
commitd6b863fd9b7bb962e6f9fdf292419a775e772891 (patch)
tree8a5534f2435672c4f2a7a3884ff59af5591c8b88 /pkgs/development/compilers/gcc
parent7b57f59155b55250ea2d0871a7c0102d63fbba93 (diff)
parent72fb66768e1ea1180b170ebea6ac5ac465e9f568 (diff)
Merge #226795: staging-next 2023-04-18
Diffstat (limited to 'pkgs/development/compilers/gcc')
-rw-r--r--pkgs/development/compilers/gcc/12/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/builder.sh2
-rw-r--r--pkgs/development/compilers/gcc/common/configure-flags.nix5
-rw-r--r--pkgs/development/compilers/gcc/common/platform-flags.nix20
4 files changed, 22 insertions, 7 deletions
diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix
index 1b7d61bb2af18..a3e8faaed460b 100644
--- a/pkgs/development/compilers/gcc/12/default.nix
+++ b/pkgs/development/compilers/gcc/12/default.nix
@@ -29,7 +29,6 @@
 , buildPackages
 , libxcrypt
 , disableGdbPlugin ? !enablePlugin
-, disableBootstrap ? !stdenv.hostPlatform.isDarwin
 , nukeReferences
 , callPackage
 }:
@@ -57,6 +56,7 @@ with builtins;
 
 let majorVersion = "12";
     version = "${majorVersion}.2.0";
+    disableBootstrap = !stdenv.hostPlatform.isDarwin;
 
     inherit (stdenv) buildPlatform hostPlatform targetPlatform;
 
diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index a2155360edeed..5147df1e4cc0d 100644
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -262,7 +262,7 @@ postInstall() {
     fi
 
     # Get rid of some "fixed" header files
-    rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h}
+    rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h,bits/statx.h}
 
     # Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
     for i in $out/bin/*-gcc*; do
diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix
index eadc6967acfc9..e0f7ccc7b59a3 100644
--- a/pkgs/development/compilers/gcc/common/configure-flags.nix
+++ b/pkgs/development/compilers/gcc/common/configure-flags.nix
@@ -44,6 +44,9 @@ let
   inherit (stdenv)
     buildPlatform hostPlatform targetPlatform;
 
+  # See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903
+  disableBootstrap' = disableBootstrap && !langFortran;
+
   crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
   crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
 
@@ -217,7 +220,7 @@ let
     # TODO: aarch64-darwin has clang stdenv and its arch and cpu flag values are incompatible with gcc
     ++ lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) (import ../common/platform-flags.nix { inherit (stdenv)  targetPlatform; inherit lib; })
     ++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags
-    ++ lib.optional disableBootstrap "--disable-bootstrap"
+    ++ lib.optional disableBootstrap' "--disable-bootstrap"
 
     # Platform-specific flags
     ++ lib.optional (targetPlatform == hostPlatform && targetPlatform.isx86_32) "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix
index bd5a72f960364..c0593cd781ed4 100644
--- a/pkgs/development/compilers/gcc/common/platform-flags.nix
+++ b/pkgs/development/compilers/gcc/common/platform-flags.nix
@@ -1,7 +1,8 @@
 { lib, targetPlatform }:
 
 let
-  p =  targetPlatform.gcc or {}
+  gcc = targetPlatform.gcc or {};
+  p =  gcc
     // targetPlatform.parsed.abi;
 in lib.concatLists [
   (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
@@ -10,7 +11,18 @@ in lib.concatLists [
   (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
   (lib.optional (p ? float) "--with-float=${p.float}")
   (lib.optional (p ? mode) "--with-mode=${p.mode}")
-  (lib.optional
-    (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit)
-    "--with-long-double-128")
+  (lib.optionals targetPlatform.isPower64
+    # musl explicitly rejects 128-bit long double on
+    # powerpc64; see musl/arch/powerpc64/bits/float.h
+    (lib.optionals
+      (!targetPlatform.isMusl
+       && (targetPlatform.isLittleEndian ||
+           # "... --with-long-double-format is only supported if the default cpu is power7 or newer"
+           #  https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709
+           (lib.lists.elem
+             (lib.strings.substring 0 6 (p.cpu or ""))
+             [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [
+      "--with-long-double-128"
+      "--with-long-double-format=${gcc.long-double-format or "ieee"}"
+    ]))
 ]