llvmPackages_rocm: add compiler-rt
Co-Authored-By: acowley <acowley@users.noreply.github.com>
This commit is contained in:
parent
abfdb24af0
commit
e4459e59a2
@ -0,0 +1,33 @@
|
||||
From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001
|
||||
From: Will Dietz <w@wdtz.org>
|
||||
Date: Tue, 19 Sep 2017 13:13:06 -0500
|
||||
Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that
|
||||
needs it
|
||||
|
||||
---
|
||||
cmake/Modules/AddCompilerRT.cmake | 8 ------
|
||||
test/asan/CMakeLists.txt | 52 ---------------------------------------
|
||||
test/tsan/CMakeLists.txt | 47 -----------------------------------
|
||||
3 files changed, 107 deletions(-)
|
||||
|
||||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||
index bc5fb9ff7..b64eb4246 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type)
|
||||
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
|
||||
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
|
||||
endif()
|
||||
- if(APPLE)
|
||||
- # Ad-hoc sign the dylibs
|
||||
- add_custom_command(TARGET ${libname}
|
||||
- POST_BUILD
|
||||
- COMMAND codesign --sign - $<TARGET_FILE:${libname}>
|
||||
- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
|
||||
- )
|
||||
- endif()
|
||||
endif()
|
||||
install(TARGETS ${libname}
|
||||
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
|
||||
2.14.1
|
||||
|
57
pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix
Normal file
57
pkgs/development/compilers/llvm/rocm/compiler-rt/default.nix
Normal file
@ -0,0 +1,57 @@
|
||||
{ stdenv, lib, version, src, cmake, python3, llvm, libcxxabi }:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "compiler-rt";
|
||||
inherit version src;
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
];
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
||||
# a flag and turn the flag off during the stdenv build.
|
||||
postPatch = lib.optionalString (!stdenv.isDarwin) ''
|
||||
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
||||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{ lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith }:
|
||||
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
|
||||
|
||||
let
|
||||
version = "4.1.0";
|
||||
@ -23,12 +23,33 @@ in rec {
|
||||
'';
|
||||
};
|
||||
|
||||
clangNoCompilerRt = wrapCCWith rec {
|
||||
cc = clang-unwrapped;
|
||||
extraBuildCommands = ''
|
||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
||||
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
||||
rm $out/nix-support/add-hardening.sh
|
||||
touch $out/nix-support/add-hardening.sh
|
||||
'';
|
||||
};
|
||||
|
||||
clang-unwrapped = callPackage ./clang.nix {
|
||||
inherit lld llvm version;
|
||||
src = "${src}/clang";
|
||||
};
|
||||
|
||||
lld = callPackage ./lld {
|
||||
compiler-rt = callPackage ./compiler-rt {
|
||||
inherit version llvm;
|
||||
src = "${src}/compiler-rt";
|
||||
stdenv = overrideCC stdenv clangNoCompilerRt;
|
||||
};
|
||||
|
||||
lld = callPackage ./lld.nix {
|
||||
inherit llvm version;
|
||||
src = "${src}/lld";
|
||||
buildLlvmTools = buildPackages.llvmPackages_rocm;
|
||||
|
Loading…
Reference in New Issue
Block a user