Merge #115406: stdenv riscv64-linux: cross-compile boot
commit9bd3cf0063b80428bd85a286205adab4b6ffcbd6
authorVladimír Čunát <v@cunat.cz>
dateMon 29 Nov 2021, 20:24 (5 years ago)
parentbf2e83c8cf96b9
pkgs/build-support/bintools-wrapper/default.nix+2
@@ -81,6 +81,8 @@ let
8181 else if targetPlatform.system == "aarch64-linux" then "${sharedLibraryLoader}/lib/ld-linux-aarch64.so.1"
8282 else if targetPlatform.system == "powerpc-linux" then "${sharedLibraryLoader}/lib/ld.so.1"
8383 else if targetPlatform.isMips then "${sharedLibraryLoader}/lib/ld.so.1"
84+ # `ld-linux-riscv{32,64}-<abi>.so.1`
85+ else if targetPlatform.isRiscV then "${sharedLibraryLoader}/lib/ld-linux-riscv*.so.1"
8486 else if targetPlatform.isDarwin then "/usr/lib/dyld"
8587 else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1"
8688 else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
pkgs/stdenv/linux/default.nix+4
@@ -279,6 +279,10 @@ in
279279 };
280280 };
281281 };
282+
283+ # `libtool` comes with obsolete config.sub/config.guess that don't recognize Risc-V.
284+ extraNativeBuildInputs =
285+ lib.optional (localSystem.isRiscV) prevStage.updateAutotoolsGnuConfigScriptsHook;
282286 })
283287
284288
pkgs/stdenv/linux/make-bootstrap-tools.nix+5
@@ -160,6 +160,11 @@ in with pkgs; rec {
160160 # pkgs/stdenv/linux/default.nix for the details.
161161 cp -d ${isl_0_20.out}/lib/libisl*.so* $out/lib
162162
163+ '' + lib.optionalString (stdenv.hostPlatform.isRiscV) ''
164+ # libatomic is required on RiscV platform for C/C++ atomics and pthread
165+ # even though they may be translated into native instructions.
166+ cp -d ${bootGCC.out}/lib/libatomic.a* $out/lib
167+
163168 '' + ''
164169 cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
165170