cc-wrapper: add optional temporary hack for -B

This fixes parts in llvmPackages_{13,rocm}
e.g. build .clang for testing.
Longterm mass-rebuild fix should come in PR #225846
This commit is contained in:
Vladimír Čunát 2023-04-12 09:34:40 +02:00
parent 4d4fee11d0
commit ac3acd956f
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
4 changed files with 12 additions and 2 deletions

View File

@ -52,6 +52,7 @@
# the derivation at which the `-B` and `-L` flags added by `useCcForLibs` will point
, gccForLibs ? if useCcForLibs then cc else null
, tmpDropB ? false # temporary hack; see PR #225846
}:
with lib;
@ -335,9 +336,11 @@ stdenv.mkDerivation {
##
## GCC libs for non-GCC support
##
+ optionalString useGccForLibs ''
+ optionalString (useGccForLibs && !tmpDropB) ''
echo "-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-cflags
''
+ optionalString useGccForLibs ''
echo "-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags
echo "-L${gccForLibs.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags
''

View File

@ -1,4 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
, stdenv-tmpDropB
, gccForLibs, preLibcCrossHeaders
, libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
@ -243,7 +244,7 @@ let
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
else stdenv-tmpDropB;
};
# N.B. condition is safe because without useLLVM both are the same.

View File

@ -1,5 +1,6 @@
{ lib
, stdenv
, stdenv-tmpDropB
, callPackage
, overrideCC
, wrapCCWith
@ -78,6 +79,8 @@ let
# Runtimes
runtimes = callPackage ./llvm.nix {
stdenv = stdenv-tmpDropB;
buildDocs = false;
buildMan = false;
buildTests = false;

View File

@ -15558,6 +15558,9 @@ with pkgs;
llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { });
# temporary hack; see PR #225846
stdenv-tmpDropB = overrideCC stdenv (wrapCCWith { tmpDropB = true; inherit (stdenv.cc) cc; });
lorri = callPackage ../tools/misc/lorri {
inherit (darwin.apple_sdk.frameworks) CoreServices Security;
};