Skip to content

Commit 4401f88

Browse files
committed
auto merge of #13631 : alexcrichton/rust/fix-mk-cross, r=brson
Instead of passing through CC which may have things like ccache and other arguments (when using clang) this commit filters out the necessary arguments from CC to pass the right linker to rustc. Closes #13562
2 parents 829c00c + 80bd176 commit 4401f88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mk/platform.mk

+4-1
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,17 @@ ifdef CFG_CCACHE_BASEDIR
542542
export CCACHE_BASEDIR
543543
endif
544544

545+
FIND_COMPILER = $(word 1,$(1:ccache=))
546+
545547
define CFG_MAKE_TOOLCHAIN
546548
# Prepend the tools with their prefix if cross compiling
547549
ifneq ($(CFG_BUILD),$(1))
548550
CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
549551
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
550552
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
551553
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
552-
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(CXX_$(1)) -C ar=$$(AR_$(1)) $(RUSTC_CROSS_FLAGS_$(1))
554+
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CXX_$(1))) \
555+
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
553556

554557
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
555558
endif

0 commit comments

Comments
 (0)