minimal-bootstrap.binutils: 2.42 -> 2.46.0

This commit is contained in:
Aleksi Hannula
2026-02-28 10:31:08 +02:00
parent c5bfaab642
commit 3cd60b6a1b
2 changed files with 17 additions and 12 deletions
@@ -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}
@@ -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