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