2018-04-01 07:08:27 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# definition of the toolchain wrapper build commands
|
|
|
|
#
|
|
|
|
################################################################################
|
2015-10-04 14:28:41 +02:00
|
|
|
|
|
|
|
# We use --hash-style=both to increase the compatibility of the generated
|
|
|
|
# binary with older platforms, except for MIPS, where the only acceptable
|
|
|
|
# hash style is 'sysv'
|
|
|
|
ifeq ($(findstring mips,$(HOSTARCH)),mips)
|
|
|
|
TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
|
|
|
|
else
|
|
|
|
TOOLCHAIN_WRAPPER_HASH_STYLE = both
|
|
|
|
endif
|
|
|
|
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
|
|
|
|
|
2019-03-12 13:09:32 +01:00
|
|
|
TOOLCHAIN_WRAPPER_OPTS = \
|
2019-07-18 22:52:48 +02:00
|
|
|
$(ARCH_TOOLCHAIN_WRAPPER_OPTS) \
|
2019-03-12 13:09:33 +01:00
|
|
|
$(call qstrip,$(BR2_SSP_OPTION)) \
|
2019-03-12 13:09:32 +01:00
|
|
|
$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
|
|
|
|
|
2019-08-31 20:01:12 +02:00
|
|
|
ifeq ($(BR2_REPRODUCIBLE),y)
|
|
|
|
TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none
|
2019-08-31 20:01:13 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
|
|
|
|
TOOLCHAIN_WRAPPER_OPTS += -ffile-prefix-map=$(BASE_DIR)=buildroot
|
|
|
|
else
|
|
|
|
TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined
|
|
|
|
endif
|
2020-06-26 17:49:27 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_7),)
|
|
|
|
TOOLCHAIN_WRAPPER_OPTS += -DBR_NEED_SOURCE_DATE_EPOCH
|
|
|
|
endif
|
2019-08-31 20:01:12 +02:00
|
|
|
endif
|
|
|
|
|
2015-10-04 14:28:41 +02:00
|
|
|
# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
|
|
|
|
# separate argument when used in execv() by the toolchain wrapper.
|
2019-03-12 13:09:32 +01:00
|
|
|
TOOLCHAIN_WRAPPER_ARGS += \
|
|
|
|
-DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TOOLCHAIN_WRAPPER_OPTS),"$(f)"$(comma))'
|
2015-10-04 14:28:41 +02:00
|
|
|
|
2015-10-04 17:23:56 +02:00
|
|
|
ifeq ($(BR2_CCACHE),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
|
|
|
|
endif
|
|
|
|
|
2015-10-19 13:02:52 +02:00
|
|
|
ifeq ($(BR2_x86_x1000),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
|
|
|
|
endif
|
|
|
|
|
2016-11-09 17:16:57 +01:00
|
|
|
# Avoid FPU bug on XBurst CPUs
|
|
|
|
ifeq ($(BR2_mips_xburst),y)
|
2018-03-31 19:54:20 +02:00
|
|
|
# Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is
|
|
|
|
# needed
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
|
|
|
|
else
|
2016-11-09 17:16:57 +01:00
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
|
|
|
|
endif
|
2018-03-31 19:54:20 +02:00
|
|
|
endif
|
2016-11-09 17:16:57 +01:00
|
|
|
|
2015-10-04 17:25:32 +02:00
|
|
|
ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
|
|
|
|
endif
|
|
|
|
|
2019-03-12 13:09:36 +01:00
|
|
|
ifeq ($(BR2_PIC_PIE),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR2_PIC_PIE
|
|
|
|
endif
|
|
|
|
|
2018-09-17 23:21:49 +02:00
|
|
|
ifeq ($(BR2_RELRO_PARTIAL),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_PARTIAL
|
|
|
|
else ifeq ($(BR2_RELRO_FULL),y)
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL
|
|
|
|
endif
|
|
|
|
|
2016-09-28 10:00:56 +02:00
|
|
|
define TOOLCHAIN_WRAPPER_BUILD
|
2015-10-04 14:28:41 +02:00
|
|
|
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
|
|
|
|
-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
|
|
|
|
toolchain/toolchain-wrapper.c \
|
2016-09-28 10:00:56 +02:00
|
|
|
-o $(@D)/toolchain-wrapper
|
|
|
|
endef
|
|
|
|
|
|
|
|
define TOOLCHAIN_WRAPPER_INSTALL
|
|
|
|
$(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
|
2017-07-05 13:14:19 +02:00
|
|
|
$(HOST_DIR)/bin/toolchain-wrapper
|
2015-10-04 14:28:41 +02:00
|
|
|
endef
|