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 | |
| 19 | # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a |
| 20 | # separate argument when used in execv() by the toolchain wrapper. |
Yann E. MORIN | 32e2636 | 2015-10-21 23:21:07 +0200 | [diff] [blame] | 21 | TOOLCHAIN_WRAPPER_OPTS = \ |
| 22 | $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma)) |
| 23 | TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)' |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 24 | |
Arnout Vandecappelle | d82f69c | 2015-10-04 16:23:56 +0100 | [diff] [blame] | 25 | ifeq ($(BR2_CCACHE),y) |
| 26 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE |
| 27 | endif |
| 28 | |
Ray Kinsella | 968f5d5 | 2015-10-19 11:02:52 +0000 | [diff] [blame] | 29 | ifeq ($(BR2_x86_x1000),y) |
| 30 | TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX |
| 31 | endif |
| 32 | |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 33 | # Avoid FPU bug on XBurst CPUs |
| 34 | ifeq ($(BR2_mips_xburst),y) |
Waldemar Brodkorb | 5e58509 | 2018-03-31 19:54:20 +0200 | [diff] [blame] | 35 | # Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is |
| 36 | # needed |
| 37 | ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y) |
| 38 | TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF |
| 39 | else |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 40 | TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD |
| 41 | endif |
Waldemar Brodkorb | 5e58509 | 2018-03-31 19:54:20 +0200 | [diff] [blame] | 42 | endif |
Vicente Olivert Riera | 240564a | 2016-11-09 16:16:57 +0000 | [diff] [blame] | 43 | |
Arnout Vandecappelle | 1e97b27 | 2015-10-04 16:25:32 +0100 | [diff] [blame] | 44 | ifeq ($(BR2_CCACHE_USE_BASEDIR),y) |
| 45 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' |
| 46 | endif |
| 47 | |
Matt Weber | 7484c1c | 2018-09-17 16:21:49 -0500 | [diff] [blame] | 48 | ifeq ($(BR2_RELRO_PARTIAL),y) |
| 49 | TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_PARTIAL |
| 50 | else ifeq ($(BR2_RELRO_FULL),y) |
| 51 | TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL |
| 52 | endif |
| 53 | |
Matt Weber | f10822d | 2018-09-17 16:21:50 -0500 | [diff] [blame] | 54 | ifeq ($(BR2_SSP_REGULAR),y) |
| 55 | TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_REGULAR |
| 56 | else ifeq ($(BR2_SSP_STRONG),y) |
| 57 | TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_STRONG |
| 58 | else ifeq ($(BR2_SSP_ALL),y) |
| 59 | TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_ALL |
| 60 | endif |
| 61 | |
Jérôme Pouiller | 8087b02 | 2016-09-28 10:00:56 +0200 | [diff] [blame] | 62 | define TOOLCHAIN_WRAPPER_BUILD |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 63 | $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ |
| 64 | -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ |
| 65 | toolchain/toolchain-wrapper.c \ |
Jérôme Pouiller | 8087b02 | 2016-09-28 10:00:56 +0200 | [diff] [blame] | 66 | -o $(@D)/toolchain-wrapper |
| 67 | endef |
| 68 | |
| 69 | define TOOLCHAIN_WRAPPER_INSTALL |
| 70 | $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ |
Arnout Vandecappelle | 0f9c0bf | 2017-07-05 13:14:19 +0200 | [diff] [blame] | 71 | $(HOST_DIR)/bin/toolchain-wrapper |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 72 | endef |