Merge #171830: gcc12, gfortran12, gnat12: init at 12.1.0

+684 -1
+306
pkgs/development/compilers/gcc/12/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 + +namespace __cxxabiv1 { 226 + +extern "C" int 227 + +__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *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 +
+294
pkgs/development/compilers/gcc/12/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 + , enableShared ? !stdenv.targetPlatform.isStatic 12 + , enableLTO ? !stdenv.hostPlatform.isStatic 13 + , texinfo ? null 14 + , perl ? null # optional, for texi2pod (then pod2man) 15 + , gmp, mpfr, libmpc, gettext, which, patchelf 16 + , libelf # optional, for link-time optimizations (LTO) 17 + , isl ? null # optional, for the Graphite optimization framework. 18 + , zlib ? null 19 + , gnatboot ? null 20 + , enableMultilib ? false 21 + , enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins 22 + , name ? "gcc" 23 + , libcCross ? null 24 + , threadsCross ? null # for MinGW 25 + , crossStageStatic ? false 26 + , # Strip kills static libs of other archs (hence no cross) 27 + stripped ? stdenv.hostPlatform.system == stdenv.buildPlatform.system 28 + && stdenv.targetPlatform.system == stdenv.hostPlatform.system 29 + , gnused ? null 30 + , cloog # unused; just for compat with gcc4, as we override the parameter on some places 31 + , buildPackages 32 + }: 33 + 34 + # LTO needs libelf and zlib. 35 + assert libelf != null -> zlib != null; 36 + 37 + # Make sure we get GNU sed. 38 + assert stdenv.hostPlatform.isDarwin -> gnused != null; 39 + 40 + # The go frontend is written in c++ 41 + assert langGo -> langCC; 42 + assert langAda -> gnatboot != null; 43 + 44 + # threadsCross is just for MinGW 45 + assert threadsCross != null -> stdenv.targetPlatform.isWindows; 46 + 47 + # profiledCompiler builds inject non-determinism in one of the compilation stages. 48 + # If turned on, we can't provide reproducible builds anymore 49 + assert reproducibleBuild -> profiledCompiler == false; 50 + 51 + with lib; 52 + with builtins; 53 + 54 + let majorVersion = "12"; 55 + version = "${majorVersion}.1.0"; 56 + 57 + inherit (stdenv) buildPlatform hostPlatform targetPlatform; 58 + 59 + patches = 60 + optional (targetPlatform != hostPlatform) ../libstdc++-target.patch 61 + ++ optional noSysDirs ../gcc-12-no-sys-dirs.patch 62 + ++ optional noSysDirs ../no-sys-dirs-riscv.patch 63 + ++ [ 64 + ../gnat-cflags-11.patch 65 + ../gcc-12-gfortran-driving.patch 66 + ../ppc-musl.patch 67 + ] ++ optional (stdenv.isDarwin && stdenv.isAarch64) (fetchpatch { 68 + url = "https://github.com/fxcoudert/gcc/compare/releases/gcc-11.1.0...gcc-11.1.0-arm-20210504.diff"; 69 + sha256 = "sha256-JqCGJAfbOxSmkNyq49aFHteK/RFsCSLQrL9mzUCnaD0="; 70 + }) 71 + 72 + # Obtain latest patch with ../update-mcfgthread-patches.sh 73 + ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; 74 + 75 + /* Cross-gcc settings (build == host != target) */ 76 + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; 77 + stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; 78 + crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; 79 + 80 + in 81 + 82 + stdenv.mkDerivation ({ 83 + pname = "${crossNameAddon}${name}${if stripped then "" else "-debug"}"; 84 + inherit version; 85 + 86 + builder = ../builder.sh; 87 + 88 + src = fetchurl { 89 + url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"; 90 + sha256 = "sha256-Yv1jSInzHAK2SvLEaPBktHrRynhBHEWr5qxLX43RnHs="; 91 + }; 92 + 93 + inherit patches; 94 + 95 + outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib"; 96 + setOutputFlags = false; 97 + NIX_NO_SELF_RPATH = true; 98 + 99 + libc_dev = stdenv.cc.libc_dev; 100 + 101 + hardeningDisable = [ "format" "pie" ]; 102 + 103 + postPatch = '' 104 + configureScripts=$(find . -name configure) 105 + for configureScript in $configureScripts; do 106 + patchShebangs $configureScript 107 + done 108 + '' 109 + # This should kill all the stdinc frameworks that gcc and friends like to 110 + # insert into default search paths. 111 + + lib.optionalString hostPlatform.isDarwin '' 112 + substituteInPlace gcc/config/darwin-c.c \ 113 + --replace 'if (stdinc)' 'if (0)' 114 + 115 + substituteInPlace libgcc/config/t-slibgcc-darwin \ 116 + --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name ''${!outputLib}/lib/\$(SHLIB_INSTALL_NAME)" 117 + 118 + substituteInPlace libgfortran/configure \ 119 + --replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" 120 + '' 121 + + ( 122 + if targetPlatform != hostPlatform || stdenv.cc.libc != null then 123 + # On NixOS, use the right path to the dynamic linker instead of 124 + # `/lib/ld*.so'. 125 + let 126 + libc = if libcCross != null then libcCross else stdenv.cc.libc; 127 + in 128 + ( 129 + '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..." 130 + for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h 131 + do 132 + grep -q _DYNAMIC_LINKER "$header" || continue 133 + echo " fixing \`$header'..." 134 + sed -i "$header" \ 135 + -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \ 136 + -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g' 137 + done 138 + '' 139 + + lib.optionalString (targetPlatform.libc == "musl") 140 + '' 141 + sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' 142 + '' 143 + ) 144 + else "") 145 + + lib.optionalString targetPlatform.isAvr '' 146 + makeFlagsArray+=( 147 + '-s' # workaround for hitting hydra log limit 148 + 'LIMITS_H_TEST=false' 149 + ) 150 + ''; 151 + 152 + inherit noSysDirs staticCompiler crossStageStatic 153 + libcCross crossMingw; 154 + 155 + depsBuildBuild = [ buildPackages.stdenv.cc ]; 156 + nativeBuildInputs = [ texinfo which gettext ] 157 + ++ (optional (perl != null) perl) 158 + ++ (optional langAda gnatboot) 159 + ; 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 + ; 181 + 182 + depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross; 183 + 184 + NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; 185 + 186 + preConfigure = import ../common/pre-configure.nix { 187 + inherit lib; 188 + inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit; 189 + }; 190 + 191 + dontDisableStatic = true; 192 + 193 + configurePlatforms = [ "build" "host" "target" ]; 194 + 195 + configureFlags = import ../common/configure-flags.nix { 196 + inherit 197 + lib 198 + stdenv 199 + targetPackages 200 + crossStageStatic libcCross 201 + version 202 + 203 + gmp mpfr libmpc libelf isl 204 + 205 + enableLTO 206 + enableMultilib 207 + enablePlugin 208 + enableShared 209 + 210 + langC 211 + langCC 212 + langFortran 213 + langAda 214 + langGo 215 + langObjC 216 + langObjCpp 217 + langJit 218 + ; 219 + }; 220 + 221 + targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; 222 + 223 + buildFlags = optional 224 + (targetPlatform == hostPlatform && hostPlatform == buildPlatform) 225 + (if profiledCompiler then "profiledbootstrap" else "bootstrap"); 226 + 227 + dontStrip = !stripped; 228 + 229 + installTargets = optional stripped "install-strip"; 230 + 231 + # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 232 + ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64"; 233 + 234 + # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the 235 + # library headers and binaries, regarless of the language being compiled. 236 + # 237 + # Likewise, the LTO code doesn't find zlib. 238 + # 239 + # Cross-compiling, we need gcc not to read ./specs in order to build the g++ 240 + # compiler (after the specs for the cross-gcc are created). Having 241 + # LIBRARY_PATH= makes gcc read the specs from ., and the build breaks. 242 + 243 + CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([] 244 + ++ optional (zlib != null) zlib 245 + )); 246 + 247 + LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); 248 + 249 + inherit 250 + (import ../common/extra-target-flags.nix { 251 + inherit lib stdenv crossStageStatic libcCross threadsCross; 252 + }) 253 + EXTRA_FLAGS_FOR_TARGET 254 + EXTRA_LDFLAGS_FOR_TARGET 255 + ; 256 + 257 + passthru = { 258 + inherit langC langCC langObjC langObjCpp langAda langFortran langGo version; 259 + isGNU = true; 260 + }; 261 + 262 + enableParallelBuilding = true; 263 + inherit enableShared enableMultilib; 264 + 265 + inherit (stdenv) is64bit; 266 + 267 + meta = { 268 + homepage = "https://gcc.gnu.org/"; 269 + license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+ 270 + description = "GNU Compiler Collection, version ${version}" 271 + + (if stripped then "" else " (with debugging info)"); 272 + 273 + longDescription = '' 274 + The GNU Compiler Collection includes compiler front ends for C, C++, 275 + Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as 276 + libraries for these languages (libstdc++, libgomp,...). 277 + 278 + GCC development is a part of the GNU Project, aiming to improve the 279 + compiler used in the GNU system including the GNU/Linux variant. 280 + ''; 281 + 282 + maintainers = lib.teams.gcc.members; 283 + 284 + platforms = lib.platforms.unix; 285 + }; 286 + } 287 + 288 + // optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { 289 + makeFlags = [ "all-gcc" "all-target-libgcc" ]; 290 + installTargets = "install-gcc install-target-libgcc"; 291 + } 292 + 293 + // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } 294 + )
+20
pkgs/development/compilers/gcc/gcc-12-gfortran-driving.patch
··· 1 + This patch fixes interaction with Libtool. 2 + See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, for details. 3 + 4 + --- a/gcc/fortran/gfortranspec.cc 5 + +++ b/gcc/fortran/gfortranspec.cc 6 + @@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n")); 7 + { 8 + fprintf (stderr, _("Driving:")); 9 + for (i = 0; i < g77_newargc; i++) 10 + + { 11 + + if (g77_new_decoded_options[i].opt_index == OPT_l) 12 + + /* Make sure no white space is inserted after `-l'. */ 13 + + fprintf (stderr, " -l%s", 14 + + g77_new_decoded_options[i].canonical_option[1]); 15 + + else 16 + fprintf (stderr, " %s", 17 + g77_new_decoded_options[i].orig_option_with_args_text); 18 + + } 19 + fprintf (stderr, "\n"); 20 + }
+26
pkgs/development/compilers/gcc/gcc-12-no-sys-dirs.patch
··· 1 + --- a/gcc/cppdefault.cc 2013-01-10 21:38:27.000000000 +0100 2 + +++ b/gcc/cppdefault.cc 2014-08-18 16:20:32.893944536 +0200 3 + @@ -35,6 +35,8 @@ 4 + # undef CROSS_INCLUDE_DIR 5 + #endif 6 + 7 + +#undef LOCAL_INCLUDE_DIR 8 + + 9 + const struct default_include cpp_include_defaults[] 10 + #ifdef INCLUDE_DEFAULTS 11 + = INCLUDE_DEFAULTS; 12 + --- a/gcc/gcc.cc 2014-03-23 12:30:57.000000000 +0100 13 + +++ b/gcc/gcc.cc 2014-08-18 13:19:32.689201690 +0200 14 + @@ -1162,10 +1162,10 @@ 15 + /* Default prefixes to attach to command names. */ 16 + 17 + #ifndef STANDARD_STARTFILE_PREFIX_1 18 + -#define STANDARD_STARTFILE_PREFIX_1 "/lib/" 19 + +#define STANDARD_STARTFILE_PREFIX_1 "" 20 + #endif 21 + #ifndef STANDARD_STARTFILE_PREFIX_2 22 + -#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" 23 + +#define STANDARD_STARTFILE_PREFIX_2 "" 24 + #endif 25 + 26 + #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
+38 -1
pkgs/top-level/all-packages.nix
··· 12522 12522 gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9; 12523 12523 gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10; 12524 12524 gcc11Stdenv = overrideCC gccStdenv buildPackages.gcc11; 12525 + gcc12Stdenv = overrideCC gccStdenv buildPackages.gcc12; 12525 12526 12526 12527 # This is not intended for use in nixpkgs but for providing a faster-running 12527 12528 # compiler to nixpkgs users by building gcc with reproducibility-breaking ··· 12717 12718 isl = if !stdenv.isDarwin then isl_0_20 else null; 12718 12719 })); 12719 12720 12720 - gcc_latest = gcc11; 12721 + gcc12 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/12 { 12722 + inherit noSysDirs; 12723 + 12724 + reproducibleBuild = true; 12725 + profiledCompiler = false; 12726 + 12727 + libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null; 12728 + threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null; 12729 + 12730 + isl = if !stdenv.isDarwin then isl_0_20 else null; 12731 + })); 12732 + 12733 + gcc_latest = gcc12; 12721 12734 12722 12735 # Use the same GCC version as the one from stdenv by default 12723 12736 gfortran = wrapCC (gcc.cc.override { ··· 12792 12805 profiledCompiler = false; 12793 12806 }); 12794 12807 12808 + gfortran12 = wrapCC (gcc12.cc.override { 12809 + name = "gfortran"; 12810 + langFortran = true; 12811 + langCC = false; 12812 + langC = false; 12813 + profiledCompiler = false; 12814 + }); 12815 + 12795 12816 libgccjit = gcc.cc.override { 12796 12817 name = "libgccjit"; 12797 12818 langFortran = false; ··· 12879 12900 && stdenv.buildPlatform == stdenv.hostPlatform 12880 12901 then buildPackages.gnat6 12881 12902 else buildPackages.gnat11; 12903 + }); 12904 + 12905 + gnat12 = wrapCC (gcc12.cc.override { 12906 + name = "gnat"; 12907 + langC = true; 12908 + langCC = false; 12909 + langAda = true; 12910 + profiledCompiler = false; 12911 + # As per upstream instructions building a cross compiler 12912 + # should be done with a (native) compiler of the same version. 12913 + # If we are cross-compiling GNAT, we may as well do the same. 12914 + gnatboot = 12915 + if stdenv.hostPlatform == stdenv.targetPlatform 12916 + && stdenv.buildPlatform == stdenv.hostPlatform 12917 + then buildPackages.gnat6 12918 + else buildPackages.gnat12; 12882 12919 }); 12883 12920 12884 12921 gnatboot = wrapCC (callPackage ../development/compilers/gnatboot { });