Skip to content

Commit 70cefe7

Browse files
geertuczankel
authored andcommitted
xtensa: Setup CROSS_COMPILE at the top
CROSS_COMPILE must be setup before using e.g. cc-option (and a few other as-*, cc-*, ld-* macros), else they will check against the wrong compiler when cross-compiling, and may invoke the cross compiler with wrong or suboptimal compiler options. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent 9ad79b5 commit 70cefe7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎arch/xtensa/Makefile‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
2121
VARIANT = $(variant-y)
2222
export VARIANT
2323

24+
# Test for cross compiling
25+
26+
ifneq ($(VARIANT),)
27+
COMPILE_ARCH = $(shell uname -m)
28+
29+
ifneq ($(COMPILE_ARCH), xtensa)
30+
ifndef CROSS_COMPILE
31+
CROSS_COMPILE = xtensa_$(VARIANT)-
32+
endif
33+
endif
34+
endif
35+
2436
# Platform configuration
2537

2638
platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
@@ -48,18 +60,6 @@ endif
4860

4961
KBUILD_DEFCONFIG := iss_defconfig
5062

51-
# Test for cross compiling
52-
53-
ifneq ($(VARIANT),)
54-
COMPILE_ARCH = $(shell uname -m)
55-
56-
ifneq ($(COMPILE_ARCH), xtensa)
57-
ifndef CROSS_COMPILE
58-
CROSS_COMPILE = xtensa_$(VARIANT)-
59-
endif
60-
endif
61-
endif
62-
6363
# Only build variant and/or platform if it includes a Makefile
6464

6565
buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)

0 commit comments

Comments
 (0)