Ricardo Martincoski | b17e5b2 | 2018-04-01 02:08:27 -0300 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # |
| 3 | # definition of the toolchain wrapper build commands |
| 4 | # |
| 5 | ################################################################################ |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 6 | |
| 7 | # We use --hash-style=both to increase the compatibility of the generated |
| 8 | # binary with older platforms, except for MIPS, where the only acceptable |
| 9 | # hash style is 'sysv' |
| 10 | ifeq ($(findstring mips,$(HOSTARCH)),mips) |
| 11 | TOOLCHAIN_WRAPPER_HASH_STYLE = sysv |
| 12 | else |
| 13 | TOOLCHAIN_WRAPPER_HASH_STYLE = both |
| 14 | endif |
| 15 | |
| 16 | TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) |
| 17 | TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' |
| 18 | |
Yann E. MORIN | 15892d5 | 2019-03-12 13:09:32 +0100 | [diff] [blame] | 19 | TOOLCHAIN_WRAPPER_OPTS = \ |
Yann E. MORIN | b8ec113 | 2019-03-12 13:09:33 +0100 | [diff] [blame] | 20 | $(call qstrip,$(BR2_SSP_OPTION)) \ |
Yann E. MORIN | 15892d5 | 2019-03-12 13:09:32 +0100 | [diff] [blame] | 21 | $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) |
| 22 | |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 23 | # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a |
| 24 | # separate argument when used in execv() by the toolchain wrapper. |
Yann E. MORIN | 15892d5 | 2019-03-12 13:09:32 +0100 | [diff] [blame] | 25 | TOOLCHAIN_WRAPPER_ARGS += \ |
| 26 | -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TOOLCHAIN_WRAPPER_OPTS),"$(f)"$(comma))' |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 27 | |
Arnout Vandecappelle | d82f69c | 2015-10-04 16:23:56 +0100 | [diff] [blame] | 28 | ifeq ($(BR2_CCACHE),y) |
| 29 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE |
| 30 | endif |
| 31 | |
Ray Kinsella | 968f5d5 | 2015-10-19 11:02:52 +0000 | [diff] [blame] | 32 | ifeq ($(BR2_x86_x1000),y) |
| 33 | TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX |
| 34 | endif |
| 35 | |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 36 | # Avoid FPU bug on XBurst CPUs |
| 37 | ifeq ($(BR2_mips_xburst),y) |
Waldemar Brodkorb | 5e58509 | 2018-03-31 19:54:20 +0200 | [diff] [blame] | 38 | # Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is |
| 39 | # needed |
| 40 | ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y) |
| 41 | TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF |
| 42 | else |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 43 | TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD |
| 44 | endif |
Waldemar Brodkorb | 5e58509 | 2018-03-31 19:54:20 +0200 | [diff] [blame] | 45 | endif |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 46 | |
Arnout Vandecappelle | 1e97b27 | 2015-10-04 16:25:32 +0100 | [diff] [blame] | 47 | ifeq ($(BR2_CCACHE_USE_BASEDIR),y) |
| 48 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' |
| 49 | endif |
| 50 | |
Matt Weber | 7484c1c | 2018-09-17 16:21:49 -0500 | [diff] [blame] | 51 | ifeq ($(BR2_RELRO_PARTIAL),y) |
| 52 | TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_PARTIAL |
| 53 | else ifeq ($(BR2_RELRO_FULL),y) |
| 54 | TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL |
| 55 | endif |
| 56 | |
Jérôme Pouiller | 8087b02 | 2016-09-28 10:00:56 +0200 | [diff] [blame] | 57 | define TOOLCHAIN_WRAPPER_BUILD |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 58 | $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ |
| 59 | -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ |
| 60 | toolchain/toolchain-wrapper.c \ |
Jérôme Pouiller | 8087b02 | 2016-09-28 10:00:56 +0200 | [diff] [blame] | 61 | -o $(@D)/toolchain-wrapper |
| 62 | endef |
| 63 | |
| 64 | define TOOLCHAIN_WRAPPER_INSTALL |
| 65 | $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ |
Arnout Vandecappelle | 0f9c0bf | 2017-07-05 13:14:19 +0200 | [diff] [blame] | 66 | $(HOST_DIR)/bin/toolchain-wrapper |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 67 | endef |