2 # (C) Copyright 2000-2002
5 # SPDX-License-Identifier: GPL-2.0+
8 ifeq ($(CROSS_COMPILE),)
9 CROSS_COMPILE := arm-linux-
12 ifndef CONFIG_STANDALONE_LOAD_ADDR
13 ifneq ($(CONFIG_OMAP_COMMON),)
14 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
16 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
20 LDFLAGS_FINAL += --gc-sections
21 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
22 -fno-common -ffixed-r9
23 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
24 $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
26 # Support generic board on ARM
27 __HAVE_ARCH_GENERIC_BOARD := y
29 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
31 # Choose between ARM/Thumb instruction sets
32 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
33 PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
34 $(call cc-option,-marm,)\
35 $(call cc-option,-mno-thumb-interwork,)\
38 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
39 $(call cc-option,-mno-thumb-interwork,)
43 ifneq ($(CONFIG_SPL_BUILD),y)
44 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
45 archprepare: checkthumb
48 @if test "$(call cc-version)" -lt "0404"; then \
49 echo -n '*** Your GCC does not produce working '; \
50 echo 'binaries in THUMB mode.'; \
51 echo '*** Your board is configured for THUMB mode.'; \
57 # Try if EABI is supported, else fall back to old API,
59 # - with ELDK 4.2 (EABI supported), use:
61 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
63 # - with ELDK 3.1 (gcc 3.x), use:
65 PF_CPPFLAGS_ABI := $(call cc-option,\
74 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
76 # For EABI, make sure to provide raise()
77 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
78 # This file is parsed many times, so the string may get added multiple
79 # times. Also, the prefix needs to be different based on whether
80 # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
81 # before adding the correct one.
82 PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
83 $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
86 # needed for relocation
87 LDFLAGS_u-boot += -pie
90 # FIXME: binutils versions < 2.22 have a bug in the assembler where
91 # branches to weak symbols can be incorrectly optimized in thumb mode
92 # to a short branch (b.n instruction) that won't reach when the symbol
95 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
97 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
98 ifeq ($(GAS_BUG_12532),)
99 export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
100 then echo y; else echo n; fi)
102 ifeq ($(GAS_BUG_12532),y)
103 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
107 ifneq ($(CONFIG_SPL_BUILD),y)
108 # Check that only R_ARM_RELATIVE relocations are generated.
109 ALL-y += checkarmreloc
110 # The movt / movw can hardcode 16 bit parts of the addresses in the
111 # instruction. Relocation is not supported for that case, so disable
112 # such usage by requiring word relocations.
113 PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
116 # limit ourselves to the sections we want in the .bin.
118 OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
120 OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
123 ifneq ($(CONFIG_IMX_CONFIG),)
125 ifndef CONFIG_SPL_BUILD