Merge staging-next into staging
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, bootstrap_cmds, coreutils, glibc, m4 }:
|
||||
{ stdenv, fetchurl, bootstrap_cmds, coreutils, glibc, m4, runtimeShell }:
|
||||
|
||||
let
|
||||
options = rec {
|
||||
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
|
||||
cp -r . "$out/share/ccl-installation"
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
echo -e '#!${stdenv.shell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}"
|
||||
echo -e '#!${runtimeShell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}"
|
||||
chmod a+x "$out"/bin/"${CCL_RUNTIME}"
|
||||
ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl
|
||||
'';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchurl, python }:
|
||||
{ stdenv, fetchurl, python, runtimeShell }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "cmdstan-2.17.1";
|
||||
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
|
||||
ln -s $out/opt/cmdstan/bin/stanc $out/bin/stanc
|
||||
ln -s $out/opt/cmdstan/bin/stansummary $out/bin/stansummary
|
||||
cat > $out/bin/stan <<EOF
|
||||
#!${stdenv.shell}
|
||||
#!${runtimeShell}
|
||||
make -C $out/opt/cmdstan "\$(realpath "\$1")"
|
||||
EOF
|
||||
chmod a+x $out/bin/stan
|
||||
|
||||
@@ -2,30 +2,32 @@
|
||||
, gmp, openssl, readline, tzdata, libxml2, libyaml
|
||||
, boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib }:
|
||||
|
||||
let
|
||||
binaryVersion = "0.26.0";
|
||||
releaseDate = "2018-08-29";
|
||||
# We need multiple binaries as a given binary isn't always able to build
|
||||
# (even slightly) older or newer version.
|
||||
# - 0.26.1 can build 0.25.x and 0.26.x but not 0.27.x
|
||||
# - 0.27.2 can build 0.27.x but not 0.25.x and 0.26.x
|
||||
#
|
||||
# We need to keep around at least the latest version released with a stable
|
||||
# NixOS
|
||||
|
||||
arch = {
|
||||
let
|
||||
archs = {
|
||||
"x86_64-linux" = "linux-x86_64";
|
||||
"i686-linux" = "linux-i686";
|
||||
"x86_64-darwin" = "darwin-x86_64";
|
||||
}."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
|
||||
};
|
||||
|
||||
arch = archs."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
|
||||
|
||||
checkInputs = [ gmp openssl readline libxml2 libyaml tzdata ];
|
||||
|
||||
# we could turn this into a function instead in case we cannot use the same
|
||||
# binary to build multiple versions
|
||||
binary = stdenv.mkDerivation rec {
|
||||
name = "crystal-binary-${binaryVersion}";
|
||||
genericBinary = { version, sha256s, rel ? 1 }:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "crystal-binary-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/crystal-lang/crystal/releases/download/${binaryVersion}/crystal-${binaryVersion}-1-${arch}.tar.gz";
|
||||
sha256 = {
|
||||
"x86_64-linux" = "1xban102yiiwmlklxvn3xp3q546bp8hlxxpakayajkhhnpl6yv45";
|
||||
"i686-linux" = "1igspf1lrv7wpmz0pfrkbx8m1ykvnv4zhic53cav4nicppm2v0ic";
|
||||
"x86_64-darwin" = "0hzc65ccajr0yhmvi5vbdgbzbp1gbjy56da24ds3zwwkam1ddk0k";
|
||||
}."${stdenv.system}";
|
||||
url = "https://github.com/crystal-lang/crystal/releases/download/${version}/crystal-${version}-${toString rel}-${arch}.tar.gz";
|
||||
sha256 = sha256s."${stdenv.system}";
|
||||
};
|
||||
|
||||
buildCommand = ''
|
||||
@@ -34,7 +36,7 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
generic = { version, sha256, doCheck ? true }:
|
||||
generic = { version, sha256, binary, doCheck ? true }:
|
||||
stdenv.mkDerivation rec {
|
||||
inherit doCheck;
|
||||
name = "crystal-${version}";
|
||||
@@ -46,13 +48,10 @@ let
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
# the first bit can go when https://github.com/crystal-lang/crystal/pull/6788 is merged
|
||||
postPatch = ''
|
||||
substituteInPlace src/compiler/crystal/config.cr \
|
||||
--replace '{{ `date "+%Y-%m-%d"`.stringify.chomp }}' '"${releaseDate}"'
|
||||
ln -s spec/compiler spec/std
|
||||
substituteInPlace spec/std/process_spec.cr \
|
||||
--replace /bin/ /run/current-system/sw/bin
|
||||
--replace /bin/ /run/current-system/sw/bin/
|
||||
'';
|
||||
|
||||
buildInputs = [
|
||||
@@ -64,9 +63,7 @@ let
|
||||
|
||||
nativeBuildInputs = [ binary makeWrapper which ];
|
||||
|
||||
|
||||
makeFlags = [
|
||||
"CRYSTAL_CONFIG_BUILD_DATE=${releaseDate}"
|
||||
"CRYSTAL_CONFIG_VERSION=${version}"
|
||||
];
|
||||
|
||||
@@ -121,22 +118,49 @@ let
|
||||
homepage = https://crystal-lang.org/;
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ manveru david50407 peterhoeg ];
|
||||
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
|
||||
platforms = builtins.attrNames archs;
|
||||
};
|
||||
};
|
||||
|
||||
in rec {
|
||||
binaryCrystal_0_26 = genericBinary {
|
||||
version = "0.26.1";
|
||||
sha256s = {
|
||||
"x86_64-linux" = "1xban102yiiwmlklxvn3xp3q546bp8hlxxpakayajkhhnpl6yv45";
|
||||
"i686-linux" = "1igspf1lrv7wpmz0pfrkbx8m1ykvnv4zhic53cav4nicppm2v0ic";
|
||||
"x86_64-darwin" = "0hzc65ccajr0yhmvi5vbdgbzbp1gbjy56da24ds3zwwkam1ddk0k";
|
||||
};
|
||||
};
|
||||
|
||||
binaryCrystal_0_27 = genericBinary {
|
||||
version = "0.27.2";
|
||||
sha256s = {
|
||||
"x86_64-linux" = "05l5x7kx2acgnv42fj3rr17z73ix06zvi05h7d7vf3kw0izxrasm";
|
||||
"i686-linux" = "1iwizkvn6pglc0azkyfhlmk9ap793krdgcnbihd1kvrvs4cz0mm9";
|
||||
"x86_64-darwin" = "14c69ac2dmfwmb5q56ps3xyxxb0mrbc91ahk9h07c8fiqfii3k9g";
|
||||
};
|
||||
};
|
||||
|
||||
crystal_0_25 = generic {
|
||||
version = "0.25.1";
|
||||
sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
|
||||
doCheck = false;
|
||||
binary = binaryCrystal_0_26;
|
||||
};
|
||||
|
||||
crystal_0_26 = generic {
|
||||
version = "0.26.1";
|
||||
sha256 = "0jwxrqm99zcjj82gyl6bzvnfj79nwzqf8sa1q3f66q9p50v44f84";
|
||||
doCheck = false; # about 20 tests out of more than 14000 are failing
|
||||
binary = binaryCrystal_0_26;
|
||||
};
|
||||
|
||||
crystal = crystal_0_26;
|
||||
crystal_0_27 = generic {
|
||||
version = "0.27.2";
|
||||
sha256 = "0vxqnpqi85yh0167nrkbksxsni476iwbh6y3znbvbjbbfhsi3nsj";
|
||||
doCheck = false; # about 20 tests out of more than 15000 are failing
|
||||
binary = binaryCrystal_0_27;
|
||||
};
|
||||
|
||||
crystal = crystal_0_27;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
|
||||
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation
|
||||
, mailcap
|
||||
, mailcap, runtimeShell
|
||||
, buildPackages, targetPackages }:
|
||||
|
||||
let
|
||||
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
|
||||
# This source produces shell script at run time,
|
||||
# and thus it is not corrected by patchShebangs.
|
||||
substituteInPlace misc/cgo/testcarchive/carchive_test.go \
|
||||
--replace '#!/usr/bin/env bash' '#!${stdenv.shell}'
|
||||
--replace '#!/usr/bin/env bash' '#!${runtimeShell}'
|
||||
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
substituteInPlace src/mime/type_unix.go \
|
||||
@@ -100,7 +100,7 @@ stdenv.mkDerivation rec {
|
||||
'' + optionalString stdenv.isLinux ''
|
||||
sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
|
||||
'' + optionalString stdenv.isAarch32 ''
|
||||
echo '#!${stdenv.shell}' > misc/cgo/testplugin/test.bash
|
||||
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
|
||||
'' + optionalString stdenv.isDarwin ''
|
||||
substituteInPlace src/race.bash --replace \
|
||||
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
|
||||
|
||||
19
pkgs/development/compilers/llvm/7/bintools.nix
Normal file
19
pkgs/development/compilers/llvm/7/bintools.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ runCommand, stdenv, llvm, lld, version }:
|
||||
|
||||
let
|
||||
prefix =
|
||||
if stdenv.hostPlatform != stdenv.targetPlatform
|
||||
then "${stdenv.targetPlatform.config}-"
|
||||
else "";
|
||||
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
|
||||
mkdir -p $out/bin
|
||||
for prog in ${lld}/bin/*; do
|
||||
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
for prog in ${llvm}/bin/*; do
|
||||
ln -s $prog $out/bin/${prefix}$(echo $(basename $prog) | sed -e "s|llvm-||")
|
||||
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
||||
done
|
||||
rm -f $out/bin/${prefix}cat
|
||||
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
||||
''
|
||||
@@ -1,10 +1,10 @@
|
||||
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
, enablePolly ? false # TODO: get this info from llvm (passthru?)
|
||||
}:
|
||||
|
||||
let
|
||||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
||||
self = stdenv.mkDerivation ({
|
||||
name = "clang-${version}";
|
||||
|
||||
@@ -30,6 +30,9 @@ let
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
] ++ stdenv.lib.optionals enablePolly [
|
||||
"-DWITH_POLLY=ON"
|
||||
"-DLINK_POLLY_INTO_TOOLS=ON"
|
||||
];
|
||||
|
||||
patches = [ ./purity.patch ];
|
||||
@@ -77,8 +80,8 @@ let
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
} // stdenv.lib.optionalAttrs stdenv.targetPlatform.isLinux {
|
||||
inherit gcc;
|
||||
} // stdenv.lib.optionalAttrs (stdenv.targetPlatform.isLinux || (stdenv.cc.isGNU && stdenv.cc.cc ? gcc)) {
|
||||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -7,8 +7,19 @@ stdenv.mkDerivation rec {
|
||||
nativeBuildInputs = [ cmake python llvm ];
|
||||
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
configureFlags = [
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
@@ -16,7 +27,8 @@ stdenv.mkDerivation rec {
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin ./compiler-rt-clock_gettime.patch;
|
||||
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin ./compiler-rt-clock_gettime.patch;
|
||||
|
||||
# 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
|
||||
@@ -26,11 +38,23 @@ stdenv.mkDerivation rec {
|
||||
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace cmake/config-ix.cmake \
|
||||
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||
'' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
substituteInPlace lib/builtins/int_util.c \
|
||||
--replace "#include <stdlib.h>" ""
|
||||
substituteInPlace lib/builtins/clear_cache.c \
|
||||
--replace "#include <assert.h>" ""
|
||||
substituteInPlace lib/builtins/cpu_model.c \
|
||||
--replace "#include <assert.h>" ""
|
||||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o
|
||||
ln -s $out/lib/*/cclang_rt.crtend-*.o $out/lib/linux/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
595
pkgs/development/compilers/llvm/7/crtbegin-and-end.patch
Normal file
595
pkgs/development/compilers/llvm/7/crtbegin-and-end.patch
Normal file
@@ -0,0 +1,595 @@
|
||||
Get crtbegin and crtend without compiler GCC! PR is at https://reviews.llvm.org/D28791
|
||||
|
||||
Index: compiler-rt/CMakeLists.txt
|
||||
===================================================================
|
||||
--- compiler-rt/CMakeLists.txt
|
||||
+++ compiler-rt/CMakeLists.txt
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
|
||||
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
|
||||
+option(COMPILER_RT_BUILD_CRT "Build crtbegin.o/crtend.o" ON)
|
||||
+mark_as_advanced(COMPILER_RT_BUILD_CRT)
|
||||
option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
|
||||
mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
|
||||
option(COMPILER_RT_BUILD_XRAY "Build xray" ON)
|
||||
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
===================================================================
|
||||
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -132,7 +132,7 @@
|
||||
# Adds static or shared runtime for a list of architectures and operating
|
||||
# systems and puts it in the proper directory in the build and install trees.
|
||||
# add_compiler_rt_runtime(<name>
|
||||
-# {STATIC|SHARED}
|
||||
+# {OBJECT|STATIC|SHARED}
|
||||
# ARCHS <architectures>
|
||||
# OS <os list>
|
||||
# SOURCES <source files>
|
||||
@@ -144,8 +144,8 @@
|
||||
# PARENT_TARGET <convenience parent target>
|
||||
# ADDITIONAL_HEADERS <header files>)
|
||||
function(add_compiler_rt_runtime name type)
|
||||
- if(NOT type MATCHES "^(STATIC|SHARED)$")
|
||||
- message(FATAL_ERROR "type argument must be STATIC or SHARED")
|
||||
+ if(NOT type MATCHES "^(OBJECT|STATIC|SHARED)$")
|
||||
+ message(FATAL_ERROR "type argument must be OBJECT, STATIC or SHARED")
|
||||
return()
|
||||
endif()
|
||||
cmake_parse_arguments(LIB
|
||||
@@ -204,7 +204,10 @@
|
||||
message(FATAL_ERROR "Architecture ${arch} can't be targeted")
|
||||
return()
|
||||
endif()
|
||||
- if(type STREQUAL "STATIC")
|
||||
+ if(type STREQUAL "OBJECT")
|
||||
+ set(libname "${name}-${arch}")
|
||||
+ set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
|
||||
+ elseif(type STREQUAL "STATIC")
|
||||
set(libname "${name}-${arch}")
|
||||
set_output_name(output_name_${libname} ${name} ${arch})
|
||||
else()
|
||||
@@ -270,12 +273,34 @@
|
||||
set(COMPONENT_OPTION COMPONENT ${libname})
|
||||
endif()
|
||||
|
||||
- add_library(${libname} ${type} ${sources_${libname}})
|
||||
- set_target_compile_flags(${libname} ${extra_cflags_${libname}})
|
||||
- set_target_link_flags(${libname} ${extra_link_flags_${libname}})
|
||||
- set_property(TARGET ${libname} APPEND PROPERTY
|
||||
- COMPILE_DEFINITIONS ${LIB_DEFS})
|
||||
- set_target_output_directories(${libname} ${output_dir_${libname}})
|
||||
+ if(type STREQUAL "OBJECT")
|
||||
+ string(TOUPPER ${CMAKE_BUILD_TYPE} config)
|
||||
+ get_property(cflags SOURCE ${sources_${libname}} PROPERTY COMPILE_FLAGS)
|
||||
+ separate_arguments(cflags)
|
||||
+ add_custom_command(
|
||||
+ OUTPUT ${output_dir_${libname}}/${libname}.o
|
||||
+ COMMAND ${CMAKE_C_COMPILER} ${sources_${libname}} ${cflags} ${extra_cflags_${libname}} -c -o ${output_dir_${libname}}/${libname}.o
|
||||
+ DEPENDS ${sources_${libname}}
|
||||
+ COMMENT "Building C object ${libname}.o")
|
||||
+ add_custom_target(${libname} DEPENDS ${output_dir_${libname}}/${libname}.o)
|
||||
+ install(FILES ${output_dir_${libname}}/${libname}.o
|
||||
+ DESTINATION ${install_dir_${libname}}
|
||||
+ ${COMPONENT_OPTION})
|
||||
+ else()
|
||||
+ add_library(${libname} ${type} ${sources_${libname}})
|
||||
+ set_target_compile_flags(${libname} ${extra_cflags_${libname}})
|
||||
+ set_target_link_flags(${libname} ${extra_link_flags_${libname}})
|
||||
+ set_property(TARGET ${libname} APPEND PROPERTY
|
||||
+ COMPILE_DEFINITIONS ${LIB_DEFS})
|
||||
+ set_target_output_directories(${libname} ${output_dir_${libname}})
|
||||
+ install(TARGETS ${libname}
|
||||
+ ARCHIVE DESTINATION ${install_dir_${libname}}
|
||||
+ ${COMPONENT_OPTION}
|
||||
+ LIBRARY DESTINATION ${install_dir_${libname}}
|
||||
+ ${COMPONENT_OPTION}
|
||||
+ RUNTIME DESTINATION ${install_dir_${libname}}
|
||||
+ ${COMPONENT_OPTION})
|
||||
+ endif()
|
||||
set_target_properties(${libname} PROPERTIES
|
||||
OUTPUT_NAME ${output_name_${libname}})
|
||||
set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime")
|
||||
@@ -299,13 +324,6 @@
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
- install(TARGETS ${libname}
|
||||
- ARCHIVE DESTINATION ${install_dir_${libname}}
|
||||
- ${COMPONENT_OPTION}
|
||||
- LIBRARY DESTINATION ${install_dir_${libname}}
|
||||
- ${COMPONENT_OPTION}
|
||||
- RUNTIME DESTINATION ${install_dir_${libname}}
|
||||
- ${COMPONENT_OPTION})
|
||||
|
||||
# We only want to generate per-library install targets if you aren't using
|
||||
# an IDE because the extra targets get cluttered in IDEs.
|
||||
Index: compiler-rt/cmake/config-ix.cmake
|
||||
===================================================================
|
||||
--- compiler-rt/cmake/config-ix.cmake
|
||||
+++ compiler-rt/cmake/config-ix.cmake
|
||||
@@ -227,6 +227,7 @@
|
||||
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X})
|
||||
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
|
||||
${MIPS32} ${MIPS64} ${PPC64} ${S390X})
|
||||
+set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64})
|
||||
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
|
||||
set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64})
|
||||
|
||||
@@ -474,6 +475,7 @@
|
||||
SANITIZER_COMMON_SUPPORTED_ARCH)
|
||||
|
||||
else()
|
||||
+ filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})
|
||||
# Architectures supported by compiler-rt libraries.
|
||||
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
|
||||
${ALL_SANITIZER_COMMON_SUPPORTED_ARCH})
|
||||
@@ -563,6 +565,12 @@
|
||||
|
||||
# TODO: Add builtins support.
|
||||
|
||||
+if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux")
|
||||
+ set(COMPILER_RT_HAS_CRT TRUE)
|
||||
+else()
|
||||
+ set(COMPILER_RT_HAS_CRT FALSE)
|
||||
+endif()
|
||||
+
|
||||
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
|
||||
OS_NAME MATCHES "Linux")
|
||||
set(COMPILER_RT_HAS_DFSAN TRUE)
|
||||
Index: compiler-rt/lib/CMakeLists.txt
|
||||
===================================================================
|
||||
--- compiler-rt/lib/CMakeLists.txt
|
||||
+++ compiler-rt/lib/CMakeLists.txt
|
||||
@@ -17,6 +17,10 @@
|
||||
add_subdirectory(builtins)
|
||||
endif()
|
||||
|
||||
+if(COMPILER_RT_BUILD_CRT)
|
||||
+ add_subdirectory(crt)
|
||||
+endif()
|
||||
+
|
||||
function(compiler_rt_build_runtime runtime)
|
||||
string(TOUPPER ${runtime} runtime_uppercase)
|
||||
if(COMPILER_RT_HAS_${runtime_uppercase})
|
||||
Index: compiler-rt/lib/crt/CMakeLists.txt
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/lib/crt/CMakeLists.txt
|
||||
@@ -0,0 +1,101 @@
|
||||
+add_compiler_rt_component(crt)
|
||||
+
|
||||
+function(check_cxx_section_exists section output)
|
||||
+ cmake_parse_arguments(ARG "" "" "SOURCE;FLAGS" ${ARGN})
|
||||
+ if(NOT ARG_SOURCE)
|
||||
+ set(ARG_SOURCE "int main() { return 0; }\n")
|
||||
+ endif()
|
||||
+
|
||||
+ string(RANDOM TARGET_NAME)
|
||||
+ set(TARGET_NAME "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmTC_${TARGET_NAME}.dir")
|
||||
+ file(MAKE_DIRECTORY ${TARGET_NAME})
|
||||
+
|
||||
+ file(WRITE "${TARGET_NAME}/CheckSectionExists.c" "${ARG_SOURCE}\n")
|
||||
+
|
||||
+ string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
|
||||
+ ${CMAKE_C_COMPILE_OBJECT})
|
||||
+
|
||||
+ set(try_compile_flags "${ARG_FLAGS}")
|
||||
+ if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
|
||||
+ list(APPEND try_compile_flags "-target ${CMAKE_C_COMPILER_TARGET}")
|
||||
+ endif()
|
||||
+
|
||||
+ string(REPLACE ";" " " extra_flags "${try_compile_flags}")
|
||||
+
|
||||
+ set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}")
|
||||
+ foreach(substitution ${substitutions})
|
||||
+ if(substitution STREQUAL "<CMAKE_C_COMPILER>")
|
||||
+ string(REPLACE "<CMAKE_C_COMPILER>"
|
||||
+ "${CMAKE_C_COMPILER}" test_compile_command ${test_compile_command})
|
||||
+ elseif(substitution STREQUAL "<OBJECT>")
|
||||
+ string(REPLACE "<OBJECT>" "${TARGET_NAME}/CheckSectionExists.o"
|
||||
+ test_compile_command ${test_compile_command})
|
||||
+ elseif(substitution STREQUAL "<SOURCE>")
|
||||
+ string(REPLACE "<SOURCE>" "${TARGET_NAME}/CheckSectionExists.c"
|
||||
+ test_compile_command ${test_compile_command})
|
||||
+ elseif(substitution STREQUAL "<FLAGS>")
|
||||
+ string(REPLACE "<FLAGS>" "${CMAKE_C_FLAGS} ${extra_flags}"
|
||||
+ test_compile_command ${test_compile_command})
|
||||
+ else()
|
||||
+ string(REPLACE "${substitution}" "" test_compile_command
|
||||
+ ${test_compile_command})
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+
|
||||
+ string(REPLACE " " ";" test_compile_command "${test_compile_command}")
|
||||
+
|
||||
+ execute_process(
|
||||
+ COMMAND ${test_compile_command}
|
||||
+ RESULT_VARIABLE TEST_RESULT
|
||||
+ OUTPUT_VARIABLE TEST_OUTPUT
|
||||
+ ERROR_VARIABLE TEST_ERROR
|
||||
+ )
|
||||
+
|
||||
+ execute_process(
|
||||
+ COMMAND ${CMAKE_OBJDUMP} -h "${TARGET_NAME}/CheckSectionExists.o"
|
||||
+ RESULT_VARIABLE CHECK_RESULT
|
||||
+ OUTPUT_VARIABLE CHECK_OUTPUT
|
||||
+ ERROR_VARIABLE CHECK_ERROR
|
||||
+ )
|
||||
+ string(FIND ${CHECK_OUTPUT} ${section} SECTION_FOUND)
|
||||
+
|
||||
+ if(NOT SECTION_FOUND EQUAL -1)
|
||||
+ set(${output} TRUE PARENT_SCOPE)
|
||||
+ else()
|
||||
+ set(${output} FALSE PARENT_SCOPE)
|
||||
+ endif()
|
||||
+
|
||||
+ file(REMOVE_RECURSE ${TARGET_NAME})
|
||||
+endfunction()
|
||||
+
|
||||
+check_cxx_section_exists(".init_array" COMPILER_RT_HAS_INITFINI_ARRAY
|
||||
+ SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n")
|
||||
+
|
||||
+append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS)
|
||||
+
|
||||
+foreach(arch ${CRT_SUPPORTED_ARCH})
|
||||
+ add_compiler_rt_runtime(clang_rt.crtbegin
|
||||
+ OBJECT
|
||||
+ ARCHS ${arch}
|
||||
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
|
||||
+ CFLAGS ${CRT_CFLAGS}
|
||||
+ PARENT_TARGET crt)
|
||||
+ add_compiler_rt_runtime(clang_rt.crtbegin_shared
|
||||
+ OBJECT
|
||||
+ ARCHS ${arch}
|
||||
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
|
||||
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC
|
||||
+ PARENT_TARGET crt)
|
||||
+ add_compiler_rt_runtime(clang_rt.crtend
|
||||
+ OBJECT
|
||||
+ ARCHS ${arch}
|
||||
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
|
||||
+ CFLAGS ${CRT_CFLAGS}
|
||||
+ PARENT_TARGET crt)
|
||||
+ add_compiler_rt_runtime(clang_rt.crtend_shared
|
||||
+ OBJECT
|
||||
+ ARCHS ${arch}
|
||||
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
|
||||
+ CFLAGS ${CRT_CFLAGS} -DCRT_SHARED -fPIC
|
||||
+ PARENT_TARGET crt)
|
||||
+endforeach()
|
||||
Index: compiler-rt/lib/crt/crtbegin.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/lib/crt/crtbegin.c
|
||||
@@ -0,0 +1,110 @@
|
||||
+/* ===-- crtbegin.c - Start of constructors and destructors ----------------===
|
||||
+ *
|
||||
+ * The LLVM Compiler Infrastructure
|
||||
+ *
|
||||
+ * This file is dual licensed under the MIT and the University of Illinois Open
|
||||
+ * Source Licenses. See LICENSE.TXT for details.
|
||||
+ *
|
||||
+ * ===----------------------------------------------------------------------===
|
||||
+ */
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+__attribute__((visibility("hidden")))
|
||||
+#ifdef CRT_SHARED
|
||||
+void *__dso_handle = &__dso_handle;
|
||||
+#else
|
||||
+void *__dso_handle = (void *)0;
|
||||
+#endif
|
||||
+
|
||||
+static long __EH_FRAME_LIST__[] __attribute__((
|
||||
+ section(".eh_frame"), aligned(sizeof(void *)), visibility("hidden"))) = {};
|
||||
+
|
||||
+extern void __register_frame_info(const void *, void *) __attribute__((weak));
|
||||
+extern void *__deregister_frame_info(const void *) __attribute__((weak));
|
||||
+
|
||||
+#ifndef CRT_HAS_INITFINI_ARRAY
|
||||
+typedef void (*fp)(void);
|
||||
+
|
||||
+static fp __CTOR_LIST__[]
|
||||
+ __attribute__((section(".ctors"), aligned(sizeof(fp)), visibility("hidden"),
|
||||
+ used)) = {(fp)-1};
|
||||
+extern fp __CTOR_LIST_END__[] __attribute__((visibility("hidden")));
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CRT_SHARED
|
||||
+extern void __cxa_finalize(void *) __attribute__((weak));
|
||||
+#endif
|
||||
+
|
||||
+static void __attribute__((used)) __do_init() {
|
||||
+ static _Bool __initialized;
|
||||
+ if (__builtin_expect(__initialized, 0))
|
||||
+ return;
|
||||
+ __initialized = 1;
|
||||
+
|
||||
+ static struct { void *p[8]; } __object;
|
||||
+ if (__register_frame_info)
|
||||
+ __register_frame_info(__EH_FRAME_LIST__, &__object);
|
||||
+
|
||||
+#ifndef CRT_HAS_INITFINI_ARRAY
|
||||
+ const size_t n = __CTOR_LIST_END__ - __CTOR_LIST__ - 1;
|
||||
+ for (size_t i = n; i >= 1; i--) __CTOR_LIST__[i]();
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+#ifdef CRT_HAS_INITFINI_ARRAY
|
||||
+__attribute__((section(".init_array"),
|
||||
+ used)) static void (*__init)(void) = __do_init;
|
||||
+#else // CRT_HAS_INITFINI_ARRAY
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
+asm(".pushsection .init,\"ax\",@progbits\n\t"
|
||||
+ "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
|
||||
+ ".popsection");
|
||||
+#elif defined(__arm__)
|
||||
+asm(".pushsection .init,\"ax\",%progbits\n\t"
|
||||
+ "bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
|
||||
+ ".popsection");
|
||||
+#endif // CRT_HAS_INITFINI_ARRAY
|
||||
+#endif
|
||||
+
|
||||
+#ifndef CRT_HAS_INITFINI_ARRAY
|
||||
+static fp __DTOR_LIST__[]
|
||||
+ __attribute__((section(".dtors"), aligned(sizeof(fp)), visibility("hidden"),
|
||||
+ used)) = {(fp)-1};
|
||||
+extern fp __DTOR_LIST_END__[] __attribute__((visibility("hidden")));
|
||||
+#endif
|
||||
+
|
||||
+static void __attribute__((used)) __do_fini() {
|
||||
+ static _Bool __finalized;
|
||||
+ if (__builtin_expect(__finalized, 0))
|
||||
+ return;
|
||||
+ __finalized = 1;
|
||||
+
|
||||
+#ifdef CRT_SHARED
|
||||
+ if (__cxa_finalize)
|
||||
+ __cxa_finalize(__dso_handle);
|
||||
+#endif
|
||||
+
|
||||
+#ifndef CRT_HAS_INITFINI_ARRAY
|
||||
+ if (__deregister_frame_info)
|
||||
+ __deregister_frame_info(__EH_FRAME_LIST__);
|
||||
+
|
||||
+ const size_t n = __DTOR_LIST_END__ - __DTOR_LIST__ - 1;
|
||||
+ for (size_t i = 1; i < n; i++) __DTOR_LIST__[i]();
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+#ifdef CRT_HAS_INITFINI_ARRAY
|
||||
+__attribute__((section(".fini_array"),
|
||||
+ used)) static void (*__fini)(void) = __do_fini;
|
||||
+#else // CRT_HAS_INITFINI_ARRAY
|
||||
+#if defined(__i386__) || defined(__x86_64__)
|
||||
+asm(".pushsection .fini,\"ax\",@progbits\n\t"
|
||||
+ "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
|
||||
+ ".popsection");
|
||||
+#elif defined(__arm__)
|
||||
+asm(".pushsection .fini,\"ax\",%progbits\n\t"
|
||||
+ "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
|
||||
+ ".popsection");
|
||||
+#endif
|
||||
+#endif // CRT_HAS_INIT_FINI_ARRAY
|
||||
Index: compiler-rt/lib/crt/crtend.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/lib/crt/crtend.c
|
||||
@@ -0,0 +1,23 @@
|
||||
+/* ===-- crtend.c - End of constructors and destructors --------------------===
|
||||
+ *
|
||||
+ * The LLVM Compiler Infrastructure
|
||||
+ *
|
||||
+ * This file is dual licensed under the MIT and the University of Illinois Open
|
||||
+ * Source Licenses. See LICENSE.TXT for details.
|
||||
+ *
|
||||
+ * ===----------------------------------------------------------------------===
|
||||
+ */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+// Put 4-byte zero which is the length field in FDE at the end as a terminator.
|
||||
+const int32_t __EH_FRAME_LIST_END__[]
|
||||
+ __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)), used)) = {0};
|
||||
+
|
||||
+#ifndef CRT_HAS_INITFINI_ARRAY
|
||||
+typedef void (*fp)(void);
|
||||
+fp __CTOR_LIST_END__[]
|
||||
+ __attribute__((section(".ctors"), visibility("hidden"), used)) = {0};
|
||||
+fp __DTOR_LIST_END__[]
|
||||
+ __attribute__((section(".dtors"), visibility("hidden"), used)) = {0};
|
||||
+#endif
|
||||
Index: compiler-rt/test/CMakeLists.txt
|
||||
===================================================================
|
||||
--- compiler-rt/test/CMakeLists.txt
|
||||
+++ compiler-rt/test/CMakeLists.txt
|
||||
@@ -73,6 +73,9 @@
|
||||
if(COMPILER_RT_BUILD_XRAY)
|
||||
compiler_rt_test_runtime(xray)
|
||||
endif()
|
||||
+ if(COMPILER_RT_HAS_CRT)
|
||||
+ add_subdirectory(crt)
|
||||
+ endif()
|
||||
# ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
|
||||
# include their own minimal runtime
|
||||
add_subdirectory(shadowcallstack)
|
||||
Index: compiler-rt/test/crt/CMakeLists.txt
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/test/crt/CMakeLists.txt
|
||||
@@ -0,0 +1,31 @@
|
||||
+set(CRT_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
+
|
||||
+set(CRT_TESTSUITES)
|
||||
+
|
||||
+set(CRT_TEST_DEPS "")
|
||||
+
|
||||
+if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_BUILD_CRT AND
|
||||
+ COMPILER_RT_HAS_CRT)
|
||||
+ list(APPEND CRT_TEST_DEPS crt)
|
||||
+endif()
|
||||
+
|
||||
+set(CRT_TEST_ARCH ${CRT_SUPPORTED_ARCH})
|
||||
+if (COMPILER_RT_BUILD_CRT AND COMPILER_RT_HAS_CRT)
|
||||
+ foreach(arch ${CRT_TEST_ARCH})
|
||||
+ set(CRT_TEST_TARGET_ARCH ${arch})
|
||||
+ string(TOLOWER "-${arch}-${OS_NAME}" CRT_TEST_CONFIG_SUFFIX)
|
||||
+ get_test_cc_for_arch(${arch} CRT_TEST_TARGET_CC CRT_TEST_TARGET_CFLAGS)
|
||||
+ string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
+ set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
|
||||
+
|
||||
+ configure_lit_site_cfg(
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
|
||||
+ list(APPEND CRT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
||||
+ endforeach()
|
||||
+endif()
|
||||
+
|
||||
+add_lit_testsuite(check-crt "Running the CRT tests"
|
||||
+ ${CRT_TESTSUITES}
|
||||
+ DEPENDS ${CRT_TEST_DEPS})
|
||||
+set_target_properties(check-crt PROPERTIES FOLDER "Compiler-RT Misc")
|
||||
Index: compiler-rt/test/crt/dso_handle.cpp
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/test/crt/dso_handle.cpp
|
||||
@@ -0,0 +1,33 @@
|
||||
+// RUN: %clangxx -g -DCRT_SHARED -c %s -fPIC -o %tshared.o
|
||||
+// RUN: %clangxx -g -c %s -fPIC -o %t.o
|
||||
+// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %shared_crtbegin %tshared.o %libstdcxx -lc -lm -lgcc_s %shared_crtend %crtn
|
||||
+// RUN: %clangxx -g -o %t -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx -lc -lm %libgcc %t.so %crtend %crtn
|
||||
+// RUN: %run %t 2>&1 | FileCheck %s
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+// CHECK: 1
|
||||
+// CHECK-NEXT: ~A()
|
||||
+
|
||||
+#ifdef CRT_SHARED
|
||||
+bool G;
|
||||
+void C() {
|
||||
+ printf("%d\n", G);
|
||||
+}
|
||||
+
|
||||
+struct A {
|
||||
+ A() { G = true; }
|
||||
+ ~A() {
|
||||
+ printf("~A()\n");
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+A a;
|
||||
+#else
|
||||
+void C();
|
||||
+
|
||||
+int main() {
|
||||
+ C();
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
Index: compiler-rt/test/crt/lit.cfg
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/test/crt/lit.cfg
|
||||
@@ -0,0 +1,80 @@
|
||||
+# -*- Python -*-
|
||||
+
|
||||
+import os
|
||||
+import subprocess
|
||||
+
|
||||
+# Setup config name.
|
||||
+config.name = 'CRT' + config.name_suffix
|
||||
+
|
||||
+# Setup source root.
|
||||
+config.test_source_root = os.path.dirname(__file__)
|
||||
+
|
||||
+
|
||||
+def get_library_path(file):
|
||||
+ cmd = subprocess.Popen([config.clang.strip(),
|
||||
+ config.target_cflags.strip(),
|
||||
+ '-print-file-name=%s' % file],
|
||||
+ stdout=subprocess.PIPE,
|
||||
+ env=config.environment)
|
||||
+ if not cmd.stdout:
|
||||
+ lit_config.fatal("Couldn't find the library path for '%s'" % file)
|
||||
+ dir = cmd.stdout.read().strip()
|
||||
+ if sys.platform in ['win32'] and execute_external:
|
||||
+ # Don't pass dosish path separator to msys bash.exe.
|
||||
+ dir = dir.replace('\\', '/')
|
||||
+ # Ensure the result is an ascii string, across Python2.5+ - Python3.
|
||||
+ return str(dir.decode('ascii'))
|
||||
+
|
||||
+
|
||||
+def get_libgcc_file_name():
|
||||
+ cmd = subprocess.Popen([config.clang.strip(),
|
||||
+ config.target_cflags.strip(),
|
||||
+ '-print-libgcc-file-name'],
|
||||
+ stdout=subprocess.PIPE,
|
||||
+ env=config.environment)
|
||||
+ if not cmd.stdout:
|
||||
+ lit_config.fatal("Couldn't find the library path for '%s'" % file)
|
||||
+ dir = cmd.stdout.read().strip()
|
||||
+ if sys.platform in ['win32'] and execute_external:
|
||||
+ # Don't pass dosish path separator to msys bash.exe.
|
||||
+ dir = dir.replace('\\', '/')
|
||||
+ # Ensure the result is an ascii string, across Python2.5+ - Python3.
|
||||
+ return str(dir.decode('ascii'))
|
||||
+
|
||||
+
|
||||
+def build_invocation(compile_flags):
|
||||
+ return ' ' + ' '.join([config.clang] + compile_flags) + ' '
|
||||
+
|
||||
+
|
||||
+# Setup substitutions.
|
||||
+config.substitutions.append(
|
||||
+ ('%clang ', build_invocation([config.target_cflags])))
|
||||
+config.substitutions.append(
|
||||
+ ('%clangxx ',
|
||||
+ build_invocation(config.cxx_mode_flags + [config.target_cflags])))
|
||||
+
|
||||
+base_lib = os.path.join(
|
||||
+ config.compiler_rt_libdir, "clang_rt.%%s-%s.o" % config.target_arch)
|
||||
+config.substitutions.append(('%crtbegin', base_lib % "crtbegin"))
|
||||
+config.substitutions.append(('%shared_crtbegin', base_lib % "crtbegin_shared"))
|
||||
+config.substitutions.append(('%crtend', base_lib % "crtend"))
|
||||
+config.substitutions.append(('%shared_crtend', base_lib % "crtend_shared"))
|
||||
+
|
||||
+config.substitutions.append(
|
||||
+ ('%crt1', get_library_path('crt1.o')))
|
||||
+config.substitutions.append(
|
||||
+ ('%crti', get_library_path('crti.o')))
|
||||
+config.substitutions.append(
|
||||
+ ('%crtn', get_library_path('crtn.o')))
|
||||
+
|
||||
+config.substitutions.append(
|
||||
+ ('%libgcc', get_libgcc_file_name()))
|
||||
+
|
||||
+config.substitutions.append(
|
||||
+ ('%libstdcxx', '-l' + config.sanitizer_cxx_lib.lstrip('lib')))
|
||||
+
|
||||
+# Default test suffixes.
|
||||
+config.suffixes = ['.c', '.cc', '.cpp']
|
||||
+
|
||||
+if config.host_os not in ['Linux']:
|
||||
+ config.unsupported = True
|
||||
Index: compiler-rt/test/crt/lit.site.cfg.in
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ compiler-rt/test/crt/lit.site.cfg.in
|
||||
@@ -0,0 +1,14 @@
|
||||
+@LIT_SITE_CFG_IN_HEADER@
|
||||
+
|
||||
+# Tool-specific config options.
|
||||
+config.name_suffix = "@CRT_TEST_CONFIG_SUFFIX@"
|
||||
+config.crt_lit_source_dir = "@CRT_LIT_SOURCE_DIR@"
|
||||
+config.target_cflags = "@CRT_TEST_TARGET_CFLAGS@"
|
||||
+config.target_arch = "@CRT_TEST_TARGET_ARCH@"
|
||||
+config.sanitizer_cxx_lib = "@SANITIZER_TEST_CXX_LIBNAME@"
|
||||
+
|
||||
+# Load common config for all compiler-rt lit tests
|
||||
+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
|
||||
+
|
||||
+# Load tool-specific config that would do the real work.
|
||||
+lit_config.load_config(config, "@CRT_LIT_SOURCE_DIR@/lit.cfg")
|
||||
@@ -1,5 +1,5 @@
|
||||
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
|
||||
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
|
||||
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
}:
|
||||
@@ -23,16 +23,22 @@ let
|
||||
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 ''
|
||||
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && tools.clang-unwrapped ? gcc) ''
|
||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm.nix { };
|
||||
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
clang-polly-unwrapped = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
llvm = tools.llvm-polly;
|
||||
enablePolly = true;
|
||||
};
|
||||
|
||||
llvm-manpages = lowPrio (tools.llvm.override {
|
||||
enableManpages = true;
|
||||
@@ -71,13 +77,63 @@ let
|
||||
lld = callPackage ./lld.nix {};
|
||||
|
||||
lldb = callPackage ./lldb.nix {};
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
extraPackages = [
|
||||
# targetLlvmLibraries.libcxx
|
||||
# targetLlvmLibraries.libcxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-target ${stdenv.targetPlatform.config} -rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
extraPackages = [
|
||||
# targetLlvmLibraries.libcxx
|
||||
# targetLlvmLibraries.libcxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-target ${stdenv.targetPlatform.config} -rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles -target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = stdenv.lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt.nix {};
|
||||
compiler-rt = callPackage ./compiler-rt.nix {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? true
|
||||
, enablePFM ? !stdenv.isDarwin
|
||||
, enablePolly ? false
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optional optionals optionalString;
|
||||
|
||||
src = fetch "llvm" "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3";
|
||||
polly_src = fetch "polly" "0wgvayfilgb530bq51l7szxfb13l24nnrmyji2f6ncq95a24dw8v";
|
||||
|
||||
# Used when creating a version-suffixed symlink of libLLVM.dylib
|
||||
shortVersion = with stdenv.lib;
|
||||
@@ -34,6 +36,9 @@ in stdenv.mkDerivation (rec {
|
||||
unpackFile ${src}
|
||||
mv llvm-${version}* llvm
|
||||
sourceRoot=$PWD/llvm
|
||||
'' + optionalString enablePolly ''
|
||||
unpackFile ${polly_src}
|
||||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
|
||||
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
homepage = "http://mercurylang.org";
|
||||
license = stdenv.lib.licenses.gpl2;
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
|
||||
maintainers = [ ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "sbcl-${version}";
|
||||
version = "1.4.16";
|
||||
version = "1.5.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2";
|
||||
sha256 = "1myg4wkxnbfn5nz38xy62r1jhjy07x3h0b04vg858n41chdsv4wd";
|
||||
sha256 = "1a4c84b6qqi4w4l1zzhnhnywk73j3wb0gjgghzcw0h5syqbqzy8z";
|
||||
};
|
||||
|
||||
buildInputs = [texinfo];
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
{ stdenv, fetchurl, darwin }:
|
||||
let
|
||||
version = "110.84";
|
||||
version = "110.85";
|
||||
baseurl = "http://smlnj.cs.uchicago.edu/dist/working/${version}";
|
||||
|
||||
sources = map fetchurl [
|
||||
{ url = "${baseurl}/config.tgz"; sha256 = "0cpqrvixqwf64fa94wzwf59p0lnnmwxgkwm3qwhf28l2fv5d640q"; }
|
||||
{ url = "${baseurl}/cm.tgz"; sha256 = "0qq6kdi8xqi3w1rsmi4rgjdbjr9m4crizb1ma5xg51x8h42ccmbh"; }
|
||||
{ url = "${baseurl}/compiler.tgz"; sha256 = "11zfdwr7a10ylzvap2j0c1py11zi500hfnmhd5lvy9spwzray8vd"; }
|
||||
{ url = "${baseurl}/runtime.tgz"; sha256 = "0v2dv0hh0gxnzzxz8vzqn5avxh7mynaj4g9kkbv4gcnxxaylpksz"; }
|
||||
{ url = "${baseurl}/system.tgz"; sha256 = "0612a6qls202l6wbckcd6dklh7nb75fk4c4qmbs9h2h0j3kisszl"; }
|
||||
{ url = "${baseurl}/MLRISC.tgz"; sha256 = "0wnhvy677p2f7pxlk8mmk3gi605nawy1zzn2cf4619wg04v54g6s"; }
|
||||
{ url = "${baseurl}/smlnj-lib.tgz"; sha256 = "1pg9y0lcp18fc91y45yb2lysnrzml00xdhcilkc1cx17am394mik"; }
|
||||
{ url = "${baseurl}/old-basis.tgz"; sha256 = "14zdkzfri4a7mj7zck2c43aqkg0y7kppp2nkbihg069g4ifgw5fg"; }
|
||||
{ url = "${baseurl}/ckit.tgz"; sha256 = "0dlccmnchs38www0a3ibrjxipf8xi03d7pgriynjqdyjjgik89by"; }
|
||||
{ url = "${baseurl}/nlffi.tgz"; sha256 = "0c9z2fq8d7ln4flzc5pkfym9rkjhjymjm60v1avh1c337lmai5lb"; }
|
||||
{ url = "${baseurl}/cml.tgz"; sha256 = "16jn5fn8khxnjj0kwjzavx2ms3kv16zy35wamh8k51nv8v3i0qam"; }
|
||||
{ url = "${baseurl}/eXene.tgz"; sha256 = "1701l155aiprzxh5p5whb9qbg368cqq0bzdwkwsxgrrllfhwdq9z"; }
|
||||
{ url = "${baseurl}/ml-lpt.tgz"; sha256 = "19dk9yqq6f5ayqlf7p95aakc4swj6x1j8m0ka2slzzb9g93f2q1g"; }
|
||||
{ url = "${baseurl}/ml-lex.tgz"; sha256 = "0w20w17rd67n6zgxzwq89k9ywc78l3ydxcax0pniwzv6m5d08znc"; }
|
||||
{ url = "${baseurl}/ml-yacc.tgz"; sha256 = "1fdxhy4f2dgs19p20vg7yysi9gxp6hc1ggs97k4zq448y2ssxsyg"; }
|
||||
{ url = "${baseurl}/ml-burg.tgz"; sha256 = "066r0zy5rc60y8kzh2c06hy1b217lh6qffvxlwz8w1w86yqkgsk2"; }
|
||||
{ url = "${baseurl}/pgraph.tgz"; sha256 = "1jy1g9xiv14jj9svb5wgbdm520qbdhamfmxlf31xnh552gg18bxa"; }
|
||||
{ url = "${baseurl}/trace-debug-profile.tgz"; sha256 = "0nkawi2mdmsw24a1pkwp2brixrvxyqgxzsylp7w7ak35p20l5igc"; }
|
||||
{ url = "${baseurl}/heap2asm.tgz"; sha256 = "159y8c8xnim7p4pyynjirqhwi73lkrq0fksk8wnpcdh5clmwacrx"; }
|
||||
{ url = "${baseurl}/smlnj-c.tgz"; sha256 = "1sgfdnvkqa6wmwg027wg8lvg7zxq36p83bkymy8qkjdlxhxm2nhl"; }
|
||||
{ url = "${baseurl}/doc.tgz"; sha256 = "083h5h937gkhfq3xk982vmng903c83d98yh5fps53f62wib99mhf"; }
|
||||
{ url = "${baseurl}/boot.x86-unix.tgz"; sha256 = "10nf79jzmv64ag8c11fxd9ggw21a9kdn9shqkiz1kni3lq63p7m2"; }
|
||||
{ url = "${baseurl}/asdl.tgz"; sha256 = "13jvdgv63h4s8p9q563hyisbz464y88y2flvwyxvi1n11lh15rwb"; }
|
||||
{ url = "${baseurl}/config.tgz"; sha256 = "1qlir3q0vi7f1wyz2jyaiqy3z72d0xngsa122ks5g0b7b0hcdgm1"; }
|
||||
{ url = "${baseurl}/cm.tgz"; sha256 = "0330jkmaxgy085hsgajqikm242gms650rks24mfxhgk11r4ks105"; }
|
||||
{ url = "${baseurl}/compiler.tgz"; sha256 = "1zrqqvi9332g3clrh01z19sl06g3zlnp6zzz5z8rvsfwbiqp929m"; }
|
||||
{ url = "${baseurl}/runtime.tgz"; sha256 = "1n9hd99s2i834yihx4n59gl1cnh7hiiz8im735bmifmv50vzfdf4"; }
|
||||
{ url = "${baseurl}/system.tgz"; sha256 = "17samia4lzcz3mk73i330bspap2ks937arx35n9dr7bws0appfm8"; }
|
||||
{ url = "${baseurl}/MLRISC.tgz"; sha256 = "039g6dwxy96bkvw1z19vwn8q150h7s8jlcmsg851bgz3j3h6vs18"; }
|
||||
{ url = "${baseurl}/smlnj-lib.tgz"; sha256 = "1wk4w1npipm6qqgwis2xrbdjamwmiwv6ci4y40nzryhb37yxfj6d"; }
|
||||
{ url = "${baseurl}/old-basis.tgz"; sha256 = "0lkhbkkglz7lk1c93hc1y1di5dx20fgfhybvsqjp1bcwz8jsd70y"; }
|
||||
{ url = "${baseurl}/ckit.tgz"; sha256 = "14qxgw2vhq4dfiv5zl2gdhvjp75s10dqw97mqxffmh3vayyad1fi"; }
|
||||
{ url = "${baseurl}/nlffi.tgz"; sha256 = "16l8iszkyh34dqdbplsxycipvbw61yjamgxllcq8axiq4h7spy7w"; }
|
||||
{ url = "${baseurl}/cml.tgz"; sha256 = "05dlqz4r3qa3rpqgjlx91fsfx7j6gk3dkw28zcgg5g32irmd1la3"; }
|
||||
{ url = "${baseurl}/eXene.tgz"; sha256 = "07mahzxns26hkfax9gc8cq4s8sfzj531wwnm47b8qkhd72d3ncn2"; }
|
||||
{ url = "${baseurl}/ml-lpt.tgz"; sha256 = "0073hfn98l61ryshhqw9855fb49vs9qcz9nplbg2pa2f7manqbk0"; }
|
||||
{ url = "${baseurl}/ml-lex.tgz"; sha256 = "106km17f4wyvhzkx62cfq2gp4ihya8l234550laqb50zf8vxyklq"; }
|
||||
{ url = "${baseurl}/ml-yacc.tgz"; sha256 = "1r0k7lz8xnir271pykbs4agadysbs35kkmg1p816kzfyz5bsrrq9"; }
|
||||
{ url = "${baseurl}/ml-burg.tgz"; sha256 = "10jqasplbxp50ryq74aazbnyaz8l492rhdij5mr1kzyfj79fysh9"; }
|
||||
{ url = "${baseurl}/pgraph.tgz"; sha256 = "1pxqddbrb7y9kp89gz8v8vfjmw4wajfy6757gb8c6x499jarxa60"; }
|
||||
{ url = "${baseurl}/trace-debug-profile.tgz"; sha256 = "0fkalpdzdrm1gmafn33ck4dw8s92p9iwm4fav4m9jcqyha9az3g7"; }
|
||||
{ url = "${baseurl}/heap2asm.tgz"; sha256 = "056gkmrylyrf0q0r3cpx76zx8mc62033jkn1bnjn0f8r31yhbipc"; }
|
||||
{ url = "${baseurl}/smlnj-c.tgz"; sha256 = "04c4jnylj5dnd4sjywzwnqlv9g7dkrilq6d4cy543dw03yhjdykw"; }
|
||||
{ url = "${baseurl}/doc.tgz"; sha256 = "1rpk9g1nhjpc2b4pmzmj8v80knrhljn17ghiwznnljv53hka7jzx"; }
|
||||
{ url = "${baseurl}/boot.x86-unix.tgz"; sha256 = "05rh1y74jvp6zs96mb7nkwbgwwbss0zy2iw4gicdkyf6in0nk4la"; }
|
||||
{ url = "${baseurl}/asdl.tgz"; sha256 = "1d465bncgy92ni6430dbq6isvnysfhvykjrxm98dz82iih7a6vqb"; }
|
||||
];
|
||||
in stdenv.mkDerivation {
|
||||
name = "smlnj-${version}";
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
{ stdenv, fetchFromGitHub, fetchurl, llvmPackages, ncurses, lua }:
|
||||
|
||||
let
|
||||
luajitArchive = "LuaJIT-2.0.4.tar.gz";
|
||||
luajitArchive = "LuaJIT-2.0.5.tar.gz";
|
||||
luajitSrc = fetchurl {
|
||||
url = "http://luajit.org/download/${luajitArchive}";
|
||||
sha256 = "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2";
|
||||
sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "terra-git-${version}";
|
||||
version = "2016-06-09";
|
||||
version = "1.0.0-beta1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "zdevito";
|
||||
repo = "terra";
|
||||
rev = "22696f178be8597af555a296db804dba820638ba";
|
||||
sha256 = "1c2i9ih331304bh31c5gh94fx0qa49rsn70pvczvdfhi8pmcms6g";
|
||||
rev = "release-${version}";
|
||||
sha256 = "1blv3mbmlwb6fxkck6487ck4qq67cbwq6s1zlp86hy2wckgf8q2c";
|
||||
};
|
||||
|
||||
outputs = [ "bin" "dev" "out" "static" ];
|
||||
|
||||
Reference in New Issue
Block a user