mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
llvm 6: Fix libcxxabi impurity and darwin sanitizers
This commit is contained in:
parent
1eacf21bd4
commit
fc9644d4c9
@ -1,4 +1,4 @@
|
||||
{ stdenv, version, fetch, cmake, python, llvm }:
|
||||
{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
|
||||
with stdenv.lib;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "compiler-rt-${version}";
|
||||
@ -6,12 +6,13 @@ stdenv.mkDerivation rec {
|
||||
src = fetch "compiler-rt" "16m7rvh3w6vq10iwkjrr1nn293djld3xm62l5zasisaprx117k6h";
|
||||
|
||||
nativeBuildInputs = [ cmake python llvm ];
|
||||
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
configureFlags = [
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
];
|
||||
|
||||
outputs = [ "dev" "out" ];
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
@ -27,5 +28,10 @@ stdenv.mkDerivation rec {
|
||||
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
}
|
||||
|
@ -23,9 +23,19 @@ let
|
||||
|
||||
tools = stdenv.lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
|
||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
in {
|
||||
|
||||
llvm = overrideManOutput (callPackage ./llvm.nix { });
|
||||
|
||||
clang-unwrapped = overrideManOutput (callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
});
|
||||
@ -38,16 +48,11 @@ let
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
extraPackages = [ libstdcxxHook targetLlvmLibraries.compiler-rt ];
|
||||
extraBuildCommands = ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
|
||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
extraPackages = [
|
||||
libstdcxxHook
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
libcxxClang = wrapCCWith rec {
|
||||
@ -57,15 +62,7 @@ let
|
||||
targetLlvmLibraries.libcxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
|
||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lld = callPackage ./lld.nix {};
|
||||
|
@ -3,7 +3,7 @@ with stdenv.lib;
|
||||
let
|
||||
# Sanitizers are not supported on Darwin.
|
||||
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
|
||||
sanitizersBroken = stdenv.isDarwin || stdenv.cc.isClang && builtins.compareVersions (getVersion stdenv.cc.name) "6.0.0" < 0;
|
||||
sanitizersBroken = stdenv.cc.isClang && versionOlder (getVersion stdenv.cc.name) "6.0.0";
|
||||
in stdenv.mkDerivation {
|
||||
name = "cc-wrapper-test";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user