diff --git a/classes/rust.bbclass b/classes/rust.bbclass index b5d2ba0..1860ac6 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -63,7 +63,7 @@ RUST_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}" #RUST_PATH_NATIVE .= ":${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib" # FIXME: set based on whether we are native vs cross vs buildsdk, etc -export RUST_PATH ??= "${RUST_PATH_NATIVE}" +#export RUST_PATH ??= "${RUST_PATH_NATIVE}" ## This is builtin to rustc with the value "$libdir/rust/targets" # RUST_TARGET_PATH = "foo:bar" diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index a7d2a07..5f84895 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -58,9 +58,16 @@ HOST_CPPFLAGS ??= "${CPPFLAGS}" # users of these variables without any backtrace or error message other than # "failed" (of some form or another). Probably an issue with bitbake attempting # to track variable users and us having too many dynamic variable names. -TARGET_PRE_LINK_ARGS = "${TARGET_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${TARGET_LDFLAGS} ${PRE_LINK_ARGS[${TARGET_ARCH}]}" -BUILD_PRE_LINK_ARGS = "${BUILD_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${BUILD_LDFLAGS} ${PRE_LINK_ARGS[${BUILD_ARCH}]}" -HOST_PRE_LINK_ARGS = "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${HOST_LDFLAGS} ${PRE_LINK_ARGS[${HOST_ARCH}]}" +TARGET_PRE_LINK_ARGS = "${TARGET_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${PRE_LINK_ARGS[${TARGET_ARCH}]}" +BUILD_PRE_LINK_ARGS = "${BUILD_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${PRE_LINK_ARGS[${BUILD_ARCH}]}" +HOST_PRE_LINK_ARGS = "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${PRE_LINK_ARGS[${HOST_ARCH}]}" + +# These LDFLAGS have '-L' options in them. We need these to come last so they +# don't screw up the link order and pull in the wrong rust build/version. +# TODO: may want to strip out all the '-L' flags entirely here +TARGET_POST_LINK_ARGS = "${TARGET_LDFLAGS}" +BUILD_POST_LINK_ARGS = "${BUILD_LDFLAGS}" +HOST_POST_LINK_ARGS = "${HOST_LDFLAGS}" def arch_for(d, thing): return d.getVar('{}_ARCH'.format(thing), True) @@ -126,6 +133,9 @@ def rust_gen_target(d, thing, wd): pre_link_args = (d.getVar('{}_PRE_LINK_ARGS'.format(thing), True) or "").split() pre_link_args.extend((d.getVarFlag('PRE_LINK_ARGS', arch, True) or "").split()) + post_link_args = (d.getVar('{}_POST_LINK_ARGS'.format(thing), True) or "").split() + post_link_args.extend((d.getVarFlag('POST_LINK_ARGS', arch, True) or "").split()) + o.write('''{{ "data-layout": "{}", "llvm-target": "{}", @@ -141,7 +151,8 @@ def rust_gen_target(d, thing, wd): "linker-is-gnu": true, "has-rpath": true, "position-independent-executables": true, - "pre-link-args": {} + "pre-link-args": {}, + "post-link-args": {} }}'''.format( data_layout, llvm_target, @@ -149,7 +160,8 @@ def rust_gen_target(d, thing, wd): arch_to_rust_target_arch(arch), linker, features, - as_json(pre_link_args) + as_json(pre_link_args), + as_json(post_link_args), )) o.close()