Use lld linker for clangOmpss2 for LTO

This commit is contained in:
2023-03-06 11:47:01 +01:00
parent 5753f0c312
commit 84623ea9d0
4 changed files with 69 additions and 2 deletions

43
test/compilers/lto.nix Normal file
View File

@@ -0,0 +1,43 @@
{ stdenv, writeText, which, strace }:
let
hello_c = writeText "hello.c" ''
#include <stdio.h>
#include <limits.h>
#include <xmmintrin.h>
int main()
{
printf("Hello world!\n");
return 0;
}
'';
in
stdenv.mkDerivation rec {
version = "0.0.1";
name = "lto-c";
buildInputs = [ stdenv which strace ];
src = hello_c;
dontUnpack = true;
dontConfigure = true;
NIX_DEBUG = 0;
buildPhase = ''
set -x
echo CC=$CC
echo LD=$LD
echo -------------------------------------------
env
echo -------------------------------------------
cp ${hello_c} hello.c
$CC -v -flto hello.c -o hello
./hello
set +x
'';
installPhase = ''
touch $out
'';
}