config.mk 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. ifndef CONFIG_STANDALONE_LOAD_ADDR
  8. ifneq ($(CONFIG_OMAP_COMMON),)
  9. CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
  10. else
  11. CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
  12. endif
  13. endif
  14. LDFLAGS_FINAL += --gc-sections
  15. PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
  16. -fno-common -ffixed-r9
  17. PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
  18. $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  19. # Support generic board on ARM
  20. __HAVE_ARCH_GENERIC_BOARD := y
  21. PLATFORM_CPPFLAGS += -D__ARM__
  22. # Choose between ARM/Thumb instruction sets
  23. ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
  24. PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
  25. $(call cc-option,-marm,)\
  26. $(call cc-option,-mno-thumb-interwork,)\
  27. )
  28. else
  29. PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
  30. $(call cc-option,-mno-thumb-interwork,)
  31. endif
  32. # Only test once
  33. ifneq ($(CONFIG_SPL_BUILD),y)
  34. ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
  35. archprepare: checkthumb
  36. checkthumb:
  37. @if test "$(call cc-version)" -lt "0404"; then \
  38. echo -n '*** Your GCC does not produce working '; \
  39. echo 'binaries in THUMB mode.'; \
  40. echo '*** Your board is configured for THUMB mode.'; \
  41. false; \
  42. fi
  43. endif
  44. endif
  45. # Try if EABI is supported, else fall back to old API,
  46. # i. e. for example:
  47. # - with ELDK 4.2 (EABI supported), use:
  48. # -mabi=aapcs-linux
  49. # - with ELDK 4.1 (gcc 4.x, no EABI), use:
  50. # -mabi=apcs-gnu
  51. # - with ELDK 3.1 (gcc 3.x), use:
  52. # -mapcs-32
  53. PF_CPPFLAGS_ABI := $(call cc-option,\
  54. -mabi=aapcs-linux,\
  55. $(call cc-option,\
  56. -mapcs-32,\
  57. $(call cc-option,\
  58. -mabi=apcs-gnu,\
  59. )\
  60. )\
  61. )
  62. PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
  63. # For EABI, make sure to provide raise()
  64. ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
  65. # This file is parsed many times, so the string may get added multiple
  66. # times. Also, the prefix needs to be different based on whether
  67. # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
  68. # before adding the correct one.
  69. PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
  70. $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
  71. endif
  72. # needed for relocation
  73. LDFLAGS_u-boot += -pie
  74. #
  75. # FIXME: binutils versions < 2.22 have a bug in the assembler where
  76. # branches to weak symbols can be incorrectly optimized in thumb mode
  77. # to a short branch (b.n instruction) that won't reach when the symbol
  78. # gets preempted
  79. #
  80. # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
  81. #
  82. ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
  83. ifeq ($(GAS_BUG_12532),)
  84. export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
  85. then echo y; else echo n; fi)
  86. endif
  87. ifeq ($(GAS_BUG_12532),y)
  88. PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
  89. endif
  90. endif
  91. ifneq ($(CONFIG_SPL_BUILD),y)
  92. # Check that only R_ARM_RELATIVE relocations are generated.
  93. ALL-y += checkarmreloc
  94. # The movt / movw can hardcode 16 bit parts of the addresses in the
  95. # instruction. Relocation is not supported for that case, so disable
  96. # such usage by requiring word relocations.
  97. PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
  98. endif
  99. # limit ourselves to the sections we want in the .bin.
  100. ifdef CONFIG_ARM64
  101. OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
  102. else
  103. OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
  104. endif
  105. ifdef CONFIG_OF_EMBED
  106. OBJCOPYFLAGS += -j .dtb.init.rodata
  107. endif
  108. ifneq ($(CONFIG_IMX_CONFIG),)
  109. ifdef CONFIG_SPL
  110. ifndef CONFIG_SPL_BUILD
  111. ALL-y += SPL
  112. endif
  113. else
  114. ifeq ($(CONFIG_OF_SEPARATE),y)
  115. ALL-y += u-boot-dtb.imx
  116. else
  117. ALL-y += u-boot.imx
  118. endif
  119. endif
  120. endif