gcc/binutils: disable sysv style hash tables for generated binaries
[openwrt/staging/nbd.git] / toolchain / gcc / common.mk
index 926418f4a774376ed8c533f3d05a817d45cca3df..48c4ba40f2e946e918268c5ad9870fbb5a3825fd 100644 (file)
@@ -23,28 +23,26 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=gcc
 GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
 PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
+GCC_MAJOR_VERSION:=$(word 1,$(subst ., ,$(PKG_VERSION)))
 GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
 
 PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-
-ifeq ($(PKG_VERSION),8.4.0)
-  PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
-endif
-
-ifeq ($(PKG_VERSION),10.3.0)
-  PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
-endif
+PKG_CPE_ID:=cpe:/a:gnu:gcc
 
 ifeq ($(PKG_VERSION),11.3.0)
   PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
 endif
 
-ifeq ($(PKG_VERSION),12.1.0)
-  PKG_HASH:=62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b
+ifeq ($(PKG_VERSION),12.3.0)
+  PKG_HASH:=949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b
 endif
 
-PATCH_DIR=../patches/$(GCC_VERSION)
+ifeq ($(PKG_VERSION),13.2.0)
+  PKG_HASH:=e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da
+endif
+
+PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
 
 BUGURL=http://bugs.openwrt.org/
 PKGVERSION=OpenWrt GCC $(PKG_VERSION) $(REVISION)
@@ -73,23 +71,22 @@ TAR_OPTIONS += \
        --exclude-from='$(CURDIR)/../exclude-testsuite' --exclude=gcc/ada/*.ad* \
        --exclude=libjava
 
+# this needs to be without -L/-lzstd flags or other parts fail to build
+# use an absolute path to ensure it really picks up our version
+export ac_cv_search_ZSTD_compress=$(STAGING_DIR_HOST)/lib/libzstd.a -pthread
 export libgcc_cv_fixed_point=no
 ifdef CONFIG_INSTALL_GCCGO
   export libgo_cv_c_split_stack_supported=no
 endif
 
 ifdef CONFIG_GCC_USE_GRAPHITE
-  GRAPHITE_CONFIGURE:= --with-isl=$(TOPDIR)/staging_dir/host
+  GRAPHITE_CONFIGURE:= --with-isl=$(STAGING_DIR_HOST)
 else
   GRAPHITE_CONFIGURE:= --without-isl --without-cloog
 endif
 
 GCC_CONFIGURE:= \
        SHELL="$(BASH)" \
-       $(if $(shell gcc --version 2>&1 | grep -E "Apple.(LLVM|clang)"), \
-               CFLAGS="-O2 -fbracket-depth=512 -pipe" \
-               CXXFLAGS="-O2 -fbracket-depth=512 -pipe" \
-       ) \
        $(HOST_SOURCE_DIR)/configure \
                --with-bugurl=$(BUGURL) \
                --with-pkgversion="$(PKGVERSION)" \
@@ -107,15 +104,18 @@ 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 \
                        --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
                $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
                $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
-               --with-gmp=$(TOPDIR)/staging_dir/host \
-               --with-mpfr=$(TOPDIR)/staging_dir/host \
-               --with-mpc=$(TOPDIR)/staging_dir/host \
+               --with-system-zlib=$(STAGING_DIR_HOST) \
+               --with-zstd=$(STAGING_DIR_HOST) \
+               --with-gmp=$(STAGING_DIR_HOST) \
+               --with-mpfr=$(STAGING_DIR_HOST) \
+               --with-mpc=$(STAGING_DIR_HOST) \
                --disable-decimal-float \
                --with-diagnostics-color=auto-if-env \
                --enable-__cxa_atexit \
@@ -171,13 +171,21 @@ ifeq ($(CONFIG_TARGET_x86)$(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yyy)
   TARGET_CFLAGS+=-fno-split-stack
 endif
 
+CFLAGS:=$(HOST_CFLAGS) -pipe
+ifneq ($(shell gcc --version 2>&1 | grep -E "Apple.(LLVM|clang)"),)
+  CFLAGS+= -fbracket-depth=512
+endif
+
+GCC_CONFIGURE+= \
+       CFLAGS="$(CFLAGS)" \
+       CXXFLAGS="$(CFLAGS)" \
+       CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+       CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+       GOCFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
+
 GCC_MAKE:= \
        export SHELL="$(BASH)"; \
-       $(MAKE) \
-               CFLAGS="$(HOST_CFLAGS)" \
-               CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
-               CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
-               GOCFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
+       $(MAKE)
 
 define Host/SetToolchainInfo
        $(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
@@ -185,10 +193,10 @@ define Host/SetToolchainInfo
 endef
 
 
-ifdef CONFIG_GCC_USE_VERSION_12
-       GCC_VERSION_FILE:=gcc/genversion.cc
-else
+ifeq ($(GCC_MAJOR_VERSION),11)
        GCC_VERSION_FILE:=gcc/version.c
+else
+       GCC_VERSION_FILE:=gcc/genversion.cc
 endif
 
 ifneq ($(GCC_PREPARE),)