Merge branch 'staging' into glibc230

This commit is contained in:
Maximilian Bosch
2020-02-01 17:42:03 +01:00
265 changed files with 3902 additions and 3038 deletions
+41 -9
View File
@@ -58,16 +58,17 @@ let
outputs = [ "out" "lib" "bin" ];
# we are almost able to run the full test suite now
postPatch = ''
substituteInPlace src/crystal/system/unix/time.cr \
--replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
ln -s spec/compiler spec/std
mkdir /tmp/crystal
substituteInPlace spec/std/file_spec.cr \
--replace '/bin/ls' '${coreutils}/bin/ls' \
--replace '/usr/share' '/tmp/test'
--replace '/usr/share' '/tmp/crystal' \
--replace '/usr' '/tmp'
substituteInPlace spec/std/process_spec.cr \
--replace '/bin/cat' '${coreutils}/bin/cat' \
@@ -76,8 +77,23 @@ let
--replace '"env"' '"${coreutils}/bin/env"' \
--replace '"/usr"' '"/tmp"'
substituteInPlace spec/std/socket/tcp_server_spec.cr \
--replace '{% if flag?(:gnu) %}"listen: "{% else %}"bind: "{% end %}' '"bind: "'
substituteInPlace spec/std/system_spec.cr \
--replace '`hostname`' '`${nettools}/bin/hostname`'
# See https://github.com/crystal-lang/crystal/pull/8640
substituteInPlace spec/std/http/cookie_spec.cr \
--replace '01 Jan 2020' '01 Jan #{Time.utc.year + 2}'
# See https://github.com/crystal-lang/crystal/issues/8629
substituteInPlace spec/std/socket/udp_socket_spec.cr \
--replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"'
# See https://github.com/crystal-lang/crystal/pull/8699
substituteInPlace spec/std/xml/xml_spec.cr \
--replace 'it "handles errors"' 'pending "handles errors"'
'';
buildInputs = commonBuildInputs extraBuildInputs;
@@ -189,6 +205,24 @@ in rec {
};
};
binaryCrystal_0_30 = genericBinary {
version = "0.30.1";
sha256s = {
x86_64-linux = "1k2mb74jh3ns3m7y73j4wpf571sayn73zbn6d7q81d09r280zrma";
i686-linux = "0vsq1ayf922spydp2g2mmimc797jmm7nl5nljhfppcclrwygdyk2";
x86_64-darwin = "1p3s4lwdgykb7h7aysjhrs7vm0zhinzw5d7rfv6jsyin4j8yxhzz";
};
};
binaryCrystal_0_31 = genericBinary {
version = "0.31.1";
sha256s = {
x86_64-linux = "0r8salf572xrnr4m6ll9q5hz6jj8q7ff1rljlhmqb1r26a8mi2ih";
i686-linux = "0hridnis5vvrswflx0q67xfg5hryhz6ivlwrb9n4pryj5d1gwjrr";
x86_64-darwin = "1dgxgv0s3swkc5cwawzgpbc6bcd2nx4hjxc7iw2h907y1vgmbipz";
};
};
crystal_0_25 = generic {
version = "0.25.1";
sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
@@ -228,18 +262,16 @@ in rec {
version = "0.31.1";
sha256 = "1dswxa32w16gnc6yjym12xj7ibg0g6zk3ngvl76lwdjqb1h6lwz8";
doCheck = false; # 5 checks are failing now
binary = crystal_0_30;
binary = binaryCrystal_0_30;
};
crystal_0_32 = generic {
version = "255bfc5fa925b95b72e34b26ad997fb2b3f83059";
sha256 = "1dgk36cj5lwhs1c4zp0s1c9hjk0h3vljq6zwhlnzkl1xs7cgzim1";
doCheck = false; # 5 checks are failing now
binary = crystal_0_31;
extraBuildInputs = [ readline ];
version = "0.32.1";
sha256 = "120ndi3nhh2r52hjvhwfb49cdggr1bzdq6b8xg7irzavhjinfza6";
binary = binaryCrystal_0_31;
};
crystal = crystal_0_31;
crystal = crystal_0_32;
crystal2nix = callPackage ./crystal2nix.nix {};
}
@@ -2,8 +2,6 @@
, callPackage
, fetchurl
, gcc48
, gcc49
, gcc5
, gcc6
, gcc7
}:
@@ -29,14 +27,14 @@ in rec {
version = "7.0.28";
url = "http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run";
sha256 = "1km5hpiimx11jcazg0h3mjzk220klwahs2vfqhjavpds5ff2wafi";
gcc = gcc49;
gcc = gcc6;
};
cudatoolkit_7_5 = common {
version = "7.5.18";
url = "http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run";
sha256 = "1v2ylzp34ijyhcxyh5p6i0cwawwbbdhni2l5l4qm21s1cx9ish88";
gcc = gcc49;
gcc = gcc6;
};
cudatoolkit_8 = common {
@@ -49,7 +47,7 @@ in rec {
sha256 = "1iaz5rrsnsb1p99qiqvxn6j3ksc7ry8xlr397kqcjzxqbljbqn9d";
})
];
gcc = gcc5;
gcc = gcc6;
};
cudatoolkit_9_0 = common {
@@ -61,7 +61,13 @@ let majorVersion = "4";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches =
[ ../use-source-date-epoch.patch ../parallel-bconfig.patch ./parallel-strsignal.patch ]
[ ../use-source-date-epoch.patch ../parallel-bconfig.patch ./parallel-strsignal.patch
(fetchpatch {
name = "avoid-ustat-glibc-2.28.patch";
url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96";
sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0";
})
]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional langFortran ../gfortran-driving.patch
@@ -1,328 +0,0 @@
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langJava ? false
, langGo ? false
, profiledCompiler ? false
, staticCompiler ? false
, enableShared ? true
, enableLTO ? true
, texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man); required for Java
, gmp, mpfr, libmpc, gettext, which
, libelf # optional, for link-time optimizations (LTO)
, isl ? null # optional, for the Graphite optimization framework.
, zlib ? null, boehmgc ? null
, zip ? null, unzip ? null, pkgconfig ? null
, gtk2 ? null, libart_lgpl ? null
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
, libXrender ? null, xorgproto ? null
, libXrandr ? null, libXi ? null
, x11Support ? langJava
, enableMultilib ? false
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc"
, libcCross ? null
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
, gnused ? null
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
, buildPackages
}:
assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null
&& perl != null; # for `--enable-java-home'
# LTO needs libelf and zlib.
assert libelf != null -> zlib != null;
# Make sure we get GNU sed.
assert stdenv.hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
with stdenv.lib;
with builtins;
let majorVersion = "5";
version = "${majorVersion}.5.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches =
[ ../use-source-date-epoch.patch ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
++ optional stdenv.hostPlatform.isMusl (fetchpatch {
url = https://raw.githubusercontent.com/richfelker/musl-cross-make/e84b1bd1fc12a3def33111ca6df522cd6e5ec361/patches/gcc-5.3.0/0001-musl.diff;
sha256 = "0pppbf8myi2kjhm3z3479ihn1cm60kycfv60gj8yy1bs0pl1qcfm";
})
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "074bl5n27d1ksa31pvzj4vd8xd46r118k0w94gdv3s1vydg7mah0";
});
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
# `configure' time.
# XXX: Eventually we might want to take it from upstream.
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
};
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
# binary distribution here to allow the whole chain to be bootstrapped.
javaAntlr = fetchurl {
url = https://www.antlr.org/download/antlr-4.4-complete.jar;
sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
};
xlibs = [
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
xorgproto
];
javaAwtGtk = langJava && x11Support;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
in
# We need all these X libraries when building AWT with GTK.
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
stdenv.mkDerivation ({
pname = "${crossNameAddon}${name}${if stripped then "" else "-debug"}";
inherit version;
builder = ../builder.sh;
src = fetchurl {
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
sha256 = "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k";
};
inherit patches;
outputs = [ "out" "lib" "man" "info" ];
setOutputFlags = false;
NIX_NO_SELF_RPATH = true;
libc_dev = stdenv.cc.libc_dev;
hardeningDisable = [ "format" "pie" ];
# This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths.
prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
substituteInPlace gcc/config/darwin-c.c \
--replace 'if (stdinc)' 'if (0)'
substituteInPlace libgcc/config/t-slibgcc-darwin \
--replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
substituteInPlace libgfortran/configure \
--replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
'';
postPatch =
if targetPlatform != hostPlatform || stdenv.cc.libc != null then
# On NixOS, use the right path to the dynamic linker instead of
# `/lib/ld*.so'.
let
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
(
'' 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 _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:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done
''
+ stdenv.lib.optionalString (targetPlatform.libc == "musl")
''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
''
)
else null;
inherit noSysDirs staticCompiler langJava crossStageStatic
libcCross crossMingw;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ texinfo which gettext ]
++ (optional (perl != null) perl)
++ (optional javaAwtGtk pkgconfig);
# For building runtime libs
depsBuildTarget =
if hostPlatform == buildPlatform then [
targetPackages.stdenv.cc.bintools # newly-built gcc will be used
] else assert targetPlatform == hostPlatform; [ # build != host == target
stdenv.cc
];
buildInputs = [
gmp mpfr libmpc libelf
targetPackages.stdenv.cc.bintools # For linking code at run-time
] ++ (optional (isl != null) isl)
++ (optional (zlib != null) zlib)
++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
inherit (stdenv) lib;
inherit version hostPlatform langJava langGo;
};
dontDisableStatic = true;
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
configureFlags = import ../common/configure-flags.nix {
inherit
stdenv
targetPackages
crossStageStatic libcCross
version
gmp mpfr libmpc libelf isl
enableLTO
enableMultilib
enablePlugin
enableShared
langC
langCC
langFortran
langJava javaAwtGtk javaAntlr javaEcj
langGo
langObjC
langObjCpp
;
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
dontStrip = !stripped;
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
installTargets = optional stripped "install-strip";
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
# library headers and binaries, regarless of the language being compiled.
#
# Note: When building the Java AWT GTK peer, the build system doesn't honor
# `--with-gmp' et al., e.g., when building
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
# them to $CPATH and $LIBRARY_PATH in this case.
#
# Likewise, the LTO code doesn't find zlib.
#
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
# compiler (after the specs for the cross-gcc are created). Having
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
++ optional (zlib != null) zlib
++ optional langJava boehmgc
++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]
));
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
++ optional (zlib != null) zlib
++ optional langJava boehmgc
++ optionals javaAwtGtk xlibs
++ optionals javaAwtGtk [ gmp mpfr ]
));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;
isGNU = true;
};
enableParallelBuilding = true;
inherit enableMultilib;
inherit (stdenv) is64bit;
meta = {
homepage = https://gcc.gnu.org/;
license = stdenv.lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
description = "GNU Compiler Collection, version ${version}"
+ (if stripped then "" else " (with debugging info)");
longDescription = ''
The GNU Compiler Collection includes compiler front ends for C, C++,
Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
as libraries for these languages (libstdc++, libgcj, libgomp,...).
GCC development is a part of the GNU Project, aiming to improve the
compiler used in the GNU system including the GNU/Linux variant.
'';
maintainers = with stdenv.lib.maintainers; [ peti ];
platforms =
stdenv.lib.platforms.linux ++
stdenv.lib.platforms.freebsd ++
stdenv.lib.platforms.illumos ++
stdenv.lib.platforms.darwin;
badPlatforms = [ "x86_64-darwin" ];
};
}
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
)
@@ -0,0 +1,68 @@
From 8412cba68835f8f4cc527d02194b181faa5944d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
Date: Tue, 21 Jan 2020 19:46:09 +0100
Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
This change replaces the manual building of executable paths
using llvm::sys::path::append with GetProgramPath.
This enables adding other paths in case executables reside
in different directories and makes the code easier to read.
Differential Revision: https://reviews.llvm.org/D72903
---
clang/lib/Driver/ToolChains/HIP.cpp | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/lib/Driver/ToolChains/HIP.cpp b/lib/Driver/ToolChains/HIP.cpp
index 03acf45a9b3..75fd3226c75 100644
--- a/lib/Driver/ToolChains/HIP.cpp
+++ b/lib/Driver/ToolChains/HIP.cpp
@@ -98,9 +98,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpName));
CmdArgs.push_back(OutputFileName);
- SmallString<128> ExecPath(C.getDriver().Dir);
- llvm::sys::path::append(ExecPath, "llvm-link");
- const char *Exec = Args.MakeArgString(ExecPath);
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
return OutputFileName;
}
@@ -141,9 +140,8 @@ const char *AMDGCN::Linker::constructOptCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
OptArgs.push_back(OutputFileName);
- SmallString<128> OptPath(C.getDriver().Dir);
- llvm::sys::path::append(OptPath, "opt");
- const char *OptExec = Args.MakeArgString(OptPath);
+ const char *OptExec =
+ Args.MakeArgString(getToolChain().GetProgramPath("opt"));
C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
return OutputFileName;
}
@@ -161,9 +159,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
const char *LlcOutputFile =
C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
LlcArgs.push_back(LlcOutputFile);
- SmallString<128> LlcPath(C.getDriver().Dir);
- llvm::sys::path::append(LlcPath, "llc");
- const char *Llc = Args.MakeArgString(LlcPath);
+ const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
return LlcOutputFile;
}
@@ -178,9 +174,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
ArgStringList LldArgs{"-flavor", "gnu", "--no-undefined",
"-shared", "-o", Output.getFilename(),
InputFileName};
- SmallString<128> LldPath(C.getDriver().Dir);
- llvm::sys::path::append(LldPath, "lld");
- const char *Lld = Args.MakeArgString(LldPath);
+ const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
}
--
2.23.1
@@ -1,4 +1,4 @@
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -22,7 +22,7 @@ let
nativeBuildInputs = [ cmake python3 ]
++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
buildInputs = [ libxml2 llvm ]
buildInputs = [ libxml2 llvm lld ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
cmakeFlags = [
@@ -38,7 +38,11 @@ let
"-DLINK_POLLY_INTO_TOOLS=ON"
];
patches = [ ./purity.patch ];
patches = [
./purity.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-7.patch
];
postPatch = ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
@@ -32,6 +32,7 @@ let
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
clang-unwrapped = callPackage ./clang {
inherit (tools) lld;
inherit clang-tools-extra_src;
};
clang-polly-unwrapped = callPackage ./clang {
@@ -0,0 +1,80 @@
From d9f1b7d7571b252e0ba2359ae6cfa93a9903c0e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
Date: Tue, 21 Jan 2020 19:49:44 +0100
Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
This change replaces the manual building of executable paths
using llvm::sys::path::append with GetProgramPath.
This enables adding other paths in case executables reside
in different directories and makes the code easier to read.
Differential Revision: https://reviews.llvm.org/D72903
---
clang/lib/Driver/ToolChains/HIP.cpp | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/lib/Driver/ToolChains/HIP.cpp b/lang/lib/Driver/ToolChains/HIP.cpp
index 868765cf88e..31f2d68ec6c 100644
--- a/lib/Driver/ToolChains/HIP.cpp
+++ b/lib/Driver/ToolChains/HIP.cpp
@@ -104,9 +104,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpName));
CmdArgs.push_back(OutputFileName);
- SmallString<128> ExecPath(C.getDriver().Dir);
- llvm::sys::path::append(ExecPath, "llvm-link");
- const char *Exec = Args.MakeArgString(ExecPath);
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
return OutputFileName;
}
@@ -147,9 +146,8 @@ const char *AMDGCN::Linker::constructOptCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
OptArgs.push_back(OutputFileName);
- SmallString<128> OptPath(C.getDriver().Dir);
- llvm::sys::path::append(OptPath, "opt");
- const char *OptExec = Args.MakeArgString(OptPath);
+ const char *OptExec =
+ Args.MakeArgString(getToolChain().GetProgramPath("opt"));
C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
return OutputFileName;
}
@@ -167,9 +165,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
const char *LlcOutputFile =
C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
LlcArgs.push_back(LlcOutputFile);
- SmallString<128> LlcPath(C.getDriver().Dir);
- llvm::sys::path::append(LlcPath, "llc");
- const char *Llc = Args.MakeArgString(LlcPath);
+ const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
return LlcOutputFile;
}
@@ -184,9 +180,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
ArgStringList LldArgs{"-flavor", "gnu", "--no-undefined",
"-shared", "-o", Output.getFilename(),
InputFileName};
- SmallString<128> LldPath(C.getDriver().Dir);
- llvm::sys::path::append(LldPath, "lld");
- const char *Lld = Args.MakeArgString(LldPath);
+ const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
}
@@ -218,9 +212,8 @@ void AMDGCN::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
Args.MakeArgString(std::string("-outputs=").append(OutputFileName));
BundlerArgs.push_back(BundlerOutputArg);
- SmallString<128> BundlerPath(C.getDriver().Dir);
- llvm::sys::path::append(BundlerPath, "clang-offload-bundler");
- const char *Bundler = Args.MakeArgString(BundlerPath);
+ const char *Bundler = Args.MakeArgString(
+ T.getToolChain().GetProgramPath("clang-offload-bundler"));
C.addCommand(llvm::make_unique<Command>(JA, T, Bundler, BundlerArgs, Inputs));
}
--
2.23.1
@@ -1,4 +1,4 @@
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -22,7 +22,7 @@ let
nativeBuildInputs = [ cmake python3 ]
++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
buildInputs = [ libxml2 llvm ]
buildInputs = [ libxml2 llvm lld ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
cmakeFlags = [
@@ -50,6 +50,8 @@ let
./unwindlib.patch
# https://reviews.llvm.org/D51899
./compiler-rt-baremetal.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-8.patch
];
postPatch = ''
@@ -32,6 +32,7 @@ let
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
clang-unwrapped = callPackage ./clang {
inherit (tools) lld;
inherit clang-tools-extra_src;
};
clang-polly-unwrapped = callPackage ./clang {
@@ -0,0 +1,80 @@
From 7147e9774c74abcd1d6db24e24d0fd989c2b97dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
Date: Tue, 21 Jan 2020 19:52:04 +0100
Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
This change replaces the manual building of executable paths
using llvm::sys::path::append with GetProgramPath.
This enables adding other paths in case executables reside
in different directories and makes the code easier to read.
Differential Revision: https://reviews.llvm.org/D72903
---
clang/lib/Driver/ToolChains/HIP.cpp | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/lib/Driver/ToolChains/HIP.cpp b/lib/Driver/ToolChains/HIP.cpp
index 2ec97e798fd..735c302debb 100644
--- a/lib/Driver/ToolChains/HIP.cpp
+++ b/lib/Driver/ToolChains/HIP.cpp
@@ -66,9 +66,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpName));
CmdArgs.push_back(OutputFileName);
- SmallString<128> ExecPath(C.getDriver().Dir);
- llvm::sys::path::append(ExecPath, "llvm-link");
- const char *Exec = Args.MakeArgString(ExecPath);
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
return OutputFileName;
}
@@ -114,9 +113,8 @@ const char *AMDGCN::Linker::constructOptCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
OptArgs.push_back(OutputFileName);
- SmallString<128> OptPath(C.getDriver().Dir);
- llvm::sys::path::append(OptPath, "opt");
- const char *OptExec = Args.MakeArgString(OptPath);
+ const char *OptExec =
+ Args.MakeArgString(getToolChain().GetProgramPath("opt"));
C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
return OutputFileName;
}
@@ -156,9 +154,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
const char *LlcOutputFile =
C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
LlcArgs.push_back(LlcOutputFile);
- SmallString<128> LlcPath(C.getDriver().Dir);
- llvm::sys::path::append(LlcPath, "llc");
- const char *Llc = Args.MakeArgString(LlcPath);
+ const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
return LlcOutputFile;
}
@@ -172,9 +168,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
// The output from ld.lld is an HSA code object file.
ArgStringList LldArgs{
"-flavor", "gnu", "-shared", "-o", Output.getFilename(), InputFileName};
- SmallString<128> LldPath(C.getDriver().Dir);
- llvm::sys::path::append(LldPath, "lld");
- const char *Lld = Args.MakeArgString(LldPath);
+ const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
}
@@ -206,9 +200,8 @@ void AMDGCN::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
Args.MakeArgString(std::string("-outputs=").append(OutputFileName));
BundlerArgs.push_back(BundlerOutputArg);
- SmallString<128> BundlerPath(C.getDriver().Dir);
- llvm::sys::path::append(BundlerPath, "clang-offload-bundler");
- const char *Bundler = Args.MakeArgString(BundlerPath);
+ const char *Bundler = Args.MakeArgString(
+ T.getToolChain().GetProgramPath("clang-offload-bundler"));
C.addCommand(llvm::make_unique<Command>(JA, T, Bundler, BundlerArgs, Inputs));
}
--
2.23.1
@@ -1,4 +1,4 @@
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -22,7 +22,7 @@ let
nativeBuildInputs = [ cmake python3 ]
++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
buildInputs = [ libxml2 llvm ]
buildInputs = [ libxml2 llvm lld ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
cmakeFlags = [
@@ -43,6 +43,8 @@ let
./purity.patch
# https://reviews.llvm.org/D51899
./compiler-rt-baremetal.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-9.patch
];
postPatch = ''
@@ -32,6 +32,7 @@ let
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
clang-unwrapped = callPackage ./clang {
inherit (tools) lld;
inherit clang-tools-extra_src;
};
clang-polly-unwrapped = callPackage ./clang {
+2 -2
View File
@@ -5,11 +5,11 @@
stdenv.mkDerivation rec {
pname = "nim";
version = "1.0.4";
version = "1.0.6";
src = fetchurl {
url = "https://nim-lang.org/download/${pname}-${version}.tar.xz";
sha256 = "1q5fx9g40bk4ajghi856w5l34fmrl7avq5j6p0dr2xa4l52ib149";
sha256 = "1cv6bxc7w21455c0pv0r2h64ljyzw266jsk1fsgiiyk2rx8mfkhk";
};
enableParallelBuilding = true;
+9 -6
View File
@@ -1,13 +1,16 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, zlib }:
stdenv.mkDerivation {
name = "picat-1.9-4";
pname = "picat";
version = "2.8-2";
src = fetchurl {
url = http://picat-lang.org/download/picat19_src.tar.gz;
sha256 = "0wvl95gf4pjs93632g4wi0mw1glzzhjp9g4xg93ll2zxggbxibli";
url = http://picat-lang.org/download/picat28_src.tar.gz;
sha256 = "10hf2fxxbpq28gi39icr8c9wafdiy9ddfkk6l4rx7kkqyrdi7n85";
};
buildInputs = [ zlib ];
ARCH = if stdenv.hostPlatform.system == "i686-linux" then "linux32"
else if stdenv.hostPlatform.system == "x86_64-linux" then "linux64"
else throw "Unsupported system";
@@ -16,12 +19,12 @@ stdenv.mkDerivation {
buildPhase = ''
cd emu
make -f Makefile.picat.$ARCH
make -f Makefile.$ARCH
'';
installPhase = ''
mkdir -p $out/bin
cp picat_$ARCH $out/bin/picat
cp picat $out/bin/picat
'';
meta = {
+2 -2
View File
@@ -10,11 +10,11 @@
stdenv.mkDerivation rec {
pname = "sbcl";
version = "1.5.6";
version = "2.0.1";
src = fetchurl {
url = "mirror://sourceforge/project/sbcl/sbcl/${version}/${pname}-${version}-source.tar.bz2";
sha256 = "10z43dc29p7s8dl3jixklhmzqfp7gcm3fccjdfd36qqhyfxqxx3a";
sha256 = "1s2nrq26czl7f8jpa9qjpmdqbzvldvf4c7c1z1c438v4f85xcl44";
};
buildInputs = [texinfo];