1 # SPDX-License-Identifier: GPL-2.0+
3 # (C) Copyright 2000-2002
6 ifndef CONFIG_STANDALONE_LOAD_ADDR
7 ifneq ($(CONFIG_ARCH_OMAP2PLUS),)
8 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
10 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
14 CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
15 -fstack-protector-strong
16 CFLAGS_EFI := -fpic -fshort-wchar
18 LDFLAGS_FINAL += --gc-sections
19 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
20 -fno-common -ffixed-r9
21 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
22 $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
25 LLVM_RELFLAGS := $(call cc-option,-mllvm,) \
26 $(call cc-option,-mno-movt,)
27 PLATFORM_RELFLAGS += $(LLVM_RELFLAGS)
29 PLATFORM_CPPFLAGS += -D__ARM__
32 PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64
34 PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
37 # Choose between ARM/Thumb instruction sets
38 ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
39 AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always)
40 PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \
41 $(call cc-option, -mthumb -mthumb-interwork,\
42 $(call cc-option,-marm,)\
43 $(call cc-option,-mno-thumb-interwork,)\
46 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
47 $(call cc-option,-mno-thumb-interwork,)
51 ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
52 archprepare: checkthumb checkgcc6
55 @if test "$(call cc-name)" = "gcc" -a \
56 "$(call cc-version)" -lt "0404"; then \
57 echo -n '*** Your GCC does not produce working '; \
58 echo 'binaries in THUMB mode.'; \
59 echo '*** Your board is configured for THUMB mode.'; \
63 archprepare: checkgcc6
67 @if test "$(call cc-name)" = "gcc" -a \
68 "$(call cc-version)" -lt "0600"; then \
69 echo '*** Your GCC is older than 6.0 and is not supported'; \
74 # Try if EABI is supported, else fall back to old API,
76 # - with ELDK 4.2 (EABI supported), use:
78 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
80 # - with ELDK 3.1 (gcc 3.x), use:
82 PF_CPPFLAGS_ABI := $(call cc-option,\
91 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
93 # For EABI, make sure to provide raise()
94 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
95 # This file is parsed many times, so the string may get added multiple
96 # times. Also, the prefix needs to be different based on whether
97 # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
98 # before adding the correct one.
99 PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
100 $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
103 # needed for relocation
104 LDFLAGS_u-boot += -pie
107 # FIXME: binutils versions < 2.22 have a bug in the assembler where
108 # branches to weak symbols can be incorrectly optimized in thumb mode
109 # to a short branch (b.n instruction) that won't reach when the symbol
112 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
114 ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
115 ifeq ($(GAS_BUG_12532),)
116 export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
117 then echo y; else echo n; fi)
119 ifeq ($(GAS_BUG_12532),y)
120 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
124 ifneq ($(CONFIG_SPL_BUILD),y)
125 # Check that only R_ARM_RELATIVE relocations are generated.
126 INPUTS-y += checkarmreloc
127 # The movt / movw can hardcode 16 bit parts of the addresses in the
128 # instruction. Relocation is not supported for that case, so disable
129 # such usage by requiring word relocations.
130 PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
131 PLATFORM_CPPFLAGS += $(call cc-option, -fno-pic)
134 # limit ourselves to the sections we want in the .bin.
136 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
137 -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
138 -j .binman_sym_table -j .text_rest
140 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
141 -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
142 -j .binman_sym_table -j .text_rest
145 # if a dtb section exists we always have to include it
146 # there are only two cases where it is generated
147 # 1) OF_EMBEDED is turned on
148 # 2) unit tests include device tree blobs
149 OBJCOPYFLAGS += -j .dtb.init.rodata
151 ifdef CONFIG_EFI_LOADER
152 OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel
155 ifneq ($(CONFIG_IMX_CONFIG),)
157 ifndef CONFIG_SPL_BUILD
161 ifeq ($(CONFIG_OF_SEPARATE),y)
162 INPUTS-y += u-boot-dtb.imx
164 INPUTS-y += u-boot.imx
167 ifneq ($(CONFIG_VF610),)
168 INPUTS-y += u-boot.vyb
172 EFI_LDS := elf_arm_efi.lds
173 EFI_CRT0 := crt0_arm_efi.o
174 EFI_RELOC := reloc_arm_efi.o