config.mk 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #
  2. # (C) Copyright 2000-2002
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. CROSS_COMPILE ?= arm-linux-
  8. ifndef CONFIG_STANDALONE_LOAD_ADDR
  9. ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TI814X),)
  10. CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
  11. else
  12. CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
  13. endif
  14. endif
  15. LDFLAGS_FINAL += --gc-sections
  16. PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
  17. # Support generic board on ARM
  18. __HAVE_ARCH_GENERIC_BOARD := y
  19. PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
  20. # Choose between ARM/Thumb instruction sets
  21. ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
  22. PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
  23. $(call cc-option,-marm,)\
  24. $(call cc-option,-mno-thumb-interwork,)\
  25. )
  26. else
  27. PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
  28. $(call cc-option,-mno-thumb-interwork,)
  29. endif
  30. # Only test once
  31. ifneq ($(CONFIG_SPL_BUILD),y)
  32. ALL-$(CONFIG_SYS_THUMB_BUILD) += checkthumb
  33. endif
  34. # Try if EABI is supported, else fall back to old API,
  35. # i. e. for example:
  36. # - with ELDK 4.2 (EABI supported), use:
  37. # -mabi=aapcs-linux
  38. # - with ELDK 4.1 (gcc 4.x, no EABI), use:
  39. # -mabi=apcs-gnu
  40. # - with ELDK 3.1 (gcc 3.x), use:
  41. # -mapcs-32
  42. PF_CPPFLAGS_ABI := $(call cc-option,\
  43. -mabi=aapcs-linux,\
  44. $(call cc-option,\
  45. -mapcs-32,\
  46. $(call cc-option,\
  47. -mabi=apcs-gnu,\
  48. )\
  49. )\
  50. )
  51. PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
  52. # For EABI, make sure to provide raise()
  53. ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
  54. # This file is parsed many times, so the string may get added multiple
  55. # times. Also, the prefix needs to be different based on whether
  56. # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
  57. # before adding the correct one.
  58. ifdef CONFIG_SPL_BUILD
  59. PLATFORM_LIBS := $(SPLTREE)/arch/arm/lib/eabi_compat.o \
  60. $(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
  61. else
  62. PLATFORM_LIBS := $(OBJTREE)/arch/arm/lib/eabi_compat.o \
  63. $(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
  64. endif
  65. endif
  66. # needed for relocation
  67. LDFLAGS_u-boot += -pie
  68. #
  69. # FIXME: binutils versions < 2.22 have a bug in the assembler where
  70. # branches to weak symbols can be incorrectly optimized in thumb mode
  71. # to a short branch (b.n instruction) that won't reach when the symbol
  72. # gets preempted
  73. #
  74. # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
  75. #
  76. ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
  77. ifeq ($(GAS_BUG_12532),)
  78. export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
  79. then echo y; else echo n; fi)
  80. endif
  81. ifeq ($(GAS_BUG_12532),y)
  82. PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
  83. endif
  84. endif
  85. # check that only R_ARM_RELATIVE relocations are generated
  86. ifneq ($(CONFIG_SPL_BUILD),y)
  87. ALL-y += checkarmreloc
  88. endif