gcc: move patches attribute into patches/ subdirectory

+236 -197
pkgs/development/compilers/gcc/ada-cctools-as-detection-configure.patch pkgs/development/compilers/gcc/patches/ada-cctools-as-detection-configure.patch
+1 -197
pkgs/development/compilers/gcc/default.nix
··· 89 90 inherit (stdenv) buildPlatform hostPlatform targetPlatform; 91 92 - patches = 93 - optionals (atLeast49 && !atLeast7) [ 94 - ./9/fix-struct-redefinition-on-glibc-2.36.patch 95 - ] ++ optionals (atLeast49 && ((!atLeast7 && !stdenv.targetPlatform.isRedox) || !atLeast6)) [ 96 - ./use-source-date-epoch.patch 97 - ] ++ optionals (atLeast6 && !atLeast7 && !stdenv.targetPlatform.isRedox) [ 98 - ./6/0001-Fix-build-for-glibc-2.31.patch 99 - ] ++ optionals (!atLeast6) [ 100 - ./parallel-bconfig.patch 101 - ] ++ optionals (atLeast49 && !atLeast6) [ 102 - (./. + "/${lib.versions.major version}.${lib.versions.minor version}/parallel-strsignal.patch") 103 - (./. + "/${lib.versions.major version}.${lib.versions.minor version}/libsanitizer.patch") 104 - (fetchpatch { 105 - name = "avoid-ustat-glibc-2.28.patch"; 106 - url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96"; 107 - sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0"; 108 - }) 109 - ] ++ optionals (atLeast7 && !atLeast8) [ 110 - # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html 111 - (./. + "/${majorVersion}/riscv-pthread-reentrant.patch") 112 - # https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html 113 - (./. + "/${majorVersion}/riscv-no-relax.patch") 114 - # Fix for asan w/glibc-2.34. Although there's no upstream backport to v7, 115 - # the patch from gcc 8 seems to work perfectly fine. 116 - (./. + "/${majorVersion}/gcc8-asan-glibc-2.34.patch") 117 - ] ++ optionals (atLeast7 && !atLeast8) [ 118 - (./. + "/${majorVersion}/0001-Fix-build-for-glibc-2.31.patch") 119 - ] ++ optional (majorVersion == "9") ./9/fix-struct-redefinition-on-glibc-2.36.patch 120 - ++ optional (atLeast6 && !atLeast12) ./fix-bug-80431.patch 121 - ++ optional (atLeast7 && !atLeast9) ./9/fix-struct-redefinition-on-glibc-2.36.patch 122 - ++ optional (atLeast10 && !atLeast11) ./11/fix-struct-redefinition-on-glibc-2.36.patch 123 - ++ optional (targetPlatform != hostPlatform) ./libstdc++-target.patch 124 - ++ optional (atLeast7 && !atLeast10 && targetPlatform.isNetBSD) ./libstdc++-netbsd-ctypes.patch 125 - ++ optional (noSysDirs && atLeast12) ./gcc-12-no-sys-dirs.patch 126 - ++ optional (noSysDirs && !atLeast12) ./no-sys-dirs.patch 127 - ++ optional (atLeast6 && !atLeast7 && langAda) ./gnat-cflags.patch 128 - ++ optional (atLeast6 && !atLeast7 && langAda) ./6/gnat-glibc234.patch 129 - ++ optional (noSysDirs && atLeast10 && (is10 || !atLeast12 -> hostPlatform.isRiscV)) ./no-sys-dirs-riscv.patch 130 - ++ optional (noSysDirs && atLeast9 && !atLeast10 && hostPlatform.isRiscV) ./no-sys-dirs-riscv-gcc9.patch 131 - ++ optionals (langAda || atLeast12) [ 132 - ./gnat-cflags-11.patch 133 - ] ++ optionals (langAda && atLeast9 && !atLeast11) [ 134 - ./gnat-cflags.patch 135 - ] ++ optionals atLeast12 [ 136 - ./gcc-12-gfortran-driving.patch 137 - ./ppc-musl.patch 138 - ] ++ optionals (majorVersion == "12") [ 139 - # backport ICE fix on ccache code 140 - ./12/lambda-ICE-PR109241.patch 141 - ] 142 - # We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building 143 - # a foreign one: https://github.com/iains/gcc-12-branch/issues/18 144 - ++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({ 145 - "13" = [ (fetchpatch { 146 - name = "gcc-13-darwin-aarch64-support.patch"; 147 - url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff"; 148 - sha256 = "sha256-Y5r3U3dwAFG6+b0TNCFd18PNxYu2+W/5zDbZ5cHvv+U="; 149 - }) ]; 150 - "12" = [ (fetchurl { 151 - name = "gcc-12-darwin-aarch64-support.patch"; 152 - url = "https://raw.githubusercontent.com/Homebrew/formula-patches/f1188b90d610e2ed170b22512ff7435ba5c891e2/gcc/gcc-12.3.0.diff"; 153 - sha256 = "sha256-naL5ZNiurqfDBiPSU8PTbTmLqj25B+vjjiqc4fAFgYs="; 154 - }) ]; 155 - }."${majorVersion}" or []) 156 - ++ optional (atLeast9 && langD) ./libphobos.patch 157 - ++ optional (atLeast7 && !atLeast8 && hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied 158 - url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; 159 - sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs"; 160 - }) 161 - ++ optional langFortran ../gfortran-driving.patch 162 - ++ optional (!atLeast49 && hostPlatform.isDarwin) ../gfortran-darwin-NXConstStr.patch 163 - ++ optionals (atLeast49 && !atLeast6) [ 164 - # glibc-2.26 165 - ./struct-ucontext.patch 166 - ./struct-sigaltstack-4.9.patch 167 - ] 168 - # TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering 169 - ++ optional (atLeast7 && !atLeast12 && targetPlatform.libc == "musl" && targetPlatform.isPower) ./ppc-musl.patch 170 - ++ optional (atLeast6 && !atLeast8 && targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch { 171 - url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb"; 172 - sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2"; 173 - }) 174 - ++ optional (atLeast6 && atLeast7 && !atLeast9 && targetPlatform.libc == "musl") ./libgomp-dont-force-initial-exec.patch 175 - ++ optional (atLeast6 && !atLeast7 && langGo) ./gogcc-workaround-glibc-2.36.patch 176 - # TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering 177 - ++ optionals (atLeast11 && !atLeast12 && stdenv.isDarwin) [ 178 - (fetchpatch { 179 - # There are no upstream release tags in https://github.com/iains/gcc-11-branch. 180 - # ff4bf32 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.4.0 181 - url = "https://github.com/iains/gcc-11-branch/compare/ff4bf326d03e750a8d4905ea49425fe7d15a04b8..gcc-11.4-darwin-r0.diff"; 182 - hash = "sha256-6prPgR2eGVJs7vKd6iM1eZsEPCD1ShzLns2Z+29vlt4="; 183 - }) 184 - ] 185 - # https://github.com/osx-cross/homebrew-avr/issues/280#issuecomment-1272381808 186 - ++ optional (atLeast11 && !atLeast12 && stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch 187 - 188 - # backport fixes to build gccgo with musl libc 189 - ++ optionals (atLeast12 && langGo && stdenv.hostPlatform.isMusl) [ 190 - (fetchpatch { 191 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 192 - url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff"; 193 - hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I="; 194 - }) 195 - (fetchpatch { 196 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 197 - url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff"; 198 - hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo="; 199 - }) 200 - (fetchpatch { 201 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 202 - url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff"; 203 - hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk="; 204 - }) 205 - (fetchpatch { 206 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 207 - url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff"; 208 - hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo="; 209 - }) 210 - (fetchpatch { 211 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 212 - url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff"; 213 - hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ="; 214 - }) 215 - (fetchpatch { 216 - excludes = [ "gcc/go/gofrontend/MERGE" ]; 217 - url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff"; 218 - hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE="; 219 - }) 220 - (fetchpatch { 221 - url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff"; 222 - hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI="; 223 - }) 224 - ] 225 - 226 - # Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin 227 - ++ optional (atLeast12 && stdenv.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch 228 - 229 - # Use absolute path in GNAT dylib install names on Darwin 230 - ++ optional (atLeast12 && stdenv.isDarwin && langAda) ./gnat-darwin-dylib-install-name.patch 231 - 232 - # Obtain latest patch with ../update-mcfgthread-patches.sh 233 - ++ optional (atLeast6 && !atLeast13 && !withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") 234 - ./Added-mcf-thread-model-support-from-mcfgthread.patch 235 - 236 - # Retpoline patches pulled from the branch hjl/indirect/gcc-4_9-branch (by H.J. Lu, the author of GCC upstream retpoline commits) 237 - ++ optionals (atLeast49 && !atLeast6) (builtins.map ({commit, sha256}: fetchpatch {url = "https://github.com/hjl-tools/gcc/commit/${commit}.patch"; inherit sha256;}) 238 - [{ commit = "e623d21608e96ecd6b65f0d06312117d20488a38"; sha256 = "1ix8i4d2r3ygbv7npmsdj790rhxqrnfwcqzv48b090r9c3ij8ay3"; } 239 - { commit = "2015a09e332309f12de1dadfe179afa6a29368b8"; sha256 = "0xcfs0cbb63llj2gbcdrvxim79ax4k4aswn0a3yjavxsj71s1n91"; } 240 - { commit = "6b11591f4494f705e8746e7d58b7f423191f4e92"; sha256 = "0aydyhsm2ig0khgbp27am7vq7liyqrq6kfhfi2ki0ij0ab1hfbga"; } 241 - { commit = "203c7d9c3e9cb0f88816b481ef8e7e87b3ecc373"; sha256 = "0wqn16y7wy5kg8ngfcni5qdwfphl01axczibbk49bxclwnzvldqa"; } 242 - { commit = "f039c6f284b2c9ce97c8353d6034978795c4872e"; sha256 = "13fkgdb17lpyxfksz1zanxhgpsm0jrss9w61nbl7an4im22hz7ci"; } 243 - { commit = "ed42606bdab1c5d9e5ad828cd6fe1a0557f193b7"; sha256 = "0gdnn8v3p03imj3qga2mzdhpgbmjcklkxdl97jvz5xia2ikzknxm"; } 244 - { commit = "5278e062ef292fd2fbf987d25389785f4c5c0f99"; sha256 = "0j81x758wf8v7j4rx5wc1cy7yhkvhlhv3wmnarwakxiwsspq0vrs"; } 245 - { commit = "76f1ffbbb6cd9f6ecde6c82cd16e20a27242e890"; sha256 = "1py56y6gp7fjf4f8bbsfwh5bs1gnmlqda1ycsmnwlzfm0cshdp0c"; } 246 - { commit = "4ca48b2b688b135c0390f54ea9077ef10aedd52c"; sha256 = "15r019pzr3k0lpgyvdc92c8fayw8b5lrzncna4bqmamcsdz7vsaw"; } 247 - { commit = "98c7bf9ddc80db965d69d61521b1c7a1cec32d9a"; sha256 = "1d7pfdv1q23nf0wadw7jbp6d6r7pnzjpbyxgbdfv7j1vr9l1bp60"; } 248 - { commit = "3dc76b53ad896494ca62550a7a752fecbca3f7a2"; sha256 = "0jvdzfpvfdmklfcjwqblwq1i22iqis7ljpvm7adra5d7zf2xk7xz"; } 249 - { commit = "1e961ed49b18e176c7457f53df2433421387c23b"; sha256 = "04dnqqs4qsvz4g8cq6db5id41kzys7hzhcaycwmc9rpqygs2ajwz"; } 250 - { commit = "e137c72d099f9b3b47f4cc718aa11eab14df1a9c"; sha256 = "1ms0dmz74yf6kwgjfs4d2fhj8y6mcp2n184r3jk44wx2xc24vgb2"; }]) 251 - 252 - ++ optional (atLeast49 && !atLeast9) ./libsanitizer-no-cyclades-9.patch 253 - ++ optional (atLeast49 && !atLeast6) [ 254 - # gcc-11 compatibility 255 - (fetchpatch { 256 - name = "gcc4-char-reload.patch"; 257 - url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58"; 258 - includes = [ "gcc/reload.h" ]; 259 - sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM="; 260 - }) 261 - ] 262 - 263 - # openjdk build fails without this on -march=opteron; is upstream in gcc12 264 - ++ optionals (majorVersion == "11") [ ./11/gcc-issue-103910.patch ] 265 - 266 - ++ optional (majorVersion == "10" && buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch { 267 - url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch"; 268 - sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA="; 269 - }) 270 - ++ lib.optionals (!atLeast49) [ 271 - (fetchpatch { 272 - name = "libc_name_p.diff"; # needed to build with gcc6 273 - url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=ec1cc0263f1"; 274 - sha256 = "01jd7pdarh54ki498g6sz64ijl9a1l5f9v8q2696aaxalvh2vwzl"; 275 - excludes = [ "gcc/cp/ChangeLog" ]; 276 - }) 277 - # glibc-2.26 278 - ./struct-ucontext-4.8.patch 279 - ./sigsegv-not-declared.patch 280 - ./res_state-not-declared.patch 281 - # gcc-11 compatibility 282 - (fetchpatch { 283 - name = "gcc4-char-reload.patch"; 284 - url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58"; 285 - includes = [ "gcc/reload.h" ]; 286 - sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM="; 287 - }) 288 - ]; 289 290 /* Cross-gcc settings (build == host != target) */ 291 crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
··· 89 90 inherit (stdenv) buildPlatform hostPlatform targetPlatform; 91 92 + patches = callFile ./patches {}; 93 94 /* Cross-gcc settings (build == host != target) */ 95 crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
pkgs/development/compilers/gcc/fix-bug-80431.patch pkgs/development/compilers/gcc/patches/fix-bug-80431.patch
pkgs/development/compilers/gcc/gcc-12-gfortran-driving.patch pkgs/development/compilers/gcc/patches/gcc-12-gfortran-driving.patch
pkgs/development/compilers/gcc/gcc-12-no-sys-dirs.patch pkgs/development/compilers/gcc/patches/gcc-12-no-sys-dirs.patch
pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch pkgs/development/compilers/gcc/patches/gfortran-darwin-NXConstStr.patch
pkgs/development/compilers/gcc/gfortran-driving.patch pkgs/development/compilers/gcc/patches/gfortran-driving.patch
pkgs/development/compilers/gcc/gnat-cflags-11.patch pkgs/development/compilers/gcc/patches/gnat-cflags-11.patch
pkgs/development/compilers/gcc/gnat-cflags.patch pkgs/development/compilers/gcc/patches/gnat-cflags.patch
pkgs/development/compilers/gcc/gnat-darwin-dylib-install-name.patch pkgs/development/compilers/gcc/patches/gnat-darwin-dylib-install-name.patch
pkgs/development/compilers/gcc/libgomp-dont-force-initial-exec.patch pkgs/development/compilers/gcc/patches/libgomp-dont-force-initial-exec.patch
pkgs/development/compilers/gcc/libphobos.patch pkgs/development/compilers/gcc/patches/libphobos.patch
pkgs/development/compilers/gcc/libsanitizer-no-cyclades-9.patch pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades-9.patch
pkgs/development/compilers/gcc/libsanitizer-no-cyclades.patch pkgs/development/compilers/gcc/patches/libsanitizer-no-cyclades.patch
pkgs/development/compilers/gcc/libstdc++-netbsd-ctypes.patch pkgs/development/compilers/gcc/patches/libstdc++-netbsd-ctypes.patch
pkgs/development/compilers/gcc/libstdc++-target.patch pkgs/development/compilers/gcc/patches/libstdc++-target.patch
pkgs/development/compilers/gcc/no-sys-dirs-riscv-gcc9.patch pkgs/development/compilers/gcc/patches/no-sys-dirs-riscv-gcc9.patch
pkgs/development/compilers/gcc/no-sys-dirs-riscv.patch pkgs/development/compilers/gcc/patches/no-sys-dirs-riscv.patch
pkgs/development/compilers/gcc/no-sys-dirs.patch pkgs/development/compilers/gcc/patches/no-sys-dirs.patch
pkgs/development/compilers/gcc/parallel-bconfig.patch pkgs/development/compilers/gcc/patches/parallel-bconfig.patch
+235
pkgs/development/compilers/gcc/patches/default.nix
···
··· 1 + { lib, stdenv 2 + , langC 3 + , langAda 4 + , langObjC 5 + , langObjCpp 6 + , langD 7 + , langFortran 8 + , langGo 9 + , reproducibleBuild 10 + , profiledCompiler 11 + , langJit 12 + , staticCompiler 13 + , enableShared 14 + , enableLTO 15 + , version 16 + , fetchpatch 17 + , majorVersion 18 + , targetPlatform 19 + , hostPlatform 20 + , noSysDirs 21 + , buildPlatform 22 + , fetchurl 23 + , withoutTargetLibc 24 + , threadsCross 25 + }: 26 + 27 + let 28 + atLeast13 = lib.versionAtLeast version "13"; 29 + atLeast12 = lib.versionAtLeast version "12"; 30 + atLeast11 = lib.versionAtLeast version "11"; 31 + atLeast10 = lib.versionAtLeast version "10"; 32 + atLeast9 = lib.versionAtLeast version "9"; 33 + atLeast8 = lib.versionAtLeast version "8"; 34 + atLeast7 = lib.versionAtLeast version "7"; 35 + atLeast6 = lib.versionAtLeast version "6"; 36 + atLeast49 = lib.versionAtLeast version "4.9"; 37 + inherit (lib) optionals optional; 38 + in 39 + 40 + optionals (atLeast49 && !atLeast7) [ 41 + ./9/fix-struct-redefinition-on-glibc-2.36.patch 42 + ] ++ optionals (atLeast49 && ((!atLeast7 && !stdenv.targetPlatform.isRedox) || !atLeast6)) [ 43 + ./use-source-date-epoch.patch 44 + ] ++ optionals (atLeast6 && !atLeast7 && !stdenv.targetPlatform.isRedox) [ 45 + ./6/0001-Fix-build-for-glibc-2.31.patch 46 + ] ++ optionals (!atLeast6) [ 47 + ./parallel-bconfig.patch 48 + ] ++ optionals (atLeast49 && !atLeast6) [ 49 + (./. + "/${lib.versions.major version}.${lib.versions.minor version}/parallel-strsignal.patch") 50 + (./. + "/${lib.versions.major version}.${lib.versions.minor version}/libsanitizer.patch") 51 + (fetchpatch { 52 + name = "avoid-ustat-glibc-2.28.patch"; 53 + url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96"; 54 + sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0"; 55 + }) 56 + ] ++ optionals (atLeast7 && !atLeast8) [ 57 + # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html 58 + (./. + "/${majorVersion}/riscv-pthread-reentrant.patch") 59 + # https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html 60 + (./. + "/${majorVersion}/riscv-no-relax.patch") 61 + # Fix for asan w/glibc-2.34. Although there's no upstream backport to v7, 62 + # the patch from gcc 8 seems to work perfectly fine. 63 + (./. + "/${majorVersion}/gcc8-asan-glibc-2.34.patch") 64 + ] ++ optionals (atLeast7 && !atLeast8) [ 65 + (./. + "/${majorVersion}/0001-Fix-build-for-glibc-2.31.patch") 66 + ] ++ optional (majorVersion == "9") ./9/fix-struct-redefinition-on-glibc-2.36.patch 67 + ++ optional (atLeast6 && !atLeast12) ./fix-bug-80431.patch 68 + ++ optional (atLeast7 && !atLeast9) ./9/fix-struct-redefinition-on-glibc-2.36.patch 69 + ++ optional (atLeast10 && !atLeast11) ./11/fix-struct-redefinition-on-glibc-2.36.patch 70 + ++ optional (targetPlatform != hostPlatform) ./libstdc++-target.patch 71 + ++ optional (atLeast7 && !atLeast10 && targetPlatform.isNetBSD) ./libstdc++-netbsd-ctypes.patch 72 + ++ optional (noSysDirs && atLeast12) ./gcc-12-no-sys-dirs.patch 73 + ++ optional (noSysDirs && !atLeast12) ./no-sys-dirs.patch 74 + ++ optional (atLeast6 && !atLeast7 && langAda) ./gnat-cflags.patch 75 + ++ optional (atLeast6 && !atLeast7 && langAda) ./6/gnat-glibc234.patch 76 + ++ optional (noSysDirs && atLeast10 && (is10 || !atLeast12 -> hostPlatform.isRiscV)) ./no-sys-dirs-riscv.patch 77 + ++ optional (noSysDirs && atLeast9 && !atLeast10 && hostPlatform.isRiscV) ./no-sys-dirs-riscv-gcc9.patch 78 + ++ optionals (langAda || atLeast12) [ 79 + ./gnat-cflags-11.patch 80 + ] ++ optionals (langAda && atLeast9 && !atLeast11) [ 81 + ./gnat-cflags.patch 82 + ] ++ optionals atLeast12 [ 83 + ./gcc-12-gfortran-driving.patch 84 + ./ppc-musl.patch 85 + ] ++ optionals (majorVersion == "12") [ 86 + # backport ICE fix on ccache code 87 + ./12/lambda-ICE-PR109241.patch 88 + ] 89 + # We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building 90 + # a foreign one: https://github.com/iains/gcc-12-branch/issues/18 91 + ++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({ 92 + "13" = [ (fetchpatch { 93 + name = "gcc-13-darwin-aarch64-support.patch"; 94 + url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff"; 95 + sha256 = "sha256-Y5r3U3dwAFG6+b0TNCFd18PNxYu2+W/5zDbZ5cHvv+U="; 96 + }) ]; 97 + "12" = [ (fetchurl { 98 + name = "gcc-12-darwin-aarch64-support.patch"; 99 + url = "https://raw.githubusercontent.com/Homebrew/formula-patches/f1188b90d610e2ed170b22512ff7435ba5c891e2/gcc/gcc-12.3.0.diff"; 100 + sha256 = "sha256-naL5ZNiurqfDBiPSU8PTbTmLqj25B+vjjiqc4fAFgYs="; 101 + }) ]; 102 + }."${majorVersion}" or []) 103 + ++ optional (atLeast9 && langD) ./libphobos.patch 104 + ++ optional (atLeast7 && !atLeast8 && hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied 105 + url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; 106 + sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs"; 107 + }) 108 + ++ optional langFortran ../gfortran-driving.patch 109 + ++ optional (!atLeast49 && hostPlatform.isDarwin) ../gfortran-darwin-NXConstStr.patch 110 + ++ optionals (atLeast49 && !atLeast6) [ 111 + # glibc-2.26 112 + ./struct-ucontext.patch 113 + ./struct-sigaltstack-4.9.patch 114 + ] 115 + # TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering 116 + ++ optional (atLeast7 && !atLeast12 && targetPlatform.libc == "musl" && targetPlatform.isPower) ./ppc-musl.patch 117 + ++ optional (atLeast6 && !atLeast8 && targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch { 118 + url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb"; 119 + sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2"; 120 + }) 121 + ++ optional (atLeast6 && atLeast7 && !atLeast9 && targetPlatform.libc == "musl") ./libgomp-dont-force-initial-exec.patch 122 + ++ optional (atLeast6 && !atLeast7 && langGo) ./gogcc-workaround-glibc-2.36.patch 123 + # TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering 124 + ++ optionals (atLeast11 && !atLeast12 && stdenv.isDarwin) [ 125 + (fetchpatch { 126 + # There are no upstream release tags in https://github.com/iains/gcc-11-branch. 127 + # ff4bf32 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.4.0 128 + url = "https://github.com/iains/gcc-11-branch/compare/ff4bf326d03e750a8d4905ea49425fe7d15a04b8..gcc-11.4-darwin-r0.diff"; 129 + hash = "sha256-6prPgR2eGVJs7vKd6iM1eZsEPCD1ShzLns2Z+29vlt4="; 130 + }) 131 + ] 132 + # https://github.com/osx-cross/homebrew-avr/issues/280#issuecomment-1272381808 133 + ++ optional (atLeast11 && !atLeast12 && stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch 134 + 135 + # backport fixes to build gccgo with musl libc 136 + ++ optionals (atLeast12 && langGo && stdenv.hostPlatform.isMusl) [ 137 + (fetchpatch { 138 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 139 + url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff"; 140 + hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I="; 141 + }) 142 + (fetchpatch { 143 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 144 + url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff"; 145 + hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo="; 146 + }) 147 + (fetchpatch { 148 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 149 + url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff"; 150 + hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk="; 151 + }) 152 + (fetchpatch { 153 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 154 + url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff"; 155 + hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo="; 156 + }) 157 + (fetchpatch { 158 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 159 + url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff"; 160 + hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ="; 161 + }) 162 + (fetchpatch { 163 + excludes = [ "gcc/go/gofrontend/MERGE" ]; 164 + url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff"; 165 + hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE="; 166 + }) 167 + (fetchpatch { 168 + url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff"; 169 + hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI="; 170 + }) 171 + ] 172 + 173 + # Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin 174 + ++ optional (atLeast12 && stdenv.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch 175 + 176 + # Use absolute path in GNAT dylib install names on Darwin 177 + ++ optional (atLeast12 && stdenv.isDarwin && langAda) ./gnat-darwin-dylib-install-name.patch 178 + 179 + # Obtain latest patch with ../update-mcfgthread-patches.sh 180 + ++ optional (atLeast6 && !atLeast13 && !withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") 181 + ./Added-mcf-thread-model-support-from-mcfgthread.patch 182 + 183 + # Retpoline patches pulled from the branch hjl/indirect/gcc-4_9-branch (by H.J. Lu, the author of GCC upstream retpoline commits) 184 + ++ optionals (atLeast49 && !atLeast6) (builtins.map ({commit, sha256}: fetchpatch {url = "https://github.com/hjl-tools/gcc/commit/${commit}.patch"; inherit sha256;}) 185 + [{ commit = "e623d21608e96ecd6b65f0d06312117d20488a38"; sha256 = "1ix8i4d2r3ygbv7npmsdj790rhxqrnfwcqzv48b090r9c3ij8ay3"; } 186 + { commit = "2015a09e332309f12de1dadfe179afa6a29368b8"; sha256 = "0xcfs0cbb63llj2gbcdrvxim79ax4k4aswn0a3yjavxsj71s1n91"; } 187 + { commit = "6b11591f4494f705e8746e7d58b7f423191f4e92"; sha256 = "0aydyhsm2ig0khgbp27am7vq7liyqrq6kfhfi2ki0ij0ab1hfbga"; } 188 + { commit = "203c7d9c3e9cb0f88816b481ef8e7e87b3ecc373"; sha256 = "0wqn16y7wy5kg8ngfcni5qdwfphl01axczibbk49bxclwnzvldqa"; } 189 + { commit = "f039c6f284b2c9ce97c8353d6034978795c4872e"; sha256 = "13fkgdb17lpyxfksz1zanxhgpsm0jrss9w61nbl7an4im22hz7ci"; } 190 + { commit = "ed42606bdab1c5d9e5ad828cd6fe1a0557f193b7"; sha256 = "0gdnn8v3p03imj3qga2mzdhpgbmjcklkxdl97jvz5xia2ikzknxm"; } 191 + { commit = "5278e062ef292fd2fbf987d25389785f4c5c0f99"; sha256 = "0j81x758wf8v7j4rx5wc1cy7yhkvhlhv3wmnarwakxiwsspq0vrs"; } 192 + { commit = "76f1ffbbb6cd9f6ecde6c82cd16e20a27242e890"; sha256 = "1py56y6gp7fjf4f8bbsfwh5bs1gnmlqda1ycsmnwlzfm0cshdp0c"; } 193 + { commit = "4ca48b2b688b135c0390f54ea9077ef10aedd52c"; sha256 = "15r019pzr3k0lpgyvdc92c8fayw8b5lrzncna4bqmamcsdz7vsaw"; } 194 + { commit = "98c7bf9ddc80db965d69d61521b1c7a1cec32d9a"; sha256 = "1d7pfdv1q23nf0wadw7jbp6d6r7pnzjpbyxgbdfv7j1vr9l1bp60"; } 195 + { commit = "3dc76b53ad896494ca62550a7a752fecbca3f7a2"; sha256 = "0jvdzfpvfdmklfcjwqblwq1i22iqis7ljpvm7adra5d7zf2xk7xz"; } 196 + { commit = "1e961ed49b18e176c7457f53df2433421387c23b"; sha256 = "04dnqqs4qsvz4g8cq6db5id41kzys7hzhcaycwmc9rpqygs2ajwz"; } 197 + { commit = "e137c72d099f9b3b47f4cc718aa11eab14df1a9c"; sha256 = "1ms0dmz74yf6kwgjfs4d2fhj8y6mcp2n184r3jk44wx2xc24vgb2"; }]) 198 + 199 + ++ optional (atLeast49 && !atLeast9) ./libsanitizer-no-cyclades-9.patch 200 + ++ optional (atLeast49 && !atLeast6) [ 201 + # gcc-11 compatibility 202 + (fetchpatch { 203 + name = "gcc4-char-reload.patch"; 204 + url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58"; 205 + includes = [ "gcc/reload.h" ]; 206 + sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM="; 207 + }) 208 + ] 209 + 210 + # openjdk build fails without this on -march=opteron; is upstream in gcc12 211 + ++ optionals (majorVersion == "11") [ ./11/gcc-issue-103910.patch ] 212 + 213 + ++ optional (majorVersion == "10" && buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch { 214 + url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch"; 215 + sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA="; 216 + }) 217 + ++ lib.optionals (!atLeast49) [ 218 + (fetchpatch { 219 + name = "libc_name_p.diff"; # needed to build with gcc6 220 + url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=ec1cc0263f1"; 221 + sha256 = "01jd7pdarh54ki498g6sz64ijl9a1l5f9v8q2696aaxalvh2vwzl"; 222 + excludes = [ "gcc/cp/ChangeLog" ]; 223 + }) 224 + # glibc-2.26 225 + ./struct-ucontext-4.8.patch 226 + ./sigsegv-not-declared.patch 227 + ./res_state-not-declared.patch 228 + # gcc-11 compatibility 229 + (fetchpatch { 230 + name = "gcc4-char-reload.patch"; 231 + url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58"; 232 + includes = [ "gcc/reload.h" ]; 233 + sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM="; 234 + }) 235 + ]
pkgs/development/compilers/gcc/ppc-musl.patch pkgs/development/compilers/gcc/patches/ppc-musl.patch
pkgs/development/compilers/gcc/res_state-not-declared.patch pkgs/development/compilers/gcc/patches/res_state-not-declared.patch
pkgs/development/compilers/gcc/sigsegv-not-declared.patch pkgs/development/compilers/gcc/patches/sigsegv-not-declared.patch
pkgs/development/compilers/gcc/struct-sigaltstack-4.9.patch pkgs/development/compilers/gcc/patches/struct-sigaltstack-4.9.patch
pkgs/development/compilers/gcc/struct-sigaltstack.patch pkgs/development/compilers/gcc/patches/struct-sigaltstack.patch
pkgs/development/compilers/gcc/struct-ucontext-4.5.patch pkgs/development/compilers/gcc/patches/struct-ucontext-4.5.patch
pkgs/development/compilers/gcc/struct-ucontext-4.8.patch pkgs/development/compilers/gcc/patches/struct-ucontext-4.8.patch
pkgs/development/compilers/gcc/struct-ucontext-libjava.patch pkgs/development/compilers/gcc/patches/struct-ucontext-libjava.patch
pkgs/development/compilers/gcc/struct-ucontext.patch pkgs/development/compilers/gcc/patches/struct-ucontext.patch
pkgs/development/compilers/gcc/update-mcfgthread-patches.sh pkgs/development/compilers/gcc/patches/update-mcfgthread-patches.sh
pkgs/development/compilers/gcc/use-source-date-epoch.patch pkgs/development/compilers/gcc/patches/use-source-date-epoch.patch