package/pkg-cargo.mk: use CARGO_TARGET_<target>_LINKER instead of cargo config file

package/rustc/rustc.mk produces a config file in $(CARGO_HOME) that
points to the linker. We can simplify that by using the
CARGO_TARGET_<target>_LINKER environment variable.

This will also fix problems when host == target, where the target
linker gets picked up incorrectly.

Fixes:

  http://autobuild.buildroot.net/results/2183f1835f2ef553e45e83959910205127b2b259/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Petazzoni 2022-01-09 11:40:04 +01:00
parent 91a5a2d317
commit b6378631c2
3 changed files with 2 additions and 15 deletions

View File

@ -43,7 +43,8 @@ PKG_CARGO_ENV = \
__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" \
CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true" \
CARGO_TARGET_APPLIES_TO_HOST="false" \
CARGO_BUILD_TARGET="$(RUSTC_TARGET_NAME)"
CARGO_BUILD_TARGET="$(RUSTC_TARGET_NAME)" \
CARGO_TARGET_$(subst,-,_,$(RUSTC_TARGET_NAME))_LINKER=$(notdir $(TARGET_CROSS))gcc
HOST_PKG_CARGO_ENV = \
$(PKG_COMMON_CARGO_ENV)

View File

@ -1,2 +0,0 @@
[target.@RUSTC_TARGET_NAME@]
linker = "@CROSS_PREFIX@gcc"

View File

@ -20,15 +20,3 @@ endif
RUSTC_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu
$(eval $(host-virtual-package))
ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
define RUSTC_INSTALL_CARGO_CONFIG
mkdir -p $(HOST_DIR)/share/cargo
sed -e 's/@RUSTC_TARGET_NAME@/$(RUSTC_TARGET_NAME)/' \
-e 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \
package/rustc/cargo-config.in \
> $(HOST_DIR)/share/cargo/config
endef
# check-package disable TypoInPackageVariable - TOOLCHAIN intended
TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += RUSTC_INSTALL_CARGO_CONFIG
endif