lol

gcc11: init at 11.0.0

Pretty much copy-pasted from gcc10 with changed version and sha256.

authored by

Ivan Babrou and committed by
Jonathan Ringer
d75d0b9c 45ada2fb

+621 -1
+306
pkgs/development/compilers/gcc/11/Added-mcf-thread-model-support-from-mcfgthread.patch
··· 1 + From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001 2 + From: Liu Hao <lh_mouse@126.com> 3 + Date: Wed, 25 Apr 2018 21:54:19 +0800 4 + Subject: [PATCH] Added 'mcf' thread model support from mcfgthread. 5 + 6 + Signed-off-by: Liu Hao <lh_mouse@126.com> 7 + --- 8 + config/gthr.m4 | 1 + 9 + gcc/config.gcc | 3 +++ 10 + gcc/config/i386/mingw-mcfgthread.h | 1 + 11 + gcc/config/i386/mingw-w64.h | 2 +- 12 + gcc/config/i386/mingw32.h | 11 ++++++++++- 13 + gcc/configure | 2 +- 14 + gcc/configure.ac | 2 +- 15 + libatomic/configure.tgt | 2 +- 16 + libgcc/config.host | 6 ++++++ 17 + libgcc/config/i386/gthr-mcf.h | 1 + 18 + libgcc/config/i386/t-mingw-mcfgthread | 2 ++ 19 + libgcc/configure | 1 + 20 + libstdc++-v3/configure | 1 + 21 + libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++ 22 + libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++ 23 + libstdc++-v3/src/c++11/thread.cc | 9 +++++++++ 24 + 16 files changed, 80 insertions(+), 5 deletions(-) 25 + create mode 100644 gcc/config/i386/mingw-mcfgthread.h 26 + create mode 100644 libgcc/config/i386/gthr-mcf.h 27 + create mode 100644 libgcc/config/i386/t-mingw-mcfgthread 28 + 29 + diff --git a/config/gthr.m4 b/config/gthr.m4 30 + index 7b29f1f3327..82e21fe1709 100644 31 + --- a/config/gthr.m4 32 + +++ b/config/gthr.m4 33 + @@ -21,6 +21,7 @@ case $1 in 34 + tpf) thread_header=config/s390/gthr-tpf.h ;; 35 + vxworks) thread_header=config/gthr-vxworks.h ;; 36 + win32) thread_header=config/i386/gthr-win32.h ;; 37 + + mcf) thread_header=config/i386/gthr-mcf.h ;; 38 + esac 39 + AC_SUBST(thread_header) 40 + ]) 41 + diff --git a/gcc/config.gcc b/gcc/config.gcc 42 + index 46a9029acec..112c24e95a3 100644 43 + --- a/gcc/config.gcc 44 + +++ b/gcc/config.gcc 45 + @@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) 46 + if test x$enable_threads = xposix ; then 47 + tm_file="${tm_file} i386/mingw-pthread.h" 48 + fi 49 + + if test x$enable_threads = xmcf ; then 50 + + tm_file="${tm_file} i386/mingw-mcfgthread.h" 51 + + fi 52 + tm_file="${tm_file} i386/mingw32.h" 53 + # This makes the logic if mingw's or the w64 feature set has to be used 54 + case ${target} in 55 + diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h 56 + new file mode 100644 57 + index 00000000000..ec381a7798f 58 + --- /dev/null 59 + +++ b/gcc/config/i386/mingw-mcfgthread.h 60 + @@ -0,0 +1 @@ 61 + +#define TARGET_USE_MCFGTHREAD 1 62 + diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h 63 + index 484dc7a9e9f..a15bbeea500 100644 64 + --- a/gcc/config/i386/mingw-w64.h 65 + +++ b/gcc/config/i386/mingw-w64.h 66 + @@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see 67 + "%{mwindows:-lgdi32 -lcomdlg32} " \ 68 + "%{fvtable-verify=preinit:-lvtv -lpsapi; \ 69 + fvtable-verify=std:-lvtv -lpsapi} " \ 70 + - "-ladvapi32 -lshell32 -luser32 -lkernel32" 71 + + LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32" 72 + 73 + #undef SPEC_32 74 + #undef SPEC_64 75 + diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h 76 + index 0612b87199a..76cea94f3b7 100644 77 + --- a/gcc/config/i386/mingw32.h 78 + +++ b/gcc/config/i386/mingw32.h 79 + @@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see 80 + | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \ 81 + | MASK_MS_BITFIELD_LAYOUT) 82 + 83 + +#ifndef TARGET_USE_MCFGTHREAD 84 + +#define CPP_MCFGTHREAD() ((void)0) 85 + +#define LIB_MCFGTHREAD "" 86 + +#else 87 + +#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__")) 88 + +#define LIB_MCFGTHREAD " -lmcfgthread " 89 + +#endif 90 + + 91 + /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS 92 + is for compatibility with native compiler. */ 93 + #define EXTRA_OS_CPP_BUILTINS() \ 94 + @@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see 95 + builtin_define_std ("WIN64"); \ 96 + builtin_define ("_WIN64"); \ 97 + } \ 98 + + CPP_MCFGTHREAD(); \ 99 + } \ 100 + while (0) 101 + 102 + @@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see 103 + "%{mwindows:-lgdi32 -lcomdlg32} " \ 104 + "%{fvtable-verify=preinit:-lvtv -lpsapi; \ 105 + fvtable-verify=std:-lvtv -lpsapi} " \ 106 + - "-ladvapi32 -lshell32 -luser32 -lkernel32" 107 + + LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32" 108 + 109 + /* Weak symbols do not get resolved if using a Windows dll import lib. 110 + Make the unwind registration references strong undefs. */ 111 + diff --git a/gcc/configure b/gcc/configure 112 + index 6121e163259..52f0e00efe6 100755 113 + --- a/gcc/configure 114 + +++ b/gcc/configure 115 + @@ -11693,7 +11693,7 @@ case ${enable_threads} in 116 + target_thread_file='single' 117 + ;; 118 + aix | dce | lynx | mipssde | posix | rtems | \ 119 + - single | tpf | vxworks | win32) 120 + + single | tpf | vxworks | win32 | mcf) 121 + target_thread_file=${enable_threads} 122 + ;; 123 + *) 124 + diff --git a/gcc/configure.ac b/gcc/configure.ac 125 + index b066cc609e1..4ecdba88de7 100644 126 + --- a/gcc/configure.ac 127 + +++ b/gcc/configure.ac 128 + @@ -1612,7 +1612,7 @@ case ${enable_threads} in 129 + target_thread_file='single' 130 + ;; 131 + aix | dce | lynx | mipssde | posix | rtems | \ 132 + - single | tpf | vxworks | win32) 133 + + single | tpf | vxworks | win32 | mcf) 134 + target_thread_file=${enable_threads} 135 + ;; 136 + *) 137 + diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt 138 + index ea8c34f8c71..23134ad7363 100644 139 + --- a/libatomic/configure.tgt 140 + +++ b/libatomic/configure.tgt 141 + @@ -145,7 +145,7 @@ case "${target}" in 142 + *-*-mingw*) 143 + # OS support for atomic primitives. 144 + case ${target_thread_file} in 145 + - win32) 146 + + win32 | mcf) 147 + config_path="${config_path} mingw" 148 + ;; 149 + posix) 150 + diff --git a/libgcc/config.host b/libgcc/config.host 151 + index 11b4acaff55..9fbd38650bd 100644 152 + --- a/libgcc/config.host 153 + +++ b/libgcc/config.host 154 + @@ -737,6 +737,9 @@ i[34567]86-*-mingw*) 155 + posix) 156 + tmake_file="i386/t-mingw-pthread $tmake_file" 157 + ;; 158 + + mcf) 159 + + tmake_file="i386/t-mingw-mcfgthread $tmake_file" 160 + + ;; 161 + esac 162 + # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h 163 + if test x$ac_cv_sjlj_exceptions = xyes; then 164 + @@ -761,6 +764,9 @@ x86_64-*-mingw*) 165 + posix) 166 + tmake_file="i386/t-mingw-pthread $tmake_file" 167 + ;; 168 + + mcf) 169 + + tmake_file="i386/t-mingw-mcfgthread $tmake_file" 170 + + ;; 171 + esac 172 + # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h 173 + if test x$ac_cv_sjlj_exceptions = xyes; then 174 + diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h 175 + new file mode 100644 176 + index 00000000000..5ea2908361f 177 + --- /dev/null 178 + +++ b/libgcc/config/i386/gthr-mcf.h 179 + @@ -0,0 +1 @@ 180 + +#include <mcfgthread/gthread.h> 181 + diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread 182 + new file mode 100644 183 + index 00000000000..4b9b10e32d6 184 + --- /dev/null 185 + +++ b/libgcc/config/i386/t-mingw-mcfgthread 186 + @@ -0,0 +1,2 @@ 187 + +SHLIB_PTHREAD_CFLAG = 188 + +SHLIB_PTHREAD_LDFLAG = -lmcfgthread 189 + diff --git a/libgcc/configure b/libgcc/configure 190 + index b2f3f870844..eff889dc3b3 100644 191 + --- a/libgcc/configure 192 + +++ b/libgcc/configure 193 + @@ -5451,6 +5451,7 @@ case $target_thread_file in 194 + tpf) thread_header=config/s390/gthr-tpf.h ;; 195 + vxworks) thread_header=config/gthr-vxworks.h ;; 196 + win32) thread_header=config/i386/gthr-win32.h ;; 197 + + mcf) thread_header=config/i386/gthr-mcf.h ;; 198 + esac 199 + 200 + 201 + diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure 202 + index ba094be6f15..979a5ab9ace 100755 203 + --- a/libstdc++-v3/configure 204 + +++ b/libstdc++-v3/configure 205 + @@ -15187,6 +15187,7 @@ case $target_thread_file in 206 + tpf) thread_header=config/s390/gthr-tpf.h ;; 207 + vxworks) thread_header=config/gthr-vxworks.h ;; 208 + win32) thread_header=config/i386/gthr-win32.h ;; 209 + + mcf) thread_header=config/i386/gthr-mcf.h ;; 210 + esac 211 + 212 + 213 + diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc 214 + index de920d714c6..665fb74bd6b 100644 215 + --- a/libstdc++-v3/libsupc++/atexit_thread.cc 216 + +++ b/libstdc++-v3/libsupc++/atexit_thread.cc 217 + @@ -25,6 +25,22 @@ 218 + #include <cstdlib> 219 + #include <new> 220 + #include "bits/gthr.h" 221 + + 222 + +#ifdef __USING_MCFGTHREAD__ 223 + + 224 + +#include <mcfgthread/gthread.h> 225 + + 226 + +extern "C" int 227 + +__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), 228 + + void *obj, void *dso_handle) 229 + + _GLIBCXX_NOTHROW 230 + +{ 231 + + return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1; 232 + + (void)dso_handle; 233 + +} 234 + + 235 + +#else // __USING_MCFGTHREAD__ 236 + + 237 + #ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 238 + #define WIN32_LEAN_AND_MEAN 239 + #include <windows.h> 240 + @@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha 241 + } 242 + 243 + #endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ 244 + + 245 + +#endif // __USING_MCFGTHREAD__ 246 + diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc 247 + index 3a2ec3ad0d6..8b4cc96199b 100644 248 + --- a/libstdc++-v3/libsupc++/guard.cc 249 + +++ b/libstdc++-v3/libsupc++/guard.cc 250 + @@ -28,6 +28,27 @@ 251 + #include <cxxabi.h> 252 + #include <exception> 253 + #include <new> 254 + + 255 + +#ifdef __USING_MCFGTHREAD__ 256 + + 257 + +#include <mcfgthread/gthread.h> 258 + + 259 + +namespace __cxxabiv1 { 260 + + 261 + +extern "C" int __cxa_guard_acquire(__guard *g){ 262 + + return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial; 263 + +} 264 + +extern "C" void __cxa_guard_abort(__guard *g) throw() { 265 + + ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g); 266 + +} 267 + +extern "C" void __cxa_guard_release(__guard *g) throw() { 268 + + ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g); 269 + +} 270 + + 271 + +} 272 + + 273 + +#else // __USING_MCFGTHREAD__ 274 + + 275 + #include <ext/atomicity.h> 276 + #include <ext/concurrence.h> 277 + #include <bits/atomic_lockfree_defines.h> 278 + @@ -425,3 +446,5 @@ namespace __cxxabiv1 279 + #endif 280 + } 281 + } 282 + + 283 + +#endif 284 + diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc 285 + index 8238817c2e9..0c6a1f85f6f 100644 286 + --- a/libstdc++-v3/src/c++11/thread.cc 287 + +++ b/libstdc++-v3/src/c++11/thread.cc 288 + @@ -55,6 +55,15 @@ static inline int get_nprocs() 289 + #elif defined(_GLIBCXX_USE_SC_NPROC_ONLN) 290 + # include <unistd.h> 291 + # define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN) 292 + +#elif defined(_WIN32) 293 + +# include <windows.h> 294 + +static inline int get_nprocs() 295 + +{ 296 + + SYSTEM_INFO sysinfo; 297 + + GetSystemInfo(&sysinfo); 298 + + return (int)sysinfo.dwNumberOfProcessors; 299 + +} 300 + +# define _GLIBCXX_NPROCS get_nprocs() 301 + #else 302 + # define _GLIBCXX_NPROCS 0 303 + #endif 304 + -- 305 + 2.17.0 306 +
+299
pkgs/development/compilers/gcc/11/default.nix
··· 1 + { lib, stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs 2 + , langC ? true, langCC ? true, langFortran ? false 3 + , langAda ? false 4 + , langObjC ? stdenv.targetPlatform.isDarwin 5 + , langObjCpp ? stdenv.targetPlatform.isDarwin 6 + , langGo ? false 7 + , reproducibleBuild ? true 8 + , profiledCompiler ? false 9 + , langJit ? false 10 + , staticCompiler ? false 11 + , # N.B. the defult is intentionally not from an `isStatic`. See 12 + # https://gcc.gnu.org/install/configure.html - this is about target 13 + # platform libraries not host platform ones unlike normal. But since 14 + # we can't rebuild those without also rebuilding the compiler itself, 15 + # we opt to always build everything unlike our usual policy. 16 + enableShared ? true 17 + , enableLTO ? true 18 + , texinfo ? null 19 + , perl ? null # optional, for texi2pod (then pod2man) 20 + , gmp, mpfr, libmpc, gettext, which, patchelf 21 + , libelf # optional, for link-time optimizations (LTO) 22 + , isl ? null # optional, for the Graphite optimization framework. 23 + , zlib ? null 24 + , gnatboot ? null 25 + , enableMultilib ? false 26 + , enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins 27 + , name ? "gcc" 28 + , libcCross ? null 29 + , threadsCross ? null # for MinGW 30 + , crossStageStatic ? false 31 + , # Strip kills static libs of other archs (hence no cross) 32 + stripped ? stdenv.hostPlatform.system == stdenv.buildPlatform.system 33 + && stdenv.targetPlatform.system == stdenv.hostPlatform.system 34 + , gnused ? null 35 + , cloog # unused; just for compat with gcc4, as we override the parameter on some places 36 + , buildPackages 37 + }: 38 + 39 + # LTO needs libelf and zlib. 40 + assert libelf != null -> zlib != null; 41 + 42 + # Make sure we get GNU sed. 43 + assert stdenv.hostPlatform.isDarwin -> gnused != null; 44 + 45 + # The go frontend is written in c++ 46 + assert langGo -> langCC; 47 + assert langAda -> gnatboot != null; 48 + 49 + # threadsCross is just for MinGW 50 + assert threadsCross != null -> stdenv.targetPlatform.isWindows; 51 + 52 + # profiledCompiler builds inject non-determinism in one of the compilation stages. 53 + # If turned on, we can't provide reproducible builds anymore 54 + assert reproducibleBuild -> profiledCompiler == false; 55 + 56 + with lib; 57 + with builtins; 58 + 59 + let majorVersion = "11"; 60 + version = "${majorVersion}.1.0"; 61 + 62 + inherit (stdenv) buildPlatform hostPlatform targetPlatform; 63 + 64 + patches = 65 + optional (targetPlatform != hostPlatform) ../libstdc++-target.patch 66 + ++ optional noSysDirs ../no-sys-dirs.patch 67 + /* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied 68 + url = "https://git.busybox.net/buildroot/plain/package/gcc/${version}/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; 69 + sha256 = ""; # TODO: uncomment and check hash when available. 70 + }) */ 71 + ++ optional langAda ../gnat-cflags.patch 72 + ++ optional langFortran ../gfortran-driving.patch 73 + ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch 74 + 75 + # Obtain latest patch with ../update-mcfgthread-patches.sh 76 + ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; 77 + 78 + /* Cross-gcc settings (build == host != target) */ 79 + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; 80 + stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; 81 + crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; 82 + 83 + in 84 + 85 + stdenv.mkDerivation ({ 86 + pname = "${crossNameAddon}${name}${if stripped then "" else "-debug"}"; 87 + inherit version; 88 + 89 + builder = ../builder.sh; 90 + 91 + src = fetchurl { 92 + url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"; 93 + sha256 = "1pwxrjhsymv90xzh0x42cxfnmhjinf2lnrrf3hj5jq1rm2w6yjjc"; 94 + }; 95 + 96 + inherit patches; 97 + 98 + outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib"; 99 + setOutputFlags = false; 100 + NIX_NO_SELF_RPATH = true; 101 + 102 + libc_dev = stdenv.cc.libc_dev; 103 + 104 + hardeningDisable = [ "format" "pie" ]; 105 + 106 + # This should kill all the stdinc frameworks that gcc and friends like to 107 + # insert into default search paths. 108 + prePatch = lib.optionalString hostPlatform.isDarwin '' 109 + substituteInPlace gcc/config/darwin-c.c \ 110 + --replace 'if (stdinc)' 'if (0)' 111 + 112 + substituteInPlace libgcc/config/t-slibgcc-darwin \ 113 + --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name ''${!outputLib}/lib/\$(SHLIB_INSTALL_NAME)" 114 + 115 + substituteInPlace libgfortran/configure \ 116 + --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 117 + ''; 118 + 119 + postPatch = '' 120 + configureScripts=$(find . -name configure) 121 + for configureScript in $configureScripts; do 122 + patchShebangs $configureScript 123 + done 124 + '' + ( 125 + if targetPlatform != hostPlatform || stdenv.cc.libc != null then 126 + # On NixOS, use the right path to the dynamic linker instead of 127 + # `/lib/ld*.so'. 128 + let 129 + libc = if libcCross != null then libcCross else stdenv.cc.libc; 130 + in 131 + ( 132 + '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..." 133 + for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h 134 + do 135 + grep -q _DYNAMIC_LINKER "$header" || continue 136 + echo " fixing \`$header'..." 137 + sed -i "$header" \ 138 + -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \ 139 + -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g' 140 + done 141 + '' 142 + + lib.optionalString (targetPlatform.libc == "musl") 143 + '' 144 + sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' 145 + '' 146 + ) 147 + else "") 148 + + lib.optionalString targetPlatform.isAvr '' 149 + makeFlagsArray+=( 150 + 'LIMITS_H_TEST=false' 151 + ) 152 + ''; 153 + 154 + inherit noSysDirs staticCompiler crossStageStatic 155 + libcCross crossMingw; 156 + 157 + depsBuildBuild = [ buildPackages.stdenv.cc ]; 158 + nativeBuildInputs = [ texinfo which gettext ] 159 + ++ (optional (perl != null) perl); 160 + 161 + # For building runtime libs 162 + depsBuildTarget = 163 + ( 164 + if hostPlatform == buildPlatform then [ 165 + targetPackages.stdenv.cc.bintools # newly-built gcc will be used 166 + ] else assert targetPlatform == hostPlatform; [ # build != host == target 167 + stdenv.cc 168 + ] 169 + ) 170 + ++ optional targetPlatform.isLinux patchelf; 171 + 172 + buildInputs = [ 173 + gmp mpfr libmpc libelf 174 + targetPackages.stdenv.cc.bintools # For linking code at run-time 175 + ] ++ (optional (isl != null) isl) 176 + ++ (optional (zlib != null) zlib) 177 + # The builder relies on GNU sed (for instance, Darwin's `sed' fails with 178 + # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. 179 + ++ (optional hostPlatform.isDarwin gnused) 180 + ++ (optional langAda gnatboot) 181 + ; 182 + 183 + depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross; 184 + 185 + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; 186 + 187 + preConfigure = import ../common/pre-configure.nix { 188 + inherit lib; 189 + inherit version hostPlatform gnatboot langAda langGo langJit; 190 + }; 191 + 192 + dontDisableStatic = true; 193 + 194 + configurePlatforms = [ "build" "host" "target" ]; 195 + 196 + configureFlags = import ../common/configure-flags.nix { 197 + inherit 198 + lib 199 + stdenv 200 + targetPackages 201 + crossStageStatic libcCross 202 + version 203 + 204 + gmp mpfr libmpc libelf isl 205 + 206 + enableLTO 207 + enableMultilib 208 + enablePlugin 209 + enableShared 210 + 211 + langC 212 + langCC 213 + langFortran 214 + langAda 215 + langGo 216 + langObjC 217 + langObjCpp 218 + langJit 219 + ; 220 + }; 221 + 222 + targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; 223 + 224 + buildFlags = optional 225 + (targetPlatform == hostPlatform && hostPlatform == buildPlatform) 226 + (if profiledCompiler then "profiledbootstrap" else "bootstrap"); 227 + 228 + dontStrip = !stripped; 229 + 230 + installTargets = optional stripped "install-strip"; 231 + 232 + # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 233 + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; 234 + 235 + # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the 236 + # library headers and binaries, regarless of the language being compiled. 237 + # 238 + # Likewise, the LTO code doesn't find zlib. 239 + # 240 + # Cross-compiling, we need gcc not to read ./specs in order to build the g++ 241 + # compiler (after the specs for the cross-gcc are created). Having 242 + # LIBRARY_PATH= makes gcc read the specs from ., and the build breaks. 243 + 244 + CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([] 245 + ++ optional (zlib != null) zlib 246 + )); 247 + 248 + LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); 249 + 250 + inherit 251 + (import ../common/extra-target-flags.nix { 252 + inherit lib stdenv crossStageStatic libcCross threadsCross; 253 + }) 254 + EXTRA_FLAGS_FOR_TARGET 255 + EXTRA_LDFLAGS_FOR_TARGET 256 + ; 257 + 258 + passthru = { 259 + inherit langC langCC langObjC langObjCpp langAda langFortran langGo version; 260 + isGNU = true; 261 + }; 262 + 263 + enableParallelBuilding = true; 264 + inherit enableMultilib; 265 + 266 + inherit (stdenv) is64bit; 267 + 268 + meta = { 269 + homepage = "https://gcc.gnu.org/"; 270 + license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ 271 + description = "GNU Compiler Collection, version ${version}" 272 + + (if stripped then "" else " (with debugging info)"); 273 + 274 + longDescription = '' 275 + The GNU Compiler Collection includes compiler front ends for C, C++, 276 + Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as 277 + libraries for these languages (libstdc++, libgomp,...). 278 + 279 + GCC development is a part of the GNU Project, aiming to improve the 280 + compiler used in the GNU system including the GNU/Linux variant. 281 + ''; 282 + 283 + maintainers = with lib.maintainers; [ synthetica ]; 284 + 285 + platforms = 286 + lib.platforms.linux ++ 287 + lib.platforms.freebsd ++ 288 + lib.platforms.illumos ++ 289 + lib.platforms.darwin; 290 + }; 291 + } 292 + 293 + // optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { 294 + makeFlags = [ "all-gcc" "all-target-libgcc" ]; 295 + installTargets = "install-gcc install-target-libgcc"; 296 + } 297 + 298 + // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } 299 + )
+16 -1
pkgs/top-level/all-packages.nix
··· 10312 10312 gcc8Stdenv = overrideCC gccStdenv buildPackages.gcc8; 10313 10313 gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9; 10314 10314 gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10; 10315 + gcc11Stdenv = overrideCC gccStdenv buildPackages.gcc11; 10315 10316 10316 10317 wrapCCMulti = cc: 10317 10318 if stdenv.targetPlatform.system == "x86_64-linux" then let ··· 10498 10499 isl = if !stdenv.isDarwin then isl_0_20 else null; 10499 10500 })); 10500 10501 10501 - gcc_latest = gcc10; 10502 + gcc11 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/11 { 10503 + inherit noSysDirs; 10504 + 10505 + reproducibleBuild = true; 10506 + profiledCompiler = false; 10507 + 10508 + enableLTO = !stdenv.isi686; 10509 + 10510 + libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null; 10511 + threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null; 10512 + 10513 + isl = if !stdenv.isDarwin then isl_0_20 else null; 10514 + })); 10515 + 10516 + gcc_latest = gcc11; 10502 10517 10503 10518 gfortran = gfortran9; 10504 10519