blob: 5e419f7ede29aa2487a869c949bdd58dbb492e6e [file] [log] [blame]
Thomas Petazzonif1983182013-06-30 21:28:59 +02001################################################################################
2#
Thomas Petazzoni45893482014-09-14 11:50:00 +02003# Common variables for the gcc-initial and gcc-final packages.
Thomas Petazzonif1983182013-06-30 21:28:59 +02004#
5################################################################################
6
7#
8# Version, site and source
9#
10
11GCC_VERSION = $(call qstrip,$(BR2_GCC_VERSION))
12
Alexey Brodkinb09586c2017-11-10 00:56:48 +030013ifeq ($(BR2_GCC_VERSION_ARC),y)
Mischa Jonker3ce65522013-12-05 18:20:49 +010014GCC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,gcc,$(GCC_VERSION))
15GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
Romain Naoura85b4642020-03-13 00:41:26 +010016else ifeq ($(BR2_GCC_VERSION_CSKY),y)
Guo Ren7873a5b2019-05-31 14:39:04 +080017GCC_SITE = $(call github,c-sky,gcc,$(GCC_VERSION))
18GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
Peter Korsgaard42ebd742014-04-30 00:27:51 +020019else
Thomas Petazzonif1983182013-06-30 21:28:59 +020020GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION)
Romain Naour91b1fbb2018-05-29 23:52:55 +020021GCC_SOURCE = gcc-$(GCC_VERSION).tar.xz
22endif
Thomas Petazzonif1983182013-06-30 21:28:59 +020023
Thomas Petazzonif1983182013-06-30 21:28:59 +020024#
25# Xtensa special hook
26#
Thomas Petazzonif1983182013-06-30 21:28:59 +020027define HOST_GCC_XTENSA_OVERLAY_EXTRACT
Yann E. MORIN2b34da92017-03-14 11:30:38 -070028 $(call arch-xtensa-overlay-extract,$(@D),gcc)
Thomas Petazzonif1983182013-06-30 21:28:59 +020029endef
30
31#
32# Apply patches
33#
34
He Chunhui93046752016-04-13 04:20:32 +000035# gcc is a special package, not named gcc, but gcc-initial and
36# gcc-final, but patches are nonetheless stored in package/gcc in the
37# tree, and potentially in BR2_GLOBAL_PATCH_DIR directories as well.
Thomas Petazzonif1983182013-06-30 21:28:59 +020038define HOST_GCC_APPLY_PATCHES
He Chunhui93046752016-04-13 04:20:32 +000039 for patchdir in \
40 package/gcc/$(GCC_VERSION) \
41 $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
42 $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) ; do \
43 if test -d $${patchdir}; then \
44 $(APPLY_PATCHES) $(@D) $${patchdir} \*.patch || exit 1; \
45 fi; \
46 done
Thomas Petazzoni197006a2013-07-05 10:40:52 +020047 $(HOST_GCC_APPLY_POWERPC_PATCH)
Thomas Petazzonif1983182013-06-30 21:28:59 +020048endef
49
Thomas Petazzoni4a8478b2015-11-04 08:32:39 +010050HOST_GCC_EXCLUDES = \
Alexey Brodkin545ca6a2018-10-30 11:31:24 +030051 libjava/* libgo/*
Thomas Petazzoni00e9b1e2013-06-30 21:29:04 +020052
53#
Thomas Petazzonif1983182013-06-30 21:28:59 +020054# Create 'build' directory and configure symlink
55#
56
57define HOST_GCC_CONFIGURE_SYMLINK
58 mkdir -p $(@D)/build
Thomas Petazzoni094fd1d2013-09-02 18:06:35 +020059 ln -sf ../configure $(@D)/build/configure
Thomas Petazzonif1983182013-06-30 21:28:59 +020060endef
61
62#
63# Common configuration options
64#
65
66HOST_GCC_COMMON_DEPENDENCIES = \
67 host-binutils \
68 host-gmp \
Arnout Vandecappelle33749412016-10-16 09:11:31 +020069 host-mpc \
Gustavo Zacarias4fc45cc2013-09-11 09:12:06 -030070 host-mpfr \
71 $(if $(BR2_BINFMT_FLAT),host-elf2flt)
Thomas Petazzonif1983182013-06-30 21:28:59 +020072
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +020073HOST_GCC_COMMON_CONF_OPTS = \
Thomas Petazzonif1983182013-06-30 21:28:59 +020074 --target=$(GNU_TARGET_NAME) \
75 --with-sysroot=$(STAGING_DIR) \
Alexey Brodkin3e53b512018-11-16 14:26:18 +030076 --enable-__cxa_atexit \
Thomas Petazzonif1983182013-06-30 21:28:59 +020077 --with-gnu-ld \
78 --disable-libssp \
79 --disable-multilib \
Thomas Petazzoni6561d922018-10-21 13:54:15 +020080 --disable-decimal-float \
Arnout Vandecappelle685f44d2017-07-05 13:14:24 +020081 --with-gmp=$(HOST_DIR) \
82 --with-mpc=$(HOST_DIR) \
83 --with-mpfr=$(HOST_DIR) \
Gustavo Zacarias7f2a52e2015-03-03 13:44:04 -030084 --with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \
Romain Naour55029432020-06-09 00:13:44 +020085 --with-bugurl="http://bugs.buildroot.net/" \
86 --without-zstd
Peter Korsgaard5128cc62013-09-04 16:18:14 +020087
88# Don't build documentation. It takes up extra space / build time,
89# and sometimes needs specific makeinfo versions to work
90HOST_GCC_COMMON_CONF_ENV = \
Peter Korsgaard09b74412013-09-03 15:22:17 +020091 MAKEINFO=missing
Thomas Petazzonif1983182013-06-30 21:28:59 +020092
Alexey Brodkin0fe633c2015-03-24 16:55:15 +030093GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS)
94GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS)
95
Yann E. MORIN2a6003d2020-04-10 21:30:14 +020096# used to fix ../../../../libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
James Hilliarddcaf6e72020-04-07 13:26:22 -060097ifeq ($(BR2_ENABLE_DEBUG),y)
98GCC_COMMON_TARGET_CFLAGS += -Wno-error
99endif
100
Alexey Brodkind2ae7eb2020-10-21 09:59:23 +0300101# Make sure libgcc & libstdc++ always get built with -matomic on ARC700
102ifeq ($(GCC_TARGET_CPU):$(BR2_ARC_ATOMIC_EXT),arc700:y)
103GCC_COMMON_TARGET_CFLAGS += -matomic
104GCC_COMMON_TARGET_CXXFLAGS += -matomic
105endif
106
Alexey Brodkin0fe633c2015-03-24 16:55:15 +0300107# Propagate options used for target software building to GCC target libs
Romain Naourbc39b872015-07-23 23:08:55 +0200108HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
Alexey Brodkin0fe633c2015-03-24 16:55:15 +0300109HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
110
Gustavo Zacarias9f86c712015-01-14 21:29:44 -0300111# libitm needs sparc V9+
112ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
113HOST_GCC_COMMON_CONF_OPTS += --disable-libitm
114endif
115
Bernd Kuhls873d4012016-10-23 00:04:22 +0200116# libmpx uses secure_getenv and struct _libc_fpstate not present in musl
117ifeq ($(BR2_TOOLCHAIN_BUILDROOT_MUSL)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),yy)
118HOST_GCC_COMMON_CONF_OPTS += --disable-libmpx
119endif
120
Samuel Martin0a694c52016-06-27 16:11:15 +0100121# quadmath support requires wchar
Samuel Martin7de668a2016-07-03 15:47:38 +0200122ifeq ($(BR2_USE_WCHAR)$(BR2_TOOLCHAIN_HAS_LIBQUADMATH),yy)
123HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath
124else
Matt Webera07fc4b2020-09-11 07:41:31 -0500125HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath --disable-libquadmath-support
Thomas Petazzonif1983182013-06-30 21:28:59 +0200126endif
127
Thomas Petazzoni5f4d6582014-05-05 23:17:09 +0200128# libsanitizer requires wordexp, not in default uClibc config. Also
129# doesn't build properly with musl.
130ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_TOOLCHAIN_BUILDROOT_MUSL),y)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200131HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
Gustavo Zacarias554e29e2014-04-23 22:00:32 -0300132endif
133
Gustavo Zacariase0046e52015-04-15 16:41:56 -0300134# libsanitizer is broken for SPARC
135# https://bugs.busybox.net/show_bug.cgi?id=7951
Waldemar Brodkorbc4c7e9f2015-10-11 19:17:27 +0200136ifeq ($(BR2_sparc)$(BR2_sparc64),y)
Gustavo Zacariase0046e52015-04-15 16:41:56 -0300137HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
138endif
139
Thomas Petazzoni0bec4c82020-09-25 11:04:51 +0200140# The logic in libbacktrace/configure.ac to detect if __sync builtins
141# are available assumes they are as soon as target_subdir is not
142# empty, i.e when cross-compiling. However, some platforms do not have
143# __sync builtins, so help the configure script a bit.
144ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),)
145HOST_GCC_COMMON_CONF_ENV += target_configargs="libbacktrace_cv_sys_sync=no"
146endif
147
Thomas Petazzoni1bd02bc2016-08-30 23:33:28 +0200148# TLS support is not needed on uClibc/no-thread and
149# uClibc/linux-threads, otherwise, for all other situations (glibc,
150# musl and uClibc/NPTL), we need it.
151ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_PTHREADS)$(BR2_PTHREADS_NONE),yy)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200152HOST_GCC_COMMON_CONF_OPTS += --disable-tls
Thomas Petazzoni1bd02bc2016-08-30 23:33:28 +0200153else
154HOST_GCC_COMMON_CONF_OPTS += --enable-tls
Thomas Petazzonif1983182013-06-30 21:28:59 +0200155endif
156
Peter Kümmel814f63e2015-03-06 13:34:06 +0100157ifeq ($(BR2_GCC_ENABLE_LTO),y)
158HOST_GCC_COMMON_CONF_OPTS += --enable-plugins --enable-lto
159endif
160
Thomas Petazzonif1983182013-06-30 21:28:59 +0200161ifeq ($(BR2_PTHREADS_NONE),y)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200162HOST_GCC_COMMON_CONF_OPTS += \
Thomas Petazzonif1983182013-06-30 21:28:59 +0200163 --disable-threads \
164 --disable-libitm \
165 --disable-libatomic
166else
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200167HOST_GCC_COMMON_CONF_OPTS += --enable-threads
Thomas Petazzonif1983182013-06-30 21:28:59 +0200168endif
169
Andrey Yurovskyd16b6bf2017-08-01 16:43:00 -0700170# gcc 5 doesn't need cloog any more, see
171# https://gcc.gnu.org/gcc-5/changes.html and we don't support graphite
172# on GCC 4.9.x, so only isl is needed.
Steve Thomas90aca352014-05-19 19:48:13 +0000173ifeq ($(BR2_GCC_ENABLE_GRAPHITE),y)
Gustavo Zacariasa4a1c472015-12-07 08:31:31 +0100174HOST_GCC_COMMON_DEPENDENCIES += host-isl
Arnout Vandecappelle685f44d2017-07-05 13:14:24 +0200175HOST_GCC_COMMON_CONF_OPTS += --with-isl=$(HOST_DIR)
Steve Thomas90aca352014-05-19 19:48:13 +0000176else
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200177HOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog
Steve Thomas90aca352014-05-19 19:48:13 +0000178endif
179
Romain Naourf424b8a2020-01-02 23:04:15 +0100180ifeq ($(BR2_arc),y)
Thomas Petazzonif1983182013-06-30 21:28:59 +0200181HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison
182endif
183
184ifeq ($(BR2_SOFT_FLOAT),y)
185# only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float
186# powerpc seems to be needing it as well
187ifeq ($(BR2_arm)$(BR2_armeb)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),y)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200188HOST_GCC_COMMON_CONF_OPTS += --with-float=soft
Thomas Petazzonif1983182013-06-30 21:28:59 +0200189endif
190endif
191
Thomas Petazzonif1983182013-06-30 21:28:59 +0200192# Determine arch/tune/abi/cpu options
Mark Corbinbd0640a2018-09-12 11:22:53 +0100193ifneq ($(GCC_TARGET_ARCH),)
194HOST_GCC_COMMON_CONF_OPTS += --with-arch="$(GCC_TARGET_ARCH)"
Thomas Petazzonif1983182013-06-30 21:28:59 +0200195endif
Mark Corbinbd0640a2018-09-12 11:22:53 +0100196ifneq ($(GCC_TARGET_ABI),)
197HOST_GCC_COMMON_CONF_OPTS += --with-abi="$(GCC_TARGET_ABI)"
Thomas Petazzonif1983182013-06-30 21:28:59 +0200198endif
Yann E. MORIN31b134a2017-09-03 11:53:50 +0200199ifeq ($(BR2_TOOLCHAIN_HAS_MNAN_OPTION),y)
Mark Corbinbd0640a2018-09-12 11:22:53 +0100200ifneq ($(GCC_TARGET_NAN),)
201HOST_GCC_COMMON_CONF_OPTS += --with-nan="$(GCC_TARGET_NAN)"
Vicente Olivert Riera2d8f3fc2017-06-28 16:17:10 +0100202endif
Yann E. MORIN31b134a2017-09-03 11:53:50 +0200203endif
Mark Corbinbd0640a2018-09-12 11:22:53 +0100204ifneq ($(GCC_TARGET_FP32_MODE),)
205HOST_GCC_COMMON_CONF_OPTS += --with-fp-32="$(GCC_TARGET_FP32_MODE)"
Vicente Olivert Riera9a0a0a92017-06-28 16:17:11 +0100206endif
Mark Corbinbd0640a2018-09-12 11:22:53 +0100207ifneq ($(GCC_TARGET_CPU),)
Mark Corbinbd0640a2018-09-12 11:22:53 +0100208HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(GCC_TARGET_CPU)
Thomas Petazzonif1983182013-06-30 21:28:59 +0200209endif
Thomas Petazzonif1983182013-06-30 21:28:59 +0200210
Thomas Petazzonid7745512013-07-16 10:03:12 +0200211ifneq ($(GCC_TARGET_FPU),)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200212HOST_GCC_COMMON_CONF_OPTS += --with-fpu=$(GCC_TARGET_FPU)
Thomas Petazzonid7745512013-07-16 10:03:12 +0200213endif
214
Thomas Petazzonid7745512013-07-16 10:03:12 +0200215ifneq ($(GCC_TARGET_FLOAT_ABI),)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200216HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI)
Thomas Petazzonid7745512013-07-16 10:03:12 +0200217endif
218
Thomas Petazzoni85d07692013-07-16 10:03:22 +0200219ifneq ($(GCC_TARGET_MODE),)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200220HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE)
Thomas Petazzoni85d07692013-07-16 10:03:22 +0200221endif
222
Thomas Petazzoni530777a2013-09-02 18:06:38 +0200223# Enable proper double/long double for SPE ABI
Thomas Petazzonif1983182013-06-30 21:28:59 +0200224ifeq ($(BR2_powerpc_SPE),y)
Thomas De Schampheleireaaffd202014-09-27 21:32:44 +0200225HOST_GCC_COMMON_CONF_OPTS += \
Michael Durrant96e80ad2020-10-26 15:17:35 -0400226 --enable-obsolete \
Thomas Petazzonif1983182013-06-30 21:28:59 +0200227 --enable-e500_double \
228 --with-long-double-128
229endif
230
Matt Weberf9b539b2020-09-23 10:29:08 -0500231# Set default to Secure-PLT to prevent run-time
232# generation of PLT stubs (supports RELRO and
233# SELinux non-exemem capabilities)
234ifeq ($(BR2_powerpc),y)
235HOST_GCC_COMMON_CONF_OPTS += --enable-secureplt
236endif
237
Waldemar Brodkorb5ab751c2016-08-18 08:37:29 +0200238# PowerPC64 big endian by default uses the elfv1 ABI, and PowerPC 64
239# little endian by default uses the elfv2 ABI. However, musl has
240# decided to use the elfv2 ABI for both, so we force the elfv2 ABI for
241# Power64 big endian when the selected C library is musl.
242ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_powerpc64),yy)
243HOST_GCC_COMMON_CONF_OPTS += \
244 --with-abi=elfv2 \
245 --without-long-double-128
246endif
247
Romain Naour6c0dd2f2017-09-23 23:24:03 +0200248# Since glibc >= 2.26, poerpc64le requires double/long double which
249# requires at least gcc 6.2.
250# See sysdeps/powerpc/powerpc64le/configure.ac
251ifeq ($(BR2_TOOLCHAIN_USES_GLIBC)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6)$(BR2_powerpc64le),yyy)
252HOST_GCC_COMMON_CONF_OPTS += \
253 --with-long-double-128
254endif
255
Alexander Egorenkov29353bb2020-09-17 06:07:52 +0200256ifeq ($(BR2_s390x),y)
257HOST_GCC_COMMON_CONF_OPTS += \
258 --with-long-double-128
259endif
260
Arnout Vandecappelle416326d2015-10-14 23:05:54 +0200261HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"'
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100262
Thomas Petazzonia7463a62015-10-17 15:09:09 +0200263# For gcc-initial, we need to tell gcc that the C library will be
264# providing the ssp support, as it can't guess it since the C library
265# hasn't been built yet.
266#
267# For gcc-final, the gcc logic to detect whether SSP support is
268# available or not in the C library is not working properly for
269# uClibc, so let's be explicit as well.
270HOST_GCC_COMMON_MAKE_OPTS = \
271 gcc_cv_libc_provides_ssp=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
272
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100273ifeq ($(BR2_CCACHE),y)
Maxime Hadjinlian514291f2018-04-02 15:09:24 +0200274HOST_GCC_COMMON_CCACHE_HASH_FILES += $(GCC_DL_DIR)/$(GCC_SOURCE)
He Chunhui93046752016-04-13 04:20:32 +0000275
276# Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned
277# and unversioned patches unconditionally. Moreover, to facilitate the
278# addition of gcc patches in BR2_GLOBAL_PATCH_DIR, we allow them to be
279# stored in a sub-directory called 'gcc' even if it's not technically
280# the name of the package.
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100281HOST_GCC_COMMON_CCACHE_HASH_FILES += \
Arnout Vandecappelle70a61bb2015-10-04 18:26:03 +0100282 $(sort $(wildcard \
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100283 package/gcc/$(GCC_VERSION)/*.patch \
Yann E. MORIN5c177412016-07-03 18:00:10 +0200284 $(addsuffix /$($(PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
285 $(addsuffix /$($(PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
He Chunhui93046752016-04-13 04:20:32 +0000286 $(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
287 $(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))))
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100288ifeq ($(BR2_xtensa),y)
Yann E. MORIN725f0592017-03-14 11:30:34 -0700289HOST_GCC_COMMON_CCACHE_HASH_FILES += $(ARCH_XTENSA_OVERLAY_TAR)
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100290endif
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100291
Arnout Vandecappellefe339522015-10-04 17:06:01 +0100292# _CONF_OPTS contains some references to the absolute path of $(HOST_DIR)
293# and a reference to the Buildroot git revision (BR2_VERSION_FULL),
Arnout Vandecappelle1e97b272015-10-04 16:25:32 +0100294# so substitute those away.
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100295HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_HASH=\"`\
Arnout Vandecappellefe339522015-10-04 17:06:01 +0100296 printf '%s\n' $(subst $(HOST_DIR),@HOST_DIR@,\
297 $(subst --with-pkgversion="Buildroot $(BR2_VERSION_FULL)",,$($(PKG)_CONF_OPTS))) \
Arnout Vandecappellef4682cf2015-10-04 16:25:00 +0100298 | sha256sum - $(HOST_GCC_COMMON_CCACHE_HASH_FILES) \
299 | cut -c -64 | tr -d '\n'`\"
300endif # BR2_CCACHE
301
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100302# The LTO support in gcc creates wrappers for ar, ranlib and nm which load
303# the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and
304# *-gcc-nm and should be used instead of the real programs when -flto is
305# used. However, we should not add the toolchain wrapper for them, and they
306# match the *cc-* pattern. Therefore, an additional case is added for *-ar,
307# *-ranlib and *-nm.
Samuel Martin6331b9c2016-07-01 18:29:07 +0200308# According to gfortran manpage, it supports all options supported by gcc, so
309# add gfortran to the list of the program called via the Buildroot wrapper.
Arnout Vandecappelle416326d2015-10-14 23:05:54 +0200310# Avoid that a .br_real is symlinked a second time.
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100311# Also create <arch>-linux-<tool> symlinks.
312define HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
Arnout Vandecappelle0f9c0bf2017-07-05 13:14:19 +0200313 $(Q)cd $(HOST_DIR)/bin; \
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100314 for i in $(GNU_TARGET_NAME)-*; do \
315 case "$$i" in \
Arnout Vandecappelle416326d2015-10-14 23:05:54 +0200316 *.br_real) \
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100317 ;; \
318 *-ar|*-ranlib|*-nm) \
319 ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \
320 ;; \
Eric Le Bihan22e82f22019-11-02 19:00:50 +0100321 *cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc) \
Arnout Vandecappelle416326d2015-10-14 23:05:54 +0200322 rm -f $$i.br_real; \
323 mv $$i $$i.br_real; \
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100324 ln -sf toolchain-wrapper $$i; \
325 ln -sf toolchain-wrapper $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \
Arnout Vandecappelle416326d2015-10-14 23:05:54 +0200326 ln -snf $$i.br_real $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}.br_real; \
Arnout Vandecappelle919c06c2015-10-04 13:28:42 +0100327 ;; \
328 *) \
329 ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \
330 ;; \
331 esac; \
332 done
333
334endef
335
Jérôme Pouiller741cbcc2013-09-03 10:45:41 +0200336include $(sort $(wildcard package/gcc/*/*.mk))