toolchain-wrapper.mk 1.8 KB

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