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