Skip to content

Commit 2ca23ec

Browse files
committed
cargo_bin.bbclass: Minimize calls to rust_target
Don't evaluate this inside a function definition. Fixes issues with "metadata is not deterministic". Fixes rust-embedded#195
1 parent c433ca7 commit 2ca23ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

classes/cargo_bin.bbclass

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export CARGO_TARGET_DIR = "${B}"
1919

2020
RUST_TARGET = "${@rust_target(d, 'TARGET')}"
2121
RUST_BUILD = "${@rust_target(d, 'BUILD')}"
22+
CARGO_TARGET_LINKER_NAME = "${@d.getVar('RUST_TARGET', True).replace('-','_').upper()}"
2223

2324
# Additional flags passed directly to the "cargo build" invocation
2425
EXTRA_CARGO_FLAGS ??= ""
@@ -112,7 +113,7 @@ cargo_bin_do_compile() {
112113
export CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true"
113114
export CARGO_UNSTABLE_HOST_CONFIG="true"
114115
export CARGO_TARGET_APPLIES_TO_HOST="false"
115-
export CARGO_TARGET_${@rust_target(d, 'TARGET').replace('-','_').upper()}_LINKER="${WRAPPER_DIR}/linker-wrapper.sh"
116+
export CARGO_TARGET_${CARGO_TARGET_LINKER_NAME}_LINKER="${WRAPPER_DIR}/linker-wrapper.sh"
116117
export CARGO_HOST_LINKER="${WRAPPER_DIR}/linker-native-wrapper.sh"
117118
export CARGO_BUILD_FLAGS="-C rpath"
118119
export CARGO_PROFILE_RELEASE_DEBUG="true"

0 commit comments

Comments
 (0)