diff --git a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix index a84d35f09b56..03f3afa4ad72 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix @@ -20,11 +20,16 @@ let # Based on https://github.com/ZilchOS/bootstrap-from-tcc/blob/2e0c68c36b3437386f786d619bc9a16177f2e149/using-nix/2a1-static-binutils.nix inherit (import ./common.nix { inherit lib; }) meta; pname = "binutils"; - version = "2.41"; + + # Unfortunately, this is the latest version (as of 2.45.1) that works for + # - tinycc that compiles gcc 4.6.4 (ar in 2.45.* produce incompatible archives for tcc linker) + # - gcc 4.6.4 that compiles musl 1.2.5 (ld crashes in 2.43 and 2.44) + # This might need some further investigation. + version = "2.42"; src = fetchurl { url = "mirror://gnu/binutils/binutils-${version}.tar.xz"; - hash = "sha256-rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA="; + hash = "sha256-9uTUH9X8d4sGt4kUV7NiDaXs6hAGxqSkGumYEJ+FqAA="; }; patches = [ @@ -98,6 +103,12 @@ bash.runCommand "${pname}-${version}" export CC="tcc -B ${tinycc.libs}/lib" export AR="tcc -ar" export lt_cv_sys_max_cmd_len=32768 + + # binutils 2.42 has a broken check for TLS storage class, which results + # in the TLS macro begin undefined. + # Let's help it along. We won't need TLS anyway. + export ac_cv_tls=" " + export CFLAGS="-D__LITTLE_ENDIAN__=1" bash ./configure ${lib.concatStringsSep " " configureFlags}