Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # |
Thomas Petazzoni | 4589348 | 2014-09-14 11:50:00 +0200 | [diff] [blame] | 3 | # Common variables for the gcc-initial and gcc-final packages. |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 4 | # |
| 5 | ################################################################################ |
| 6 | |
| 7 | # |
| 8 | # Version, site and source |
| 9 | # |
| 10 | |
| 11 | GCC_VERSION = $(call qstrip,$(BR2_GCC_VERSION)) |
| 12 | |
Alexey Brodkin | b09586c | 2017-11-10 00:56:48 +0300 | [diff] [blame] | 13 | ifeq ($(BR2_GCC_VERSION_ARC),y) |
Mischa Jonker | 3ce6552 | 2013-12-05 18:20:49 +0100 | [diff] [blame] | 14 | GCC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,gcc,$(GCC_VERSION)) |
| 15 | GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz |
Romain Naour | a85b464 | 2020-03-13 00:41:26 +0100 | [diff] [blame] | 16 | else ifeq ($(BR2_GCC_VERSION_CSKY),y) |
Guo Ren | 7873a5b | 2019-05-31 14:39:04 +0800 | [diff] [blame] | 17 | GCC_SITE = $(call github,c-sky,gcc,$(GCC_VERSION)) |
| 18 | GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz |
Peter Korsgaard | 42ebd74 | 2014-04-30 00:27:51 +0200 | [diff] [blame] | 19 | else |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 20 | GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION) |
Romain Naour | 91b1fbb | 2018-05-29 23:52:55 +0200 | [diff] [blame] | 21 | GCC_SOURCE = gcc-$(GCC_VERSION).tar.xz |
| 22 | endif |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 23 | |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 24 | # |
| 25 | # Xtensa special hook |
| 26 | # |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 27 | define HOST_GCC_XTENSA_OVERLAY_EXTRACT |
Yann E. MORIN | 2b34da9 | 2017-03-14 11:30:38 -0700 | [diff] [blame] | 28 | $(call arch-xtensa-overlay-extract,$(@D),gcc) |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 29 | endef |
| 30 | |
| 31 | # |
| 32 | # Apply patches |
| 33 | # |
| 34 | |
He Chunhui | 9304675 | 2016-04-13 04:20:32 +0000 | [diff] [blame] | 35 | # 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 Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 38 | define HOST_GCC_APPLY_PATCHES |
He Chunhui | 9304675 | 2016-04-13 04:20:32 +0000 | [diff] [blame] | 39 | 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 Petazzoni | 197006a | 2013-07-05 10:40:52 +0200 | [diff] [blame] | 47 | $(HOST_GCC_APPLY_POWERPC_PATCH) |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 48 | endef |
| 49 | |
Thomas Petazzoni | 4a8478b | 2015-11-04 08:32:39 +0100 | [diff] [blame] | 50 | HOST_GCC_EXCLUDES = \ |
Alexey Brodkin | 545ca6a | 2018-10-30 11:31:24 +0300 | [diff] [blame] | 51 | libjava/* libgo/* |
Thomas Petazzoni | 00e9b1e | 2013-06-30 21:29:04 +0200 | [diff] [blame] | 52 | |
| 53 | # |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 54 | # Create 'build' directory and configure symlink |
| 55 | # |
| 56 | |
| 57 | define HOST_GCC_CONFIGURE_SYMLINK |
| 58 | mkdir -p $(@D)/build |
Thomas Petazzoni | 094fd1d | 2013-09-02 18:06:35 +0200 | [diff] [blame] | 59 | ln -sf ../configure $(@D)/build/configure |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 60 | endef |
| 61 | |
| 62 | # |
| 63 | # Common configuration options |
| 64 | # |
| 65 | |
| 66 | HOST_GCC_COMMON_DEPENDENCIES = \ |
| 67 | host-binutils \ |
| 68 | host-gmp \ |
Arnout Vandecappelle | 3374941 | 2016-10-16 09:11:31 +0200 | [diff] [blame] | 69 | host-mpc \ |
Gustavo Zacarias | 4fc45cc | 2013-09-11 09:12:06 -0300 | [diff] [blame] | 70 | host-mpfr \ |
| 71 | $(if $(BR2_BINFMT_FLAT),host-elf2flt) |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 72 | |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 73 | HOST_GCC_COMMON_CONF_OPTS = \ |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 74 | --target=$(GNU_TARGET_NAME) \ |
| 75 | --with-sysroot=$(STAGING_DIR) \ |
Alexey Brodkin | 3e53b51 | 2018-11-16 14:26:18 +0300 | [diff] [blame] | 76 | --enable-__cxa_atexit \ |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 77 | --with-gnu-ld \ |
| 78 | --disable-libssp \ |
| 79 | --disable-multilib \ |
Thomas Petazzoni | 6561d92 | 2018-10-21 13:54:15 +0200 | [diff] [blame] | 80 | --disable-decimal-float \ |
Arnout Vandecappelle | 685f44d | 2017-07-05 13:14:24 +0200 | [diff] [blame] | 81 | --with-gmp=$(HOST_DIR) \ |
| 82 | --with-mpc=$(HOST_DIR) \ |
| 83 | --with-mpfr=$(HOST_DIR) \ |
Gustavo Zacarias | 7f2a52e | 2015-03-03 13:44:04 -0300 | [diff] [blame] | 84 | --with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \ |
Romain Naour | 5502943 | 2020-06-09 00:13:44 +0200 | [diff] [blame] | 85 | --with-bugurl="http://bugs.buildroot.net/" \ |
| 86 | --without-zstd |
Peter Korsgaard | 5128cc6 | 2013-09-04 16:18:14 +0200 | [diff] [blame] | 87 | |
| 88 | # Don't build documentation. It takes up extra space / build time, |
| 89 | # and sometimes needs specific makeinfo versions to work |
| 90 | HOST_GCC_COMMON_CONF_ENV = \ |
Peter Korsgaard | 09b7441 | 2013-09-03 15:22:17 +0200 | [diff] [blame] | 91 | MAKEINFO=missing |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 92 | |
Alexey Brodkin | 0fe633c | 2015-03-24 16:55:15 +0300 | [diff] [blame] | 93 | GCC_COMMON_TARGET_CFLAGS = $(TARGET_CFLAGS) |
| 94 | GCC_COMMON_TARGET_CXXFLAGS = $(TARGET_CXXFLAGS) |
| 95 | |
Yann E. MORIN | 2a6003d | 2020-04-10 21:30:14 +0200 | [diff] [blame] | 96 | # 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 Hilliard | dcaf6e7 | 2020-04-07 13:26:22 -0600 | [diff] [blame] | 97 | ifeq ($(BR2_ENABLE_DEBUG),y) |
| 98 | GCC_COMMON_TARGET_CFLAGS += -Wno-error |
| 99 | endif |
| 100 | |
Alexey Brodkin | d2ae7eb | 2020-10-21 09:59:23 +0300 | [diff] [blame] | 101 | # Make sure libgcc & libstdc++ always get built with -matomic on ARC700 |
| 102 | ifeq ($(GCC_TARGET_CPU):$(BR2_ARC_ATOMIC_EXT),arc700:y) |
| 103 | GCC_COMMON_TARGET_CFLAGS += -matomic |
| 104 | GCC_COMMON_TARGET_CXXFLAGS += -matomic |
| 105 | endif |
| 106 | |
Alexey Brodkin | 0fe633c | 2015-03-24 16:55:15 +0300 | [diff] [blame] | 107 | # Propagate options used for target software building to GCC target libs |
Romain Naour | bc39b87 | 2015-07-23 23:08:55 +0200 | [diff] [blame] | 108 | HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)" |
Alexey Brodkin | 0fe633c | 2015-03-24 16:55:15 +0300 | [diff] [blame] | 109 | HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)" |
| 110 | |
Gustavo Zacarias | 9f86c71 | 2015-01-14 21:29:44 -0300 | [diff] [blame] | 111 | # libitm needs sparc V9+ |
| 112 | ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y) |
| 113 | HOST_GCC_COMMON_CONF_OPTS += --disable-libitm |
| 114 | endif |
| 115 | |
Bernd Kuhls | 873d401 | 2016-10-23 00:04:22 +0200 | [diff] [blame] | 116 | # libmpx uses secure_getenv and struct _libc_fpstate not present in musl |
| 117 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT_MUSL)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),yy) |
| 118 | HOST_GCC_COMMON_CONF_OPTS += --disable-libmpx |
| 119 | endif |
| 120 | |
Samuel Martin | 0a694c5 | 2016-06-27 16:11:15 +0100 | [diff] [blame] | 121 | # quadmath support requires wchar |
Samuel Martin | 7de668a | 2016-07-03 15:47:38 +0200 | [diff] [blame] | 122 | ifeq ($(BR2_USE_WCHAR)$(BR2_TOOLCHAIN_HAS_LIBQUADMATH),yy) |
| 123 | HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath |
| 124 | else |
Matt Weber | a07fc4b | 2020-09-11 07:41:31 -0500 | [diff] [blame] | 125 | HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath --disable-libquadmath-support |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 126 | endif |
| 127 | |
Thomas Petazzoni | 5f4d658 | 2014-05-05 23:17:09 +0200 | [diff] [blame] | 128 | # libsanitizer requires wordexp, not in default uClibc config. Also |
| 129 | # doesn't build properly with musl. |
| 130 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_TOOLCHAIN_BUILDROOT_MUSL),y) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 131 | HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer |
Gustavo Zacarias | 554e29e | 2014-04-23 22:00:32 -0300 | [diff] [blame] | 132 | endif |
| 133 | |
Gustavo Zacarias | e0046e5 | 2015-04-15 16:41:56 -0300 | [diff] [blame] | 134 | # libsanitizer is broken for SPARC |
| 135 | # https://bugs.busybox.net/show_bug.cgi?id=7951 |
Waldemar Brodkorb | c4c7e9f | 2015-10-11 19:17:27 +0200 | [diff] [blame] | 136 | ifeq ($(BR2_sparc)$(BR2_sparc64),y) |
Gustavo Zacarias | e0046e5 | 2015-04-15 16:41:56 -0300 | [diff] [blame] | 137 | HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer |
| 138 | endif |
| 139 | |
Thomas Petazzoni | 0bec4c8 | 2020-09-25 11:04:51 +0200 | [diff] [blame] | 140 | # 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. |
| 144 | ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),) |
| 145 | HOST_GCC_COMMON_CONF_ENV += target_configargs="libbacktrace_cv_sys_sync=no" |
| 146 | endif |
| 147 | |
Thomas Petazzoni | 1bd02bc | 2016-08-30 23:33:28 +0200 | [diff] [blame] | 148 | # 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. |
| 151 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_PTHREADS)$(BR2_PTHREADS_NONE),yy) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 152 | HOST_GCC_COMMON_CONF_OPTS += --disable-tls |
Thomas Petazzoni | 1bd02bc | 2016-08-30 23:33:28 +0200 | [diff] [blame] | 153 | else |
| 154 | HOST_GCC_COMMON_CONF_OPTS += --enable-tls |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 155 | endif |
| 156 | |
Peter Kümmel | 814f63e | 2015-03-06 13:34:06 +0100 | [diff] [blame] | 157 | ifeq ($(BR2_GCC_ENABLE_LTO),y) |
| 158 | HOST_GCC_COMMON_CONF_OPTS += --enable-plugins --enable-lto |
| 159 | endif |
| 160 | |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 161 | ifeq ($(BR2_PTHREADS_NONE),y) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 162 | HOST_GCC_COMMON_CONF_OPTS += \ |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 163 | --disable-threads \ |
| 164 | --disable-libitm \ |
| 165 | --disable-libatomic |
| 166 | else |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 167 | HOST_GCC_COMMON_CONF_OPTS += --enable-threads |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 168 | endif |
| 169 | |
Andrey Yurovsky | d16b6bf | 2017-08-01 16:43:00 -0700 | [diff] [blame] | 170 | # 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 Thomas | 90aca35 | 2014-05-19 19:48:13 +0000 | [diff] [blame] | 173 | ifeq ($(BR2_GCC_ENABLE_GRAPHITE),y) |
Gustavo Zacarias | a4a1c47 | 2015-12-07 08:31:31 +0100 | [diff] [blame] | 174 | HOST_GCC_COMMON_DEPENDENCIES += host-isl |
Arnout Vandecappelle | 685f44d | 2017-07-05 13:14:24 +0200 | [diff] [blame] | 175 | HOST_GCC_COMMON_CONF_OPTS += --with-isl=$(HOST_DIR) |
Steve Thomas | 90aca35 | 2014-05-19 19:48:13 +0000 | [diff] [blame] | 176 | else |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 177 | HOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog |
Steve Thomas | 90aca35 | 2014-05-19 19:48:13 +0000 | [diff] [blame] | 178 | endif |
| 179 | |
Romain Naour | f424b8a | 2020-01-02 23:04:15 +0100 | [diff] [blame] | 180 | ifeq ($(BR2_arc),y) |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 181 | HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison |
| 182 | endif |
| 183 | |
| 184 | ifeq ($(BR2_SOFT_FLOAT),y) |
| 185 | # only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float |
| 186 | # powerpc seems to be needing it as well |
| 187 | ifeq ($(BR2_arm)$(BR2_armeb)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),y) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 188 | HOST_GCC_COMMON_CONF_OPTS += --with-float=soft |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 189 | endif |
| 190 | endif |
| 191 | |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 192 | # Determine arch/tune/abi/cpu options |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 193 | ifneq ($(GCC_TARGET_ARCH),) |
| 194 | HOST_GCC_COMMON_CONF_OPTS += --with-arch="$(GCC_TARGET_ARCH)" |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 195 | endif |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 196 | ifneq ($(GCC_TARGET_ABI),) |
| 197 | HOST_GCC_COMMON_CONF_OPTS += --with-abi="$(GCC_TARGET_ABI)" |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 198 | endif |
Yann E. MORIN | 31b134a | 2017-09-03 11:53:50 +0200 | [diff] [blame] | 199 | ifeq ($(BR2_TOOLCHAIN_HAS_MNAN_OPTION),y) |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 200 | ifneq ($(GCC_TARGET_NAN),) |
| 201 | HOST_GCC_COMMON_CONF_OPTS += --with-nan="$(GCC_TARGET_NAN)" |
Vicente Olivert Riera | 2d8f3fc | 2017-06-28 16:17:10 +0100 | [diff] [blame] | 202 | endif |
Yann E. MORIN | 31b134a | 2017-09-03 11:53:50 +0200 | [diff] [blame] | 203 | endif |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 204 | ifneq ($(GCC_TARGET_FP32_MODE),) |
| 205 | HOST_GCC_COMMON_CONF_OPTS += --with-fp-32="$(GCC_TARGET_FP32_MODE)" |
Vicente Olivert Riera | 9a0a0a9 | 2017-06-28 16:17:11 +0100 | [diff] [blame] | 206 | endif |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 207 | ifneq ($(GCC_TARGET_CPU),) |
Mark Corbin | bd0640a | 2018-09-12 11:22:53 +0100 | [diff] [blame] | 208 | HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(GCC_TARGET_CPU) |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 209 | endif |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 210 | |
Thomas Petazzoni | d774551 | 2013-07-16 10:03:12 +0200 | [diff] [blame] | 211 | ifneq ($(GCC_TARGET_FPU),) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 212 | HOST_GCC_COMMON_CONF_OPTS += --with-fpu=$(GCC_TARGET_FPU) |
Thomas Petazzoni | d774551 | 2013-07-16 10:03:12 +0200 | [diff] [blame] | 213 | endif |
| 214 | |
Thomas Petazzoni | d774551 | 2013-07-16 10:03:12 +0200 | [diff] [blame] | 215 | ifneq ($(GCC_TARGET_FLOAT_ABI),) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 216 | HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI) |
Thomas Petazzoni | d774551 | 2013-07-16 10:03:12 +0200 | [diff] [blame] | 217 | endif |
| 218 | |
Thomas Petazzoni | 85d0769 | 2013-07-16 10:03:22 +0200 | [diff] [blame] | 219 | ifneq ($(GCC_TARGET_MODE),) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 220 | HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE) |
Thomas Petazzoni | 85d0769 | 2013-07-16 10:03:22 +0200 | [diff] [blame] | 221 | endif |
| 222 | |
Thomas Petazzoni | 530777a | 2013-09-02 18:06:38 +0200 | [diff] [blame] | 223 | # Enable proper double/long double for SPE ABI |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 224 | ifeq ($(BR2_powerpc_SPE),y) |
Thomas De Schampheleire | aaffd20 | 2014-09-27 21:32:44 +0200 | [diff] [blame] | 225 | HOST_GCC_COMMON_CONF_OPTS += \ |
Michael Durrant | 96e80ad | 2020-10-26 15:17:35 -0400 | [diff] [blame] | 226 | --enable-obsolete \ |
Thomas Petazzoni | f198318 | 2013-06-30 21:28:59 +0200 | [diff] [blame] | 227 | --enable-e500_double \ |
| 228 | --with-long-double-128 |
| 229 | endif |
| 230 | |
Matt Weber | f9b539b | 2020-09-23 10:29:08 -0500 | [diff] [blame] | 231 | # Set default to Secure-PLT to prevent run-time |
| 232 | # generation of PLT stubs (supports RELRO and |
| 233 | # SELinux non-exemem capabilities) |
| 234 | ifeq ($(BR2_powerpc),y) |
| 235 | HOST_GCC_COMMON_CONF_OPTS += --enable-secureplt |
| 236 | endif |
| 237 | |
Waldemar Brodkorb | 5ab751c | 2016-08-18 08:37:29 +0200 | [diff] [blame] | 238 | # 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. |
| 242 | ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_powerpc64),yy) |
| 243 | HOST_GCC_COMMON_CONF_OPTS += \ |
| 244 | --with-abi=elfv2 \ |
| 245 | --without-long-double-128 |
| 246 | endif |
| 247 | |
Romain Naour | 6c0dd2f | 2017-09-23 23:24:03 +0200 | [diff] [blame] | 248 | # Since glibc >= 2.26, poerpc64le requires double/long double which |
| 249 | # requires at least gcc 6.2. |
| 250 | # See sysdeps/powerpc/powerpc64le/configure.ac |
| 251 | ifeq ($(BR2_TOOLCHAIN_USES_GLIBC)$(BR2_TOOLCHAIN_GCC_AT_LEAST_6)$(BR2_powerpc64le),yyy) |
| 252 | HOST_GCC_COMMON_CONF_OPTS += \ |
| 253 | --with-long-double-128 |
| 254 | endif |
| 255 | |
Alexander Egorenkov | 29353bb | 2020-09-17 06:07:52 +0200 | [diff] [blame] | 256 | ifeq ($(BR2_s390x),y) |
| 257 | HOST_GCC_COMMON_CONF_OPTS += \ |
| 258 | --with-long-double-128 |
| 259 | endif |
| 260 | |
Arnout Vandecappelle | 416326d | 2015-10-14 23:05:54 +0200 | [diff] [blame] | 261 | HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"' |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 262 | |
Thomas Petazzoni | a7463a6 | 2015-10-17 15:09:09 +0200 | [diff] [blame] | 263 | # 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. |
| 270 | HOST_GCC_COMMON_MAKE_OPTS = \ |
| 271 | gcc_cv_libc_provides_ssp=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no) |
| 272 | |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 273 | ifeq ($(BR2_CCACHE),y) |
Maxime Hadjinlian | 514291f | 2018-04-02 15:09:24 +0200 | [diff] [blame] | 274 | HOST_GCC_COMMON_CCACHE_HASH_FILES += $(GCC_DL_DIR)/$(GCC_SOURCE) |
He Chunhui | 9304675 | 2016-04-13 04:20:32 +0000 | [diff] [blame] | 275 | |
| 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 Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 281 | HOST_GCC_COMMON_CCACHE_HASH_FILES += \ |
Arnout Vandecappelle | 70a61bb | 2015-10-04 18:26:03 +0100 | [diff] [blame] | 282 | $(sort $(wildcard \ |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 283 | package/gcc/$(GCC_VERSION)/*.patch \ |
Yann E. MORIN | 5c17741 | 2016-07-03 18:00:10 +0200 | [diff] [blame] | 284 | $(addsuffix /$($(PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ |
| 285 | $(addsuffix /$($(PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ |
He Chunhui | 9304675 | 2016-04-13 04:20:32 +0000 | [diff] [blame] | 286 | $(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ |
| 287 | $(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 288 | ifeq ($(BR2_xtensa),y) |
Yann E. MORIN | 725f059 | 2017-03-14 11:30:34 -0700 | [diff] [blame] | 289 | HOST_GCC_COMMON_CCACHE_HASH_FILES += $(ARCH_XTENSA_OVERLAY_TAR) |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 290 | endif |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 291 | |
Arnout Vandecappelle | fe33952 | 2015-10-04 17:06:01 +0100 | [diff] [blame] | 292 | # _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 Vandecappelle | 1e97b27 | 2015-10-04 16:25:32 +0100 | [diff] [blame] | 294 | # so substitute those away. |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 295 | HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_HASH=\"`\ |
Arnout Vandecappelle | fe33952 | 2015-10-04 17:06:01 +0100 | [diff] [blame] | 296 | printf '%s\n' $(subst $(HOST_DIR),@HOST_DIR@,\ |
| 297 | $(subst --with-pkgversion="Buildroot $(BR2_VERSION_FULL)",,$($(PKG)_CONF_OPTS))) \ |
Arnout Vandecappelle | f4682cf | 2015-10-04 16:25:00 +0100 | [diff] [blame] | 298 | | sha256sum - $(HOST_GCC_COMMON_CCACHE_HASH_FILES) \ |
| 299 | | cut -c -64 | tr -d '\n'`\" |
| 300 | endif # BR2_CCACHE |
| 301 | |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 302 | # 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 Martin | 6331b9c | 2016-07-01 18:29:07 +0200 | [diff] [blame] | 308 | # 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 Vandecappelle | 416326d | 2015-10-14 23:05:54 +0200 | [diff] [blame] | 310 | # Avoid that a .br_real is symlinked a second time. |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 311 | # Also create <arch>-linux-<tool> symlinks. |
| 312 | define HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS |
Arnout Vandecappelle | 0f9c0bf | 2017-07-05 13:14:19 +0200 | [diff] [blame] | 313 | $(Q)cd $(HOST_DIR)/bin; \ |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 314 | for i in $(GNU_TARGET_NAME)-*; do \ |
| 315 | case "$$i" in \ |
Arnout Vandecappelle | 416326d | 2015-10-14 23:05:54 +0200 | [diff] [blame] | 316 | *.br_real) \ |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 317 | ;; \ |
| 318 | *-ar|*-ranlib|*-nm) \ |
| 319 | ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ |
| 320 | ;; \ |
Eric Le Bihan | 22e82f2 | 2019-11-02 19:00:50 +0100 | [diff] [blame] | 321 | *cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc) \ |
Arnout Vandecappelle | 416326d | 2015-10-14 23:05:54 +0200 | [diff] [blame] | 322 | rm -f $$i.br_real; \ |
| 323 | mv $$i $$i.br_real; \ |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 324 | ln -sf toolchain-wrapper $$i; \ |
| 325 | ln -sf toolchain-wrapper $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ |
Arnout Vandecappelle | 416326d | 2015-10-14 23:05:54 +0200 | [diff] [blame] | 326 | ln -snf $$i.br_real $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}.br_real; \ |
Arnout Vandecappelle | 919c06c | 2015-10-04 13:28:42 +0100 | [diff] [blame] | 327 | ;; \ |
| 328 | *) \ |
| 329 | ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \ |
| 330 | ;; \ |
| 331 | esac; \ |
| 332 | done |
| 333 | |
| 334 | endef |
| 335 | |
Jérôme Pouiller | 741cbcc | 2013-09-03 10:45:41 +0200 | [diff] [blame] | 336 | include $(sort $(wildcard package/gcc/*/*.mk)) |