Commit 42f5e8a25ad1a7504502e7f11ff4d563f1d6f1dd

Authored by Łukasz Majewski
Committed by Albert ARIBAUD
1 parent 284bb60ed6

build:arm: Remove setting of CROSS_COMPILE environment variable

After Kbuild introduction, the CROSS_COMPILE environment variable has been
set to some default value (prefix arm-linux-).

This shall be removed since it breaks building u-boot for native arm target
(like qemu ARM).
Moreover not all compilers have arm-linux- prefix.

Additionally the u-boot cross compiles with CROSS_COMPILE= set explicitly-
e.g.:
CROSS_COMPILE=/ .... /arm-v7a-linux-gnueabi- make

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Showing 1 changed file with 0 additions and 4 deletions Inline Diff

1 # 1 #
2 # (C) Copyright 2000-2002 2 # (C) Copyright 2000-2002
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 ifeq ($(CROSS_COMPILE),)
9 CROSS_COMPILE := arm-linux-
10 endif
11
12 ifndef CONFIG_STANDALONE_LOAD_ADDR 8 ifndef CONFIG_STANDALONE_LOAD_ADDR
13 ifneq ($(CONFIG_OMAP_COMMON),) 9 ifneq ($(CONFIG_OMAP_COMMON),)
14 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000 10 CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
15 else 11 else
16 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 12 CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
17 endif 13 endif
18 endif 14 endif
19 15
20 LDFLAGS_FINAL += --gc-sections 16 LDFLAGS_FINAL += --gc-sections
21 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ 17 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
22 -fno-common -ffixed-r9 18 -fno-common -ffixed-r9
23 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ 19 PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
24 $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) 20 $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
25 21
26 # Support generic board on ARM 22 # Support generic board on ARM
27 __HAVE_ARCH_GENERIC_BOARD := y 23 __HAVE_ARCH_GENERIC_BOARD := y
28 24
29 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__ 25 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
30 26
31 # Choose between ARM/Thumb instruction sets 27 # Choose between ARM/Thumb instruction sets
32 ifeq ($(CONFIG_SYS_THUMB_BUILD),y) 28 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
33 PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\ 29 PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\
34 $(call cc-option,-marm,)\ 30 $(call cc-option,-marm,)\
35 $(call cc-option,-mno-thumb-interwork,)\ 31 $(call cc-option,-mno-thumb-interwork,)\
36 ) 32 )
37 else 33 else
38 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \ 34 PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
39 $(call cc-option,-mno-thumb-interwork,) 35 $(call cc-option,-mno-thumb-interwork,)
40 endif 36 endif
41 37
42 # Only test once 38 # Only test once
43 ifneq ($(CONFIG_SPL_BUILD),y) 39 ifneq ($(CONFIG_SPL_BUILD),y)
44 ifeq ($(CONFIG_SYS_THUMB_BUILD),y) 40 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
45 archprepare: checkthumb 41 archprepare: checkthumb
46 42
47 checkthumb: 43 checkthumb:
48 @if test "$(call cc-version)" -lt "0404"; then \ 44 @if test "$(call cc-version)" -lt "0404"; then \
49 echo -n '*** Your GCC does not produce working '; \ 45 echo -n '*** Your GCC does not produce working '; \
50 echo 'binaries in THUMB mode.'; \ 46 echo 'binaries in THUMB mode.'; \
51 echo '*** Your board is configured for THUMB mode.'; \ 47 echo '*** Your board is configured for THUMB mode.'; \
52 false; \ 48 false; \
53 fi 49 fi
54 endif 50 endif
55 endif 51 endif
56 52
57 # Try if EABI is supported, else fall back to old API, 53 # Try if EABI is supported, else fall back to old API,
58 # i. e. for example: 54 # i. e. for example:
59 # - with ELDK 4.2 (EABI supported), use: 55 # - with ELDK 4.2 (EABI supported), use:
60 # -mabi=aapcs-linux 56 # -mabi=aapcs-linux
61 # - with ELDK 4.1 (gcc 4.x, no EABI), use: 57 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
62 # -mabi=apcs-gnu 58 # -mabi=apcs-gnu
63 # - with ELDK 3.1 (gcc 3.x), use: 59 # - with ELDK 3.1 (gcc 3.x), use:
64 # -mapcs-32 60 # -mapcs-32
65 PF_CPPFLAGS_ABI := $(call cc-option,\ 61 PF_CPPFLAGS_ABI := $(call cc-option,\
66 -mabi=aapcs-linux,\ 62 -mabi=aapcs-linux,\
67 $(call cc-option,\ 63 $(call cc-option,\
68 -mapcs-32,\ 64 -mapcs-32,\
69 $(call cc-option,\ 65 $(call cc-option,\
70 -mabi=apcs-gnu,\ 66 -mabi=apcs-gnu,\
71 )\ 67 )\
72 )\ 68 )\
73 ) 69 )
74 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI) 70 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
75 71
76 # For EABI, make sure to provide raise() 72 # For EABI, make sure to provide raise()
77 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS))) 73 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
78 # This file is parsed many times, so the string may get added multiple 74 # This file is parsed many times, so the string may get added multiple
79 # times. Also, the prefix needs to be different based on whether 75 # times. Also, the prefix needs to be different based on whether
80 # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry 76 # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
81 # before adding the correct one. 77 # before adding the correct one.
82 PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \ 78 PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
83 $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS)) 79 $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
84 endif 80 endif
85 81
86 # needed for relocation 82 # needed for relocation
87 LDFLAGS_u-boot += -pie 83 LDFLAGS_u-boot += -pie
88 84
89 # 85 #
90 # FIXME: binutils versions < 2.22 have a bug in the assembler where 86 # FIXME: binutils versions < 2.22 have a bug in the assembler where
91 # branches to weak symbols can be incorrectly optimized in thumb mode 87 # branches to weak symbols can be incorrectly optimized in thumb mode
92 # to a short branch (b.n instruction) that won't reach when the symbol 88 # to a short branch (b.n instruction) that won't reach when the symbol
93 # gets preempted 89 # gets preempted
94 # 90 #
95 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532 91 # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
96 # 92 #
97 ifeq ($(CONFIG_SYS_THUMB_BUILD),y) 93 ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
98 ifeq ($(GAS_BUG_12532),) 94 ifeq ($(GAS_BUG_12532),)
99 export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \ 95 export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
100 then echo y; else echo n; fi) 96 then echo y; else echo n; fi)
101 endif 97 endif
102 ifeq ($(GAS_BUG_12532),y) 98 ifeq ($(GAS_BUG_12532),y)
103 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls 99 PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
104 endif 100 endif
105 endif 101 endif
106 102
107 ifneq ($(CONFIG_SPL_BUILD),y) 103 ifneq ($(CONFIG_SPL_BUILD),y)
108 # Check that only R_ARM_RELATIVE relocations are generated. 104 # Check that only R_ARM_RELATIVE relocations are generated.
109 ALL-y += checkarmreloc 105 ALL-y += checkarmreloc
110 # The movt / movw can hardcode 16 bit parts of the addresses in the 106 # The movt / movw can hardcode 16 bit parts of the addresses in the
111 # instruction. Relocation is not supported for that case, so disable 107 # instruction. Relocation is not supported for that case, so disable
112 # such usage by requiring word relocations. 108 # such usage by requiring word relocations.
113 PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations) 109 PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
114 endif 110 endif
115 111
116 # limit ourselves to the sections we want in the .bin. 112 # limit ourselves to the sections we want in the .bin.
117 ifdef CONFIG_ARM64 113 ifdef CONFIG_ARM64
118 OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn 114 OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
119 else 115 else
120 OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn 116 OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
121 endif 117 endif
122 118
123 ifneq ($(CONFIG_IMX_CONFIG),) 119 ifneq ($(CONFIG_IMX_CONFIG),)
124 ifdef CONFIG_SPL 120 ifdef CONFIG_SPL
125 ifndef CONFIG_SPL_BUILD 121 ifndef CONFIG_SPL_BUILD
126 ALL-y += SPL 122 ALL-y += SPL
127 endif 123 endif
128 else 124 else
129 ifeq ($(CONFIG_OF_SEPARATE),y) 125 ifeq ($(CONFIG_OF_SEPARATE),y)
130 ALL-y += u-boot-dtb.imx 126 ALL-y += u-boot-dtb.imx
131 else 127 else
132 ALL-y += u-boot.imx 128 ALL-y += u-boot.imx
133 endif 129 endif
134 endif 130 endif
135 endif 131 endif
136 132