]> Git Repo - J-u-boot.git/blob - arch/arm/config.mk
Merge branch '2021-04-20-assorted-improvements'
[J-u-boot.git] / arch / arm / config.mk
1 # SPDX-License-Identifier: GPL-2.0+
2 #
3 # (C) Copyright 2000-2002
4 # Wolfgang Denk, DENX Software Engineering, [email protected].
5
6 ifndef CONFIG_STANDALONE_LOAD_ADDR
7 ifneq ($(CONFIG_ARCH_OMAP2PLUS),)
8 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
9 else
10 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
11 endif
12 endif
13
14 CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
15                   -fstack-protector-strong
16 CFLAGS_EFI := -fpic -fshort-wchar
17
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,))
23
24 # LLVM support
25 LLVM_RELFLAGS           := $(call cc-option,-mllvm,) \
26                         $(call cc-option,-mno-movt,)
27 PLATFORM_RELFLAGS       += $(LLVM_RELFLAGS)
28
29 PLATFORM_CPPFLAGS += -D__ARM__
30
31 ifdef CONFIG_ARM64
32 PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64
33 else
34 PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
35 endif
36
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,)\
44                 )
45 else
46 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
47                 $(call cc-option,-mno-thumb-interwork,)
48 endif
49
50 # Only test once
51 ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
52 archprepare: checkthumb checkgcc6
53
54 checkthumb:
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.'; \
60                 false; \
61         fi
62 else
63 archprepare: checkgcc6
64 endif
65
66 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'; \
70                 false; \
71         fi
72
73
74 # Try if EABI is supported, else fall back to old API,
75 # i. e. for example:
76 # - with ELDK 4.2 (EABI supported), use:
77 #       -mabi=aapcs-linux
78 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
79 #       -mabi=apcs-gnu
80 # - with ELDK 3.1 (gcc 3.x), use:
81 #       -mapcs-32
82 PF_CPPFLAGS_ABI := $(call cc-option,\
83                         -mabi=aapcs-linux,\
84                         $(call cc-option,\
85                                 -mapcs-32,\
86                                 $(call cc-option,\
87                                         -mabi=apcs-gnu,\
88                                 )\
89                         )\
90                 )
91 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
92
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))
101 endif
102
103 # needed for relocation
104 LDFLAGS_u-boot += -pie
105
106 #
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
110 # gets preempted
111 #
112 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
113 #
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)
118 endif
119 ifeq ($(GAS_BUG_12532),y)
120 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
121 endif
122 endif
123
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)
132 endif
133
134 # limit ourselves to the sections we want in the .bin.
135 ifdef CONFIG_ARM64
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
139 else
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
143 endif
144
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
150
151 ifdef CONFIG_EFI_LOADER
152 OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel
153 endif
154
155 ifneq ($(CONFIG_IMX_CONFIG),)
156 ifdef CONFIG_SPL
157 ifndef CONFIG_SPL_BUILD
158 INPUTS-y += SPL
159 endif
160 else
161 ifeq ($(CONFIG_OF_SEPARATE),y)
162 INPUTS-y += u-boot-dtb.imx
163 else
164 INPUTS-y += u-boot.imx
165 endif
166 endif
167 ifneq ($(CONFIG_VF610),)
168 INPUTS-y += u-boot.vyb
169 endif
170 endif
171
172 EFI_LDS := elf_arm_efi.lds
173 EFI_CRT0 := crt0_arm_efi.o
174 EFI_RELOC := reloc_arm_efi.o
This page took 0.044196 seconds and 4 git commands to generate.