diff options
Diffstat (limited to 'pkgs/development/compilers/gcc/7')
-rw-r--r-- | pkgs/development/compilers/gcc/7/default.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 15ddd9e70091..bbf87eccac75 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -1,4 +1,4 @@ -{ stdenv, targetPackages, fetchurl, noSysDirs +{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs , langC ? true, langCC ? true, langFortran ? false , langObjC ? targetPlatform.isDarwin , langObjCpp ? targetPlatform.isDarwin @@ -66,6 +66,10 @@ let version = "7.3.0"; [ ] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional noSysDirs ../no-sys-dirs.patch + ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied + url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; + sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs"; + }) # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its # target libraries and tools. ++ optional langAda ../gnat-cflags.patch @@ -155,7 +159,7 @@ let version = "7.3.0"; # To keep ABI compatibility with upstream mingw-w64 "--enable-fully-dynamic-string" ] else - optionals (targetPlatform.libc == "uclibc") [ + optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [ # libsanitizer requires netrom/netrom.h which is not # available in uclibc. "--disable-libsanitizer" @@ -253,15 +257,22 @@ stdenv.mkDerivation ({ let libc = if libcCross != null then libcCross else stdenv.cc.libc; in - '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..." + ( + '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..." for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h do - grep -q LIBC_DYNAMIC_LINKER "$header" || continue + grep -q _DYNAMIC_LINKER "$header" || continue echo " fixing \`$header'..." sed -i "$header" \ - -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' + -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \ + -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g' done '' + + stdenv.lib.optionalString (hostPlatform.libc == "musl") + '' + sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' + '' + ) else null; # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, @@ -391,6 +402,7 @@ stdenv.mkDerivation ({ # On Illumos/Solaris GNU as is preferred "--with-gnu-as" "--without-gnu-ld" ] + ++ optional (targetPlatform == hostPlatform && targetPlatform.libc == "musl") "--disable-libsanitizer" ; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; |