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 # the derivation at which the `-B` and `-L` flags added by `useCcForLibs` will point
, gccForLibs ? if useCcForLibs then cc else null , gccForLibs ? if useCcForLibs then cc else null
, tmpDropB ? false # temporary hack; see PR #225846
}: }:
with lib; with lib;
@ -335,9 +336,11 @@ stdenv.mkDerivation {
## ##
## GCC libs for non-GCC support ## 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 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/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags
echo "-L${gccForLibs.lib}/${targetPlatform.config}/lib" >> $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 { lowPrio, newScope, pkgs, lib, stdenv, cmake
, stdenv-tmpDropB
, gccForLibs, preLibcCrossHeaders , gccForLibs, preLibcCrossHeaders
, libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith , libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross , buildLlvmTools # tools, but from the previous stage, for cross
@ -243,7 +244,7 @@ let
inherit llvm_meta; inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv; else stdenv-tmpDropB;
}; };
# N.B. condition is safe because without useLLVM both are the same. # N.B. condition is safe because without useLLVM both are the same.

View File

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

View File

@ -15558,6 +15558,9 @@ with pkgs;
llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { }); 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 { lorri = callPackage ../tools/misc/lorri {
inherit (darwin.apple_sdk.frameworks) CoreServices Security; inherit (darwin.apple_sdk.frameworks) CoreServices Security;
}; };