diff --git a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix index 3b2a772797bf..dd69efc0c641 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix @@ -20,21 +20,18 @@ 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"; - - # 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"; + version = "2.46.0"; src = fetchurl { url = "mirror://gnu/binutils/binutils-${version}.tar.xz"; - hash = "sha256-9uTUH9X8d4sGt4kUV7NiDaXs6hAGxqSkGumYEJ+FqAA="; + hash = "sha256-11qU9Nc+ekCG91E+Z+Q56Pzcu3Jv/mP0ZhdE5iVrLPI="; }; patches = [ # Make binutils output deterministic by default. ./deterministic.patch + # Fix __attribute__, to fix mmap-related assertion failures. + ./fix-tinycc-attribute.patch ]; configureFlags = [ @@ -105,11 +102,6 @@ bash.runCommand "${pname}-${version}" 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} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/binutils/fix-tinycc-attribute.patch b/pkgs/os-specific/linux/minimal-bootstrap/binutils/fix-tinycc-attribute.patch new file mode 100644 index 000000000000..ec5371c71e8d --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/binutils/fix-tinycc-attribute.patch @@ -0,0 +1,13 @@ +diff --git a/include/ansidecl.h b/include/ansidecl.h +index 0ae6a986..214a41f9 100644 +--- a/include/ansidecl.h ++++ b/include/ansidecl.h +@@ -68,7 +68,7 @@ So instead we use the macro below and test it against specific values. */ + macros freely, and know that they will come into play for the + version of gcc in which they are supported. */ + +-#if (GCC_VERSION < 2007) ++#if (GCC_VERSION < 2007) && !defined(__TINYC__) + # define __attribute__(x) + #endif +