toolchain-wrapper.mk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
  26. endif
  27. ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
  28. TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
  29. endif
  30. define TOOLCHAIN_WRAPPER_BUILD
  31. $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
  32. -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
  33. toolchain/toolchain-wrapper.c \
  34. -o $(@D)/toolchain-wrapper
  35. endef
  36. define TOOLCHAIN_WRAPPER_INSTALL
  37. $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
  38. $(HOST_DIR)/usr/bin/toolchain-wrapper
  39. endef