toolchain-wrapper.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # This file contains the definition of the toolchain wrapper build commands
  2. # We use --hash-style=both to increase the compatibility of the generated
  3. # binary with older platforms, except for MIPS, where the only acceptable
  4. # hash style is 'sysv'
  5. ifeq ($(findstring mips,$(HOSTARCH)),mips)
  6. TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
  7. else
  8. TOOLCHAIN_WRAPPER_HASH_STYLE = both
  9. endif
  10. TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
  11. TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
  12. # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
  13. # separate argument when used in execv() by the toolchain wrapper.
  14. TOOLCHAIN_WRAPPER_OPTS = \
  15. $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
  16. TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
  17. ifeq ($(BR2_CCACHE),y)
  18. TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
  19. endif
  20. ifeq ($(BR2_x86_x1000),y)
  21. TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
  22. endif
  23. # Avoid FPU bug on XBurst CPUs
  24. ifeq ($(BR2_mips_xburst),y)
  25. # Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is
  26. # needed
  27. ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
  28. TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
  29. else
  30. TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
  31. endif
  32. endif
  33. ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
  34. TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
  35. endif
  36. define TOOLCHAIN_WRAPPER_BUILD
  37. $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
  38. -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
  39. toolchain/toolchain-wrapper.c \
  40. -o $(@D)/toolchain-wrapper
  41. endef
  42. define TOOLCHAIN_WRAPPER_INSTALL
  43. $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
  44. $(HOST_DIR)/bin/toolchain-wrapper
  45. endef