From e04f6638b02e59156f8239bed47a57db992e1607 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 16 Aug 2022 19:35:50 +0200
Subject: [PATCH] gcc/binutils: disable sysv style hash tables for generated
 binaries

GNU hash tables are always preferred by musl, so the sysv ones are completely
unused and only waste space. Reduces image size by ~1.4%

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 toolchain/binutils/Makefile | 1 +
 toolchain/build_version     | 2 +-
 toolchain/gcc/common.mk     | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index 63f0e07ccf..2c715d45ee 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -49,6 +49,7 @@ HOST_CONFIGURE_ARGS = \
 	--with-system-zlib \
 	--with-zstd \
 	--enable-deterministic-archives \
+	$(if $(findstring mips,$(ARCH)),,--enable-default-hash-style=gnu) \
 	--enable-plugins \
 	--enable-lto \
 	--disable-gprofng \
diff --git a/toolchain/build_version b/toolchain/build_version
index d00491fd7e..0cfbf08886 100644
--- a/toolchain/build_version
+++ b/toolchain/build_version
@@ -1 +1 @@
-1
+2
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index 0ccf55bd31..9170da5bf0 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -108,6 +108,7 @@ GCC_CONFIGURE:= \
 		--disable-libssp \
 		$(GRAPHITE_CONFIGURE) \
 		--with-host-libstdcxx=-lstdc++ \
+		$(if $(findstring mips,$(ARCH)),,--with-linker-hash-style=gnu) \
 		$(SOFT_FLOAT_CONFIG_OPTION) \
 		$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
 		$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
-- 
2.30.2