diff options
Diffstat (limited to 'pkgs/development/compilers/rust/rustc.nix')
-rw-r--r-- | pkgs/development/compilers/rust/rustc.nix | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 8defaeaea9241..e00ba329ccdc4 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -103,7 +103,9 @@ in stdenv.mkDerivation (finalAttrs: { stdenv.targetPlatform.rust.rustcTargetSpec # Other targets that don't need any extra dependencies to build. - ] ++ optionals (!fastCross) [ + # Temporarily broken if some global compiler flags are set: + # https://github.com/NixOS/nixpkgs/pull/317273 + ] ++ optionals (!fastCross && !lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] && stdenv.hostPlatform.gcc.thumb or true) [ "wasm32-unknown-unknown" # (build!=target): When cross-building a compiler we need to add @@ -139,6 +141,10 @@ in stdenv.mkDerivation (finalAttrs: { "${setBuild}.llvm-config=${llvmSharedForBuild.dev}/bin/llvm-config" "${setHost}.llvm-config=${llvmSharedForHost.dev}/bin/llvm-config" "${setTarget}.llvm-config=${llvmSharedForTarget.dev}/bin/llvm-config" + ] ++ optionals fastCross [ + # Since fastCross only builds std, it doesn't make sense (and + # doesn't work) to build a linker. + "--disable-llvm-bitcode-linker" ] ++ optionals (stdenv.isLinux && !stdenv.targetPlatform.isRedox) [ "--enable-profiler" # build libprofiler_builtins ] ++ optionals stdenv.buildPlatform.isMusl [ @@ -192,6 +198,12 @@ in stdenv.mkDerivation (finalAttrs: { postPatch = '' patchShebangs src/etc + # rust-lld is the name rustup uses for its bundled lld, so that it + # doesn't conflict with any system lld. This is not an + # appropriate default for Nixpkgs, where there is no rust-lld. + substituteInPlace compiler/rustc_target/src/spec/*/*.rs \ + --replace-quiet '"rust-lld"' '"lld"' + ${optionalString (!withBundledLLVM) "rm -rf src/llvm"} # Useful debugging parameter |