1*4882a593Smuzhiyun################################################################################ 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# Common variables for the gcc-initial and gcc-final packages. 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun################################################################################ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun# 8*4882a593Smuzhiyun# Version, site and source 9*4882a593Smuzhiyun# 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunGCC_VERSION = $(call qstrip,$(BR2_GCC_VERSION)) 12*4882a593Smuzhiyun 13*4882a593Smuzhiyunifeq ($(BR2_GCC_VERSION_ARC),y) 14*4882a593SmuzhiyunGCC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,gcc,$(GCC_VERSION)) 15*4882a593SmuzhiyunGCC_SOURCE = gcc-$(GCC_VERSION).tar.gz 16*4882a593Smuzhiyunelse 17*4882a593SmuzhiyunGCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION) 18*4882a593SmuzhiyunGCC_SOURCE = gcc-$(GCC_VERSION).tar.xz 19*4882a593Smuzhiyunendif 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun# 22*4882a593Smuzhiyun# Xtensa special hook 23*4882a593Smuzhiyun# 24*4882a593Smuzhiyundefine HOST_GCC_XTENSA_OVERLAY_EXTRACT 25*4882a593Smuzhiyun $(call arch-xtensa-overlay-extract,$(@D),gcc) 26*4882a593Smuzhiyunendef 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun# 29*4882a593Smuzhiyun# Apply patches 30*4882a593Smuzhiyun# 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun# gcc is a special package, not named gcc, but gcc-initial and 33*4882a593Smuzhiyun# gcc-final, but patches are nonetheless stored in package/gcc in the 34*4882a593Smuzhiyun# tree, and potentially in BR2_GLOBAL_PATCH_DIR directories as well. 35*4882a593Smuzhiyundefine HOST_GCC_APPLY_PATCHES 36*4882a593Smuzhiyun for patchdir in \ 37*4882a593Smuzhiyun package/gcc/$(GCC_VERSION) \ 38*4882a593Smuzhiyun $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ 39*4882a593Smuzhiyun $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) ; do \ 40*4882a593Smuzhiyun if test -d $${patchdir}; then \ 41*4882a593Smuzhiyun $(APPLY_PATCHES) $(@D) $${patchdir} \*.patch || exit 1; \ 42*4882a593Smuzhiyun fi; \ 43*4882a593Smuzhiyun done 44*4882a593Smuzhiyun $(HOST_GCC_APPLY_POWERPC_PATCH) 45*4882a593Smuzhiyunendef 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunHOST_GCC_EXCLUDES = \ 48*4882a593Smuzhiyun libjava/* libgo/* 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun# 51*4882a593Smuzhiyun# Create 'build' directory and configure symlink 52*4882a593Smuzhiyun# 53*4882a593Smuzhiyun 54*4882a593Smuzhiyundefine HOST_GCC_CONFIGURE_SYMLINK 55*4882a593Smuzhiyun mkdir -p $(@D)/build 56*4882a593Smuzhiyun ln -sf ../configure $(@D)/build/configure 57*4882a593Smuzhiyunendef 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun# 60*4882a593Smuzhiyun# Common configuration options 61*4882a593Smuzhiyun# 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunHOST_GCC_COMMON_DEPENDENCIES = \ 64*4882a593Smuzhiyun host-binutils \ 65*4882a593Smuzhiyun host-gmp \ 66*4882a593Smuzhiyun host-mpc \ 67*4882a593Smuzhiyun host-mpfr \ 68*4882a593Smuzhiyun $(if $(BR2_BINFMT_FLAT),host-elf2flt) 69*4882a593Smuzhiyun 70*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS = \ 71*4882a593Smuzhiyun --target=$(GNU_TARGET_NAME) \ 72*4882a593Smuzhiyun --with-sysroot=$(STAGING_DIR) \ 73*4882a593Smuzhiyun --enable-__cxa_atexit \ 74*4882a593Smuzhiyun --with-gnu-ld \ 75*4882a593Smuzhiyun --disable-libssp \ 76*4882a593Smuzhiyun --disable-multilib \ 77*4882a593Smuzhiyun --disable-decimal-float \ 78*4882a593Smuzhiyun --enable-plugins \ 79*4882a593Smuzhiyun --enable-lto \ 80*4882a593Smuzhiyun --with-gmp=$(HOST_DIR) \ 81*4882a593Smuzhiyun --with-mpc=$(HOST_DIR) \ 82*4882a593Smuzhiyun --with-mpfr=$(HOST_DIR) \ 83*4882a593Smuzhiyun --with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \ 84*4882a593Smuzhiyun --with-bugurl="http://bugs.buildroot.net/" \ 85*4882a593Smuzhiyun --without-zstd 86*4882a593Smuzhiyun 87*4882a593Smuzhiyunifeq ($(BR2_REPRODUCIBLE),y) 88*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-debug-prefix-map=$(BASE_DIR)=buildroot 89*4882a593Smuzhiyunendif 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun# Don't build documentation. It takes up extra space / build time, 92*4882a593Smuzhiyun# and sometimes needs specific makeinfo versions to work 93*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_ENV = \ 94*4882a593Smuzhiyun MAKEINFO=missing 95*4882a593Smuzhiyun 96*4882a593SmuzhiyunGCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS) 97*4882a593SmuzhiyunGCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS) 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun# used to fix ../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized] 100*4882a593Smuzhiyunifeq ($(BR2_ENABLE_DEBUG),y) 101*4882a593SmuzhiyunGCC_COMMON_TARGET_CFLAGS += -Wno-error 102*4882a593Smuzhiyunendif 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun# Make sure libgcc & libstdc++ always get built with -matomic on ARC700 105*4882a593Smuzhiyunifeq ($(GCC_TARGET_CPU):$(BR2_ARC_ATOMIC_EXT),arc700:y) 106*4882a593SmuzhiyunGCC_COMMON_TARGET_CFLAGS += -matomic 107*4882a593SmuzhiyunGCC_COMMON_TARGET_CXXFLAGS += -matomic 108*4882a593Smuzhiyunendif 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun# Propagate options used for target software building to GCC target libs 111*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)" 112*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)" 113*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_ENV += AR_FOR_TARGET=gcc-ar NM_FOR_TARGET=gcc-nm RANLIB_FOR_TARGET=gcc-ranlib 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun# libitm needs sparc V9+ 116*4882a593Smuzhiyunifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y) 117*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libitm 118*4882a593Smuzhiyunendif 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun# libmpx uses secure_getenv and struct _libc_fpstate not present in musl 121*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_BUILDROOT_MUSL)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),yy) 122*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libmpx 123*4882a593Smuzhiyunendif 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun# quadmath support requires wchar 126*4882a593Smuzhiyunifeq ($(BR2_USE_WCHAR)$(BR2_TOOLCHAIN_HAS_LIBQUADMATH),yy) 127*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath --enable-libquadmath-support 128*4882a593Smuzhiyunelse 129*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath --disable-libquadmath-support 130*4882a593Smuzhiyunendif 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun# libsanitizer requires wordexp, not in default uClibc config. Also 133*4882a593Smuzhiyun# doesn't build properly with musl. 134*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_TOOLCHAIN_BUILDROOT_MUSL),y) 135*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer 136*4882a593Smuzhiyunendif 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun# libsanitizer is broken for SPARC 139*4882a593Smuzhiyun# https://bugs.busybox.net/show_bug.cgi?id=7951 140*4882a593Smuzhiyunifeq ($(BR2_sparc)$(BR2_sparc64),y) 141*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer 142*4882a593Smuzhiyunendif 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun# libsanitizer is available for mips64{el} since gcc 12 but fail to build 145*4882a593Smuzhiyun# with n32 ABI due to struct stat64 definition clash due to mixing 146*4882a593Smuzhiyun# kernel and user headers. 147*4882a593Smuzhiyunifeq ($(BR2_mips64)$(BR2_mips64el):$(BR2_MIPS_NABI32),y:y) 148*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer 149*4882a593Smuzhiyunendif 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun# libsanitizer bundled in gcc 12 fails to build for mips32 due to 152*4882a593Smuzhiyun# mixing kernel and user struct stat. 153*4882a593Smuzhiyunifeq ($(BR2_mips)$(BR2_mipsel):$(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y:y) 154*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer 155*4882a593Smuzhiyunendif 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun# The logic in libbacktrace/configure.ac to detect if __sync builtins 158*4882a593Smuzhiyun# are available assumes they are as soon as target_subdir is not 159*4882a593Smuzhiyun# empty, i.e when cross-compiling. However, some platforms do not have 160*4882a593Smuzhiyun# __sync builtins, so help the configure script a bit. 161*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),) 162*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_ENV += target_configargs="libbacktrace_cv_sys_sync=no" 163*4882a593Smuzhiyunendif 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun# TLS support is not needed on uClibc/no-thread and 166*4882a593Smuzhiyun# uClibc/linux-threads, otherwise, for all other situations (glibc, 167*4882a593Smuzhiyun# musl and uClibc/NPTL), we need it. 168*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_PTHREADS)$(BR2_PTHREADS_NONE),yy) 169*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --disable-tls 170*4882a593Smuzhiyunelse 171*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --enable-tls 172*4882a593Smuzhiyunendif 173*4882a593Smuzhiyun 174*4882a593Smuzhiyunifeq ($(BR2_PTHREADS_NONE),y) 175*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += \ 176*4882a593Smuzhiyun --disable-threads \ 177*4882a593Smuzhiyun --disable-libitm \ 178*4882a593Smuzhiyun --disable-libatomic 179*4882a593Smuzhiyunelse 180*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --enable-threads 181*4882a593Smuzhiyunendif 182*4882a593Smuzhiyun 183*4882a593Smuzhiyun# gcc 5 doesn't need cloog any more, see 184*4882a593Smuzhiyun# https://gcc.gnu.org/gcc-5/changes.html and we don't support graphite 185*4882a593Smuzhiyun# on GCC 4.9.x, so only isl is needed. 186*4882a593Smuzhiyunifeq ($(BR2_GCC_ENABLE_GRAPHITE),y) 187*4882a593SmuzhiyunHOST_GCC_COMMON_DEPENDENCIES += host-isl 188*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-isl=$(HOST_DIR) 189*4882a593Smuzhiyunelse 190*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog 191*4882a593Smuzhiyunendif 192*4882a593Smuzhiyun 193*4882a593Smuzhiyunifeq ($(BR2_arc),y) 194*4882a593SmuzhiyunHOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison 195*4882a593Smuzhiyunendif 196*4882a593Smuzhiyun 197*4882a593Smuzhiyunifeq ($(BR2_SOFT_FLOAT),y) 198*4882a593Smuzhiyun# only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float 199*4882a593Smuzhiyun# powerpc seems to be needing it as well 200*4882a593Smuzhiyunifeq ($(BR2_arm)$(BR2_armeb)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),y) 201*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-float=soft 202*4882a593Smuzhiyunendif 203*4882a593Smuzhiyunendif 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun# Determine arch/tune/abi/cpu options 206*4882a593Smuzhiyunifneq ($(GCC_TARGET_ARCH),) 207*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-arch="$(GCC_TARGET_ARCH)" 208*4882a593Smuzhiyunendif 209*4882a593Smuzhiyunifneq ($(GCC_TARGET_ABI),) 210*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-abi="$(GCC_TARGET_ABI)" 211*4882a593Smuzhiyunendif 212*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_MNAN_OPTION),y) 213*4882a593Smuzhiyunifneq ($(GCC_TARGET_NAN),) 214*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-nan="$(GCC_TARGET_NAN)" 215*4882a593Smuzhiyunendif 216*4882a593Smuzhiyunendif 217*4882a593Smuzhiyunifneq ($(GCC_TARGET_FP32_MODE),) 218*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-fp-32="$(GCC_TARGET_FP32_MODE)" 219*4882a593Smuzhiyunendif 220*4882a593Smuzhiyunifneq ($(GCC_TARGET_CPU),) 221*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(GCC_TARGET_CPU) 222*4882a593Smuzhiyunendif 223*4882a593Smuzhiyun 224*4882a593Smuzhiyunifneq ($(GCC_TARGET_FPU),) 225*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-fpu=$(GCC_TARGET_FPU) 226*4882a593Smuzhiyunendif 227*4882a593Smuzhiyun 228*4882a593Smuzhiyunifneq ($(GCC_TARGET_FLOAT_ABI),) 229*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI) 230*4882a593Smuzhiyunendif 231*4882a593Smuzhiyun 232*4882a593Smuzhiyunifneq ($(GCC_TARGET_MODE),) 233*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE) 234*4882a593Smuzhiyunendif 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun# Enable proper double/long double for SPE ABI 237*4882a593Smuzhiyunifeq ($(BR2_powerpc_SPE),y) 238*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += \ 239*4882a593Smuzhiyun --enable-obsolete \ 240*4882a593Smuzhiyun --enable-e500_double \ 241*4882a593Smuzhiyun --with-long-double-128 242*4882a593Smuzhiyunendif 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun# Set default to Secure-PLT to prevent run-time 245*4882a593Smuzhiyun# generation of PLT stubs (supports RELRO and 246*4882a593Smuzhiyun# SELinux non-exemem capabilities) 247*4882a593Smuzhiyunifeq ($(BR2_powerpc)$(BR2_powerpc64),y) 248*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += --enable-secureplt 249*4882a593Smuzhiyunendif 250*4882a593Smuzhiyun 251*4882a593Smuzhiyun# PowerPC64 big endian by default uses the elfv1 ABI, and PowerPC 64 252*4882a593Smuzhiyun# little endian by default uses the elfv2 ABI. However, musl has 253*4882a593Smuzhiyun# decided to use the elfv2 ABI for both, so we force the elfv2 ABI for 254*4882a593Smuzhiyun# Power64 big endian when the selected C library is musl. 255*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_powerpc64),yy) 256*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += \ 257*4882a593Smuzhiyun --with-abi=elfv2 \ 258*4882a593Smuzhiyun --without-long-double-128 259*4882a593Smuzhiyunendif 260*4882a593Smuzhiyun 261*4882a593Smuzhiyun# Since glibc >= 2.26, poerpc64le requires double/long double which 262*4882a593Smuzhiyun# requires at least gcc 6.2. 263*4882a593Smuzhiyun# See sysdeps/powerpc/powerpc64le/configure.ac 264*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_GLIBC)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6)$(BR2_powerpc64le),yyy) 265*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += \ 266*4882a593Smuzhiyun --with-long-double-128 267*4882a593Smuzhiyunendif 268*4882a593Smuzhiyun 269*4882a593Smuzhiyunifeq ($(BR2_s390x),y) 270*4882a593SmuzhiyunHOST_GCC_COMMON_CONF_OPTS += \ 271*4882a593Smuzhiyun --with-long-double-128 272*4882a593Smuzhiyunendif 273*4882a593Smuzhiyun 274*4882a593SmuzhiyunHOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"' 275*4882a593Smuzhiyun 276*4882a593Smuzhiyun# For gcc-initial, we need to tell gcc that the C library will be 277*4882a593Smuzhiyun# providing the ssp support, as it can't guess it since the C library 278*4882a593Smuzhiyun# hasn't been built yet. 279*4882a593Smuzhiyun# 280*4882a593Smuzhiyun# For gcc-final, the gcc logic to detect whether SSP support is 281*4882a593Smuzhiyun# available or not in the C library is not working properly for 282*4882a593Smuzhiyun# uClibc, so let's be explicit as well. 283*4882a593SmuzhiyunHOST_GCC_COMMON_MAKE_OPTS = \ 284*4882a593Smuzhiyun gcc_cv_libc_provides_ssp=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no) 285*4882a593Smuzhiyun 286*4882a593Smuzhiyunifeq ($(BR2_CCACHE),y) 287*4882a593SmuzhiyunHOST_GCC_COMMON_CCACHE_HASH_FILES += $($(PKG)_DL_DIR)/$(GCC_SOURCE) 288*4882a593Smuzhiyun 289*4882a593Smuzhiyun# Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned 290*4882a593Smuzhiyun# and unversioned patches unconditionally. Moreover, to facilitate the 291*4882a593Smuzhiyun# addition of gcc patches in BR2_GLOBAL_PATCH_DIR, we allow them to be 292*4882a593Smuzhiyun# stored in a sub-directory called 'gcc' even if it's not technically 293*4882a593Smuzhiyun# the name of the package. 294*4882a593SmuzhiyunHOST_GCC_COMMON_CCACHE_HASH_FILES += \ 295*4882a593Smuzhiyun $(sort $(wildcard \ 296*4882a593Smuzhiyun package/gcc/$(GCC_VERSION)/*.patch \ 297*4882a593Smuzhiyun $(addsuffix /$($(PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ 298*4882a593Smuzhiyun $(addsuffix /$($(PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ 299*4882a593Smuzhiyun $(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ 300*4882a593Smuzhiyun $(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) 301*4882a593Smuzhiyunifeq ($(BR2_xtensa),y) 302*4882a593SmuzhiyunHOST_GCC_COMMON_CCACHE_HASH_FILES += $(ARCH_XTENSA_OVERLAY_FILE) 303*4882a593Smuzhiyunendif 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun# _CONF_OPTS contains some references to the absolute path of $(HOST_DIR) 306*4882a593Smuzhiyun# and a reference to the Buildroot git revision (BR2_VERSION_FULL), 307*4882a593Smuzhiyun# so substitute those away. 308*4882a593SmuzhiyunHOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_HASH=\"`\ 309*4882a593Smuzhiyun printf '%s\n' $(subst $(HOST_DIR),@HOST_DIR@,\ 310*4882a593Smuzhiyun $(subst --with-pkgversion="Buildroot $(BR2_VERSION_FULL)",,$($(PKG)_CONF_OPTS))) \ 311*4882a593Smuzhiyun | sha256sum - $(HOST_GCC_COMMON_CCACHE_HASH_FILES) \ 312*4882a593Smuzhiyun | cut -c -64 | tr -d '\n'`\" 313*4882a593Smuzhiyunendif # BR2_CCACHE 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun# The LTO support in gcc creates wrappers for ar, ranlib and nm which load 316*4882a593Smuzhiyun# the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and 317*4882a593Smuzhiyun# *-gcc-nm and should be used instead of the real programs when -flto is 318*4882a593Smuzhiyun# used. However, we should not add the toolchain wrapper for them, and they 319*4882a593Smuzhiyun# match the *cc-* pattern. Therefore, an additional case is added for *-ar, 320*4882a593Smuzhiyun# *-ranlib and *-nm. 321*4882a593Smuzhiyun# According to gfortran manpage, it supports all options supported by gcc, so 322*4882a593Smuzhiyun# add gfortran to the list of the program called via the Buildroot wrapper. 323*4882a593Smuzhiyun# Avoid that a .br_real is symlinked a second time. 324*4882a593Smuzhiyun# Also create <arch>-linux-<tool> symlinks. 325*4882a593Smuzhiyundefine HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS 326*4882a593Smuzhiyun $(Q)cd $(HOST_DIR)/bin; \ 327*4882a593Smuzhiyun for i in $(GNU_TARGET_NAME)-*; do \ 328*4882a593Smuzhiyun case "$$i" in \ 329*4882a593Smuzhiyun *.br_real) \ 330*4882a593Smuzhiyun ;; \ 331*4882a593Smuzhiyun *-ar|*-ranlib|*-nm) \ 332*4882a593Smuzhiyun ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ 333*4882a593Smuzhiyun ;; \ 334*4882a593Smuzhiyun *cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc) \ 335*4882a593Smuzhiyun rm -f $$i.br_real; \ 336*4882a593Smuzhiyun mv $$i $$i.br_real; \ 337*4882a593Smuzhiyun ln -sf toolchain-wrapper $$i; \ 338*4882a593Smuzhiyun ln -sf toolchain-wrapper $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ 339*4882a593Smuzhiyun ln -snf $$i.br_real $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}.br_real; \ 340*4882a593Smuzhiyun ;; \ 341*4882a593Smuzhiyun *) \ 342*4882a593Smuzhiyun ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ 343*4882a593Smuzhiyun ;; \ 344*4882a593Smuzhiyun esac; \ 345*4882a593Smuzhiyun done 346*4882a593Smuzhiyun 347*4882a593Smuzhiyunendef 348*4882a593Smuzhiyun 349*4882a593Smuzhiyuninclude $(sort $(wildcard package/gcc/*/*.mk)) 350