From d4f8aac2c57ff594fea2ffa4ed95e84af5036e1d Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 6 Nov 2023 16:44:29 -0500 Subject: [PATCH] =?UTF-8?q?gcc{48,49,6}:=20don=E2=80=99t=20use=20-pipe=20w?= =?UTF-8?q?ith=20clang=20assembler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../gcc/patches/4.9/darwin-clang-as.patch | 16 ++++++++++++++++ .../compilers/gcc/patches/default.nix | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/compilers/gcc/patches/4.9/darwin-clang-as.patch diff --git a/pkgs/development/compilers/gcc/patches/4.9/darwin-clang-as.patch b/pkgs/development/compilers/gcc/patches/4.9/darwin-clang-as.patch new file mode 100644 index 000000000000..095713eb6c8c --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/4.9/darwin-clang-as.patch @@ -0,0 +1,16 @@ +diff -ur a/libgcc/config/t-darwin b/libgcc/config/t-darwin +--- a/libgcc/config/t-darwin 2012-07-14 09:50:59.000000000 -0400 ++++ b/libgcc/config/t-darwin 2023-11-05 21:26:11.696825584 -0500 +@@ -7,12 +7,6 @@ + crttme.o: $(srcdir)/config/darwin-crt-tm.c + $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -DEND -c $< + +-# -pipe because there's an assembler bug, 4077127, which causes +-# it to not properly process the first # directive, causing temporary +-# file names to appear in stabs, causing the bootstrap to fail. Using -pipe +-# works around this by not having any temporary file names. +-HOST_LIBGCC2_CFLAGS += -pipe +- + # Use unwind-dw2-fde-darwin + LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \ + $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 2052d0f674f2..8e295e161869 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -243,6 +243,12 @@ in ./6/gnat-glibc234.patch ] +# The clang-based assembler used in darwin.cctools-llvm (LLVM >11) does not support piping input. +# Fortunately, it does not exhibit the problem GCC has with the cctools assembler. +# This patch can be dropped should darwin.cctools-llvm ever implement support. +++ optional (!atLeast7 && hostPlatform.isDarwin && lib.versionAtLeast (lib.getVersion stdenv.cc) "12") ./4.9/darwin-clang-as.patch + + ## gcc 4.9 and older ############################################################################## ++ optional (!atLeast6) ./parallel-bconfig.patch