@@ -58,7 +58,7 @@ let
5858 else if (with targetPlatform; isArm && isLinux) then "${libc_lib}/lib/ld-linux*.so.3"
5959 else if targetPlatform.system == "aarch64-linux" then "${libc_lib}/lib/ld-linux-aarch64.so.1"
6060 else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1"
61− else if targetPlatform.system == "mips64el-linux" then "${libc_lib}/lib/ld.so.1"
61+ else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1"
6262 else if targetPlatform.isDarwin then "/usr/lib/dyld"
6363 else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
6464 else null;
@@ -171,13 +171,20 @@ stdenv.mkDerivation {
171171 else if targetPlatform.isWindows then "pe"
172172 else "elf" + toString targetPlatform.parsed.cpu.bits;
173173 endianPrefix = if targetPlatform.isBigEndian then "big" else "little";
174+ sep = optionalString (targetPlatform.isx86 || targetPlatform.isArm) "-";
174175 arch =
175176 /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64"
176177 else if targetPlatform.isArm then endianPrefix + "arm"
177178 else if targetPlatform.isx86_64 then "x86-64"
178179 else if targetPlatform.isi686 then "i386"
180+ else if targetPlatform.isMips then {
181+ "mips" = "btsmipn32"; # n32 variant
182+ "mipsel" = "ltsmipn32"; # n32 variant
183+ "mips64" = "btsmip";
184+ "mips64el" = "ltsmip";
185+ }.${targetPlatform.parsed.cpu.name}
179186 else throw "unknown emulation for platform: " + targetPlatform.config;
180− in targetPlatform.platform.bfdEmulation or (fmt + "-" + arch);
187+ in targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
181188
182189 depsTargetTargetPropagated = extraPackages;
183190