Skip to content

Commit

Permalink
llvmPackages_15: apply some patches from llvmPackages_14
Browse files Browse the repository at this point in the history
  • Loading branch information
rrbutani committed Jan 10, 2023
1 parent db32172 commit 589713c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
2 changes: 2 additions & 0 deletions pkgs/development/compilers/llvm/15/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
patchShebangs $python/bin
mkdir -p $dev/bin
cp bin/clang-tblgen $dev/bin
Expand All @@ -108,6 +109,7 @@ let
of tools that can be built using the Clang frontend as a library to
parse C/C++ code.
'';
mainProgram = "clang";
};
} // lib.optionalAttrs enableManpages {
pname = "clang-manpages";
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/15/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib, stdenv, llvm_meta, version
, monorepoSrc, runCommand
, cmake, python3, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let
Expand Down Expand Up @@ -46,6 +47,8 @@ stdenv.mkDerivation {
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
"-DCOMPILER_RT_BUILD_MEMPROF=OFF"
"-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary
] ++ lib.optionals (useLLVM || bareMetal) [
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
] ++ lib.optionals ((useLLVM && !haveLibc) || bareMetal) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
Expand Down Expand Up @@ -107,6 +110,8 @@ stdenv.mkDerivation {
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
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
5 changes: 3 additions & 2 deletions pkgs/development/compilers/llvm/15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
# This is the default binutils, but with *this* version of LLD rather
# than the default LLVM verion's, if LLD is the choice. We use these for
# the `useLLVM` bootstrapping below.
Expand Down Expand Up @@ -166,7 +167,7 @@ let
]
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
++ lib.optional
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
"-lunwind"
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
Expand Down Expand Up @@ -273,7 +274,7 @@ let
};

openmp = callPackage ./openmp {
inherit llvm_meta;
inherit llvm_meta targetLlvm;
};
});

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/15/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
'';

nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = [
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/llvm/15/lld/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ stdenv.mkDerivation rec {
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
];
LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";

outputs = [ "out" "lib" "dev" ];

Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/compilers/llvm/15/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
, debugVersion ? false
, enableManpages ? false
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
)
# broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
# broken for the armv7l builder
, enablePFM ? stdenv.isLinux && !stdenv.hostPlatform.isAarch
, enablePolly ? false
} @args:

Expand Down Expand Up @@ -141,6 +140,7 @@ in stdenv.mkDerivation (rec {
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
"-DLLVM_LINK_LLVM_DYLIB=off"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
# file and doesn't link zlib as well.
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/compilers/llvm/15/openmp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, runCommand
, cmake
, llvm
, targetLlvm
, lit
, clang-unwrapped
, perl
Expand Down Expand Up @@ -33,7 +34,9 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];

nativeBuildInputs = [ cmake perl pkg-config lit ];
buildInputs = [ llvm ];
buildInputs = [
(if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
];

# Unsup:Pass:XFail:Fail
# 26:267:16:8
Expand Down
3 changes: 1 addition & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15052,8 +15052,7 @@ with pkgs;
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_15.tools;
targetLlvmLibraries = targetPackages.llvmPackages_15.libraries or llvmPackages_15.libraries;
} // lib.optionalAttrs (stdenv.hostPlatform.isi686 && stdenv.hostPlatform == stdenv.buildPlatform && buildPackages.stdenv.cc.isGNU) {
stdenv = gcc7Stdenv;
targetLlvm = targetPackages.llvmPackages_15.llvm or llvmPackages_15.llvm;
}));

llvmPackages_latest = llvmPackages_14;
Expand Down

0 comments on commit 589713c

Please sign in to comment.