]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0+ |
39f0e5f8 WD |
2 | # |
3 | # (C) Copyright 2000-2002 | |
4 | # Wolfgang Denk, DENX Software Engineering, [email protected]. | |
39f0e5f8 | 5 | |
8ae86b76 | 6 | ifndef CONFIG_STANDALONE_LOAD_ADDR |
a93fbf4a | 7 | ifneq ($(CONFIG_ARCH_OMAP2PLUS),) |
8ae86b76 | 8 | CONFIG_STANDALONE_LOAD_ADDR = 0x80300000 |
262ae0a6 | 9 | else |
8ae86b76 | 10 | CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 |
262ae0a6 MF |
11 | endif |
12 | endif | |
13 | ||
dd46eef2 SG |
14 | CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections |
15 | CFLAGS_EFI := -fpic -fshort-wchar | |
16 | ||
fd725691 | 17 | LDFLAGS_FINAL += --gc-sections |
3102274d | 18 | PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ |
0ae76531 | 19 | -fno-common -ffixed-r9 |
bf1af3d8 MY |
20 | PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ |
21 | $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) | |
fd725691 | 22 | |
b745e828 | 23 | # LLVM support |
3b6407b8 TR |
24 | LLVM_RELFLAGS := $(call cc-option,-mllvm,) \ |
25 | $(call cc-option,-mno-movt,) | |
b745e828 TR |
26 | PLATFORM_RELFLAGS += $(LLVM_RELFLAGS) |
27 | ||
90f984e3 | 28 | PLATFORM_CPPFLAGS += -D__ARM__ |
10a451cd | 29 | |
d57259b9 ÁFR |
30 | ifdef CONFIG_ARM64 |
31 | PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64 | |
32 | else | |
33 | PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm | |
34 | endif | |
35 | ||
5356f545 | 36 | # Choose between ARM/Thumb instruction sets |
3a649407 | 37 | ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y) |
75d7a0d7 SA |
38 | AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always) |
39 | PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \ | |
40 | $(call cc-option, -mthumb -mthumb-interwork,\ | |
5356f545 A |
41 | $(call cc-option,-marm,)\ |
42 | $(call cc-option,-mno-thumb-interwork,)\ | |
43 | ) | |
44 | else | |
45 | PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \ | |
46 | $(call cc-option,-mno-thumb-interwork,) | |
47 | endif | |
f772acf8 | 48 | |
06a119a0 | 49 | # Only test once |
3a649407 | 50 | ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y) |
d2366dfe | 51 | archprepare: checkthumb checkgcc6 |
388b2e52 MY |
52 | |
53 | checkthumb: | |
6e2f1538 TR |
54 | @if test "$(call cc-name)" = "gcc" -a \ |
55 | "$(call cc-version)" -lt "0404"; then \ | |
388b2e52 MY |
56 | echo -n '*** Your GCC does not produce working '; \ |
57 | echo 'binaries in THUMB mode.'; \ | |
58 | echo '*** Your board is configured for THUMB mode.'; \ | |
59 | false; \ | |
60 | fi | |
d2366dfe TR |
61 | else |
62 | archprepare: checkgcc6 | |
388b2e52 | 63 | endif |
06a119a0 | 64 | |
d2366dfe TR |
65 | checkgcc6: |
66 | @if test "$(call cc-name)" = "gcc" -a \ | |
67 | "$(call cc-version)" -lt "0600"; then \ | |
6b867dab TR |
68 | echo '*** Your GCC is older than 6.0 and is not supported'; \ |
69 | false; \ | |
d2366dfe TR |
70 | fi |
71 | ||
72 | ||
f772acf8 WD |
73 | # Try if EABI is supported, else fall back to old API, |
74 | # i. e. for example: | |
75 | # - with ELDK 4.2 (EABI supported), use: | |
5356f545 | 76 | # -mabi=aapcs-linux |
f772acf8 | 77 | # - with ELDK 4.1 (gcc 4.x, no EABI), use: |
5356f545 | 78 | # -mabi=apcs-gnu |
f772acf8 | 79 | # - with ELDK 3.1 (gcc 3.x), use: |
5356f545 | 80 | # -mapcs-32 |
cca4e4ae | 81 | PF_CPPFLAGS_ABI := $(call cc-option,\ |
5356f545 | 82 | -mabi=aapcs-linux,\ |
cca4e4ae WD |
83 | $(call cc-option,\ |
84 | -mapcs-32,\ | |
f772acf8 | 85 | $(call cc-option,\ |
cca4e4ae WD |
86 | -mabi=apcs-gnu,\ |
87 | )\ | |
5356f545 | 88 | )\ |
cca4e4ae WD |
89 | ) |
90 | PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI) | |
f772acf8 WD |
91 | |
92 | # For EABI, make sure to provide raise() | |
93 | ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS))) | |
5253418a A |
94 | # This file is parsed many times, so the string may get added multiple |
95 | # times. Also, the prefix needs to be different based on whether | |
96 | # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry | |
97 | # before adding the correct one. | |
a86cf89c MY |
98 | PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \ |
99 | $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS)) | |
f772acf8 | 100 | endif |
92d5ecba | 101 | |
92d5ecba | 102 | # needed for relocation |
a4594e41 | 103 | LDFLAGS_u-boot += -pie |
0f20bb60 AM |
104 | |
105 | # | |
106 | # FIXME: binutils versions < 2.22 have a bug in the assembler where | |
107 | # branches to weak symbols can be incorrectly optimized in thumb mode | |
108 | # to a short branch (b.n instruction) that won't reach when the symbol | |
109 | # gets preempted | |
110 | # | |
111 | # http://sourceware.org/bugzilla/show_bug.cgi?id=12532 | |
112 | # | |
3a649407 | 113 | ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y) |
0f20bb60 AM |
114 | ifeq ($(GAS_BUG_12532),) |
115 | export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \ | |
116 | then echo y; else echo n; fi) | |
117 | endif | |
118 | ifeq ($(GAS_BUG_12532),y) | |
119 | PLATFORM_RELFLAGS += -fno-optimize-sibling-calls | |
120 | endif | |
121 | endif | |
c37980c3 | 122 | |
c37980c3 | 123 | ifneq ($(CONFIG_SPL_BUILD),y) |
373d7983 | 124 | # Check that only R_ARM_RELATIVE relocations are generated. |
e6385c7e | 125 | INPUTS-y += checkarmreloc |
373d7983 JH |
126 | # The movt / movw can hardcode 16 bit parts of the addresses in the |
127 | # instruction. Relocation is not supported for that case, so disable | |
128 | # such usage by requiring word relocations. | |
129 | PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations) | |
397d7d5a | 130 | PLATFORM_CPPFLAGS += $(call cc-option, -fno-pic) |
c37980c3 | 131 | endif |
47ed5dd0 AA |
132 | |
133 | # limit ourselves to the sections we want in the .bin. | |
0ae76531 | 134 | ifdef CONFIG_ARM64 |
df88cb3b | 135 | OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ |
cf2a8fd6 | 136 | -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \ |
7e21fbca | 137 | -j .binman_sym_table -j .text_rest |
0ae76531 | 138 | else |
a5aa7ff3 | 139 | OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ |
cf2a8fd6 | 140 | -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \ |
7e21fbca | 141 | -j .binman_sym_table -j .text_rest |
0ae76531 | 142 | endif |
630d2345 | 143 | |
54cc4dcf PA |
144 | # if a dtb section exists we always have to include it |
145 | # there are only two cases where it is generated | |
146 | # 1) OF_EMBEDED is turned on | |
147 | # 2) unit tests include device tree blobs | |
072b2d88 | 148 | OBJCOPYFLAGS += -j .dtb.init.rodata |
072b2d88 | 149 | |
50149ea3 AG |
150 | ifdef CONFIG_EFI_LOADER |
151 | OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel | |
152 | endif | |
153 | ||
630d2345 MY |
154 | ifneq ($(CONFIG_IMX_CONFIG),) |
155 | ifdef CONFIG_SPL | |
156 | ifndef CONFIG_SPL_BUILD | |
e6385c7e | 157 | INPUTS-y += SPL |
630d2345 MY |
158 | endif |
159 | else | |
e64348f5 | 160 | ifeq ($(CONFIG_OF_SEPARATE),y) |
e6385c7e | 161 | INPUTS-y += u-boot-dtb.imx |
e64348f5 | 162 | else |
e6385c7e | 163 | INPUTS-y += u-boot.imx |
630d2345 MY |
164 | endif |
165 | endif | |
ed0c2c0a | 166 | ifneq ($(CONFIG_VF610),) |
e6385c7e | 167 | INPUTS-y += u-boot.vyb |
ed0c2c0a | 168 | endif |
e64348f5 | 169 | endif |
dd46eef2 SG |
170 | |
171 | EFI_LDS := elf_arm_efi.lds | |
172 | EFI_CRT0 := crt0_arm_efi.o | |
173 | EFI_RELOC := reloc_arm_efi.o |