gcc{10,11,12,13,14}: reorder .cfi_startproc with label

fixes llvm-18+ builds which require that an asm label precedes the
.cfi_startproc pseudo instruction.

+16
pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-09-1.diff
···
+
this patch fixes build for clang-18+
+
+
diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S
+
index d3235bc33..1a56eb61c 100644
+
--- a/libgcc/config/aarch64/lse.S
+
+++ b/libgcc/config/aarch64/lse.S
+
@@ -170,8 +170,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+
.globl \name
+
.hidden \name
+
.type \name, %function
+
- .cfi_startproc
+
\name:
+
+ .cfi_startproc
+
BTI_C
+
.endm
+
+16
pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-14-1.diff
···
+
this patch fixes build for clang-18+
+
+
diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S
+
index ecef47086..b478dd4d9 100644
+
--- a/libgcc/config/aarch64/lse.S
+
+++ b/libgcc/config/aarch64/lse.S
+
@@ -174,8 +174,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+
.globl \name
+
HIDDEN(\name)
+
SYMBOL_TYPE(\name, %function)
+
- .cfi_startproc
+
\name:
+
+ .cfi_startproc
+
.endm
+
+
.macro ENDFN name
+16
pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-2.diff
···
+
this patch fixes build for clang-18+
+
+
diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S
+
index d3235bc33..1a56eb61c 100644
+
--- a/libgcc/config/aarch64/lse.S
+
+++ b/libgcc/config/aarch64/lse.S
+
@@ -197,8 +197,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+
.text
+
.balign 16
+
.private_extern _\name
+
- .cfi_startproc
+
_\name:
+
+ .cfi_startproc
+
BTI_C
+
.endm
+
+16 -7
pkgs/development/compilers/gcc/patches/default.nix
···
is9 = majorVersion == "9";
is8 = majorVersion == "8";
is7 = majorVersion == "7";
+
+
# We only apply these patches when building a native toolchain for
+
# aarch64-darwin, as it breaks building a foreign one:
+
# https://github.com/iains/gcc-12-branch/issues/18
+
canApplyIainsDarwinPatches = stdenv.hostPlatform.isDarwin
+
&& stdenv.hostPlatform.isAarch64
+
&& buildPlatform == hostPlatform
+
&& hostPlatform == targetPlatform;
+
inherit (lib) optionals optional;
in
···
++ optional langFortran (if atLeast12 then ./gcc-12-gfortran-driving.patch else ./gfortran-driving.patch)
++ [ ./ppc-musl.patch ]
++ optional (atLeast9 && langD) ./libphobos.patch
+
++ optional (atLeast9 && !atLeast14) ./cfi_startproc-reorder-label-09-1.diff
+
++ optional (atLeast14 && !canApplyIainsDarwinPatches) ./cfi_startproc-reorder-label-14-1.diff
···
"12" = [ ./gnat-darwin-dylib-install-name.patch ];
}.${majorVersion} or [])
-
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
-
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
-
++ optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({
+
++ optionals canApplyIainsDarwinPatches ({
"14" = [
(fetchpatch {
name = "gcc-14-darwin-aarch64-support.patch";
···
name = "gcc-13-darwin-aarch64-support.patch";
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/bda0faddfbfb392e7b9c9101056b2c5ab2500508/gcc/gcc-13.3.0.diff";
sha256 = "sha256-RBTCBXIveGwuQGJLzMW/UexpUZdDgdXprp/G2NHkmQo=";
-
}) ];
+
}) ./cfi_startproc-reorder-label-2.diff ];
"12" = [ (fetchurl {
name = "gcc-12-darwin-aarch64-support.patch";
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/1ed9eaea059f1677d27382c62f21462b476b37fe/gcc/gcc-12.4.0.diff";
sha256 = "sha256-wOjpT79lps4TKG5/E761odhLGCphBIkCbOPiQg/D1Fw=";
-
}) ];
+
}) ./cfi_startproc-reorder-label-2.diff ];
"11" = [ (fetchpatch {
# There are no upstream release tags in https://github.com/iains/gcc-11-branch.
# 5cc4c42a0d4de08715c2eef8715ad5b2e92a23b6 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.5.0
url = "https://github.com/iains/gcc-11-branch/compare/5cc4c42a0d4de08715c2eef8715ad5b2e92a23b6..gcc-11.5-darwin-r0.diff";
hash = "sha256-7lH+GkgkrE6nOp9PMdIoqlQNWK31s6oW+lDt1LIkadE=";
-
}) ];
+
}) ./cfi_startproc-reorder-label-2.diff ];
"10" = [ (fetchpatch {
# There are no upstream release tags in https://github.com/iains/gcc-10-branch.
# d04fe55 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-10.5.0
url = "https://github.com/iains/gcc-10-branch/compare/d04fe5541c53cb16d1ca5c80da044b4c7633dbc6...gcc-10-5Dr0-pre-0.diff";
hash = "sha256-kVUHZKtYqkWIcqxHG7yAOR2B60w4KWLoxzaiFD/FWYk=";
-
}) ];
+
}) ./cfi_startproc-reorder-label-2.diff ];
}.${majorVersion} or [])
# Work around newer AvailabilityInternal.h when building older versions of GCC.