config.mk 3.3 KB

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