From 1cb0b64537f234c084c836eb47b73cdffb5c0da0 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 24 Sep 2016 13:20:00 -0400 Subject: [PATCH 1/5] rust: remove duplicated TARGET_LLVM_* vars --- recipes-devtools/rust/rust.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 253f676..c7c4bd5 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -238,12 +238,9 @@ def ldflags_for(d, thing, arch): TARGET_LLVM_CPU="${@llvm_cpu(d)}" TARGET_LLVM_FEATURES = "${@llvm_features_from_tune(d)} ${@llvm_features_from_cc_arch(d)}" -TARGET_LLVM_CPU_class-cross="${@llvm_cpu(d)}" -TARGET_LLVM_FEATURES_class-cross = "${@llvm_features_from_tune(d)} ${@llvm_features_from_cc_arch(d)}" # class-native implies TARGET=HOST, and TUNE_FEATURES only describes the real # (original) target. -TARGET_LLVM_CPU="${@llvm_cpu(d)}" TARGET_LLVM_FEATURES_class-native = "${@llvm_features_from_cc_arch(d)}" def rust_gen_target(d, thing, wd): From 45d540de3613b4f29ab0a2a0fa25d694986173d8 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 00:53:39 -0400 Subject: [PATCH 2/5] rust.inc: EXTRA_OEMAKE is now empty by default, drop our set Since poky rev: f8520142c8a33fa9414314511fb01fbe79a2bf01, oe-core rev: aeb653861a0ec39ea7a014c0622980edcbf653fa --- recipes-devtools/rust/rust.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index c7c4bd5..f28f0b5 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -13,9 +13,6 @@ B = "${WORKDIR}/build" DEPENDS += "file-native" -# Avoid having the default bitbake.conf disable sub-make parallelization -EXTRA_OEMAKE = "" - PACKAGECONFIG ??= "" # Controls whether we use the local rust to build. From 9b8d884d6b51d7839beb4b6cf998c7c1f4dacdce Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 02:29:29 -0400 Subject: [PATCH 3/5] rust.inc: start passing *FLAGS vars to compile When rust's build system builds llvm itself, it uses these flags. Avoid them interfering with other things by cleaning their usage out of the platform cfg mk file. --- recipes-devtools/rust/rust.inc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index f28f0b5..522b910 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -320,6 +320,15 @@ def rust_gen_mk_cfg(d, thing): i = open(d.getVar('S', True) + '/mk/cfg/' + rust_base_sys + '.mk', 'r') r = subprocess.call(['sed', + # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a + # wide range of targets (not just HOST). Yocto's settings for them will + # be inappropriate, avoid having random targets try to use them, we'll + # add as needed. + '-e', 's/$(CFLAGS)//', + '-e', 's/$(CXXFLAGS)//', + '-e', 's/$(CPPFLAGS)//', + '-e', 's/$(LDFLAGS)//', + # update all triplets to the new one '-e', 's/{}/{}/g'.format(rust_base_sys, sys), @@ -377,14 +386,6 @@ do_configure () { # FIXME: target_prefix vs prefix, see cross.bbclass - # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a - # wide range of targets (not just HOST). Yocto's settings for them will - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - # FIXME: this path to rustc (via `which rustc`) may not be quite right in the case # where we're reinstalling the compiler. May want to try for a real # path based on bitbake vars From 41800bdd99f7e8ecc7d836faf21e2c31b9a2c63d Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 02:30:46 -0400 Subject: [PATCH 4/5] rust.inc: ensure proper flags are given to rustllvm rustllvm ships some c++ code that we need to ensure is built with the flags we want. Abuse an existing variable to make this happen. This should fix our issues with the libstdc++ cxx11 abi (_GLIBCXX_USE_CXX11_ABI). --- recipes-devtools/rust/rust.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 522b910..e4f3956 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -359,6 +359,13 @@ def rust_gen_mk_cfg(d, thing): if r: raise Exception o.write("OBJCOPY_{} := {}objcopy\n".format(sys, prefix)) + # Note: this isn't how this variable is supposed to be used, but for + # non-msvc platforms nothing else touches it. + # These are the only extra flags passed to the rustllvm (c++ code) build. + # These are only used for host (even though we emit them for all targets) + # Without this, there are link failures due to GLIBC_CXX11_ABI issues in + # certain setups. + o.write("EXTRA_RUSTLLVM_CXXFLAGS_{} := {}\n".format(sys, cxxflags_for(d, thing))) o.close() i.close() From 1436b996928f93da4a23b11d33416b3a05292d0e Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 1 Oct 2016 20:52:32 -0400 Subject: [PATCH 5/5] rust: avoid using flags for TARGET for non-TARGET --- recipes-devtools/rust/rust.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index e4f3956..b886e2a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -247,8 +247,10 @@ def rust_gen_target(d, thing, wd): prefix = prefix_for(d, thing) features = "" + cpu = "generic" if thing is "TARGET": features = d.getVar('TARGET_LLVM_FEATURES', True) or "" + cpu = d.getVar('TARGET_LLVM_CPU', True) features = features or d.getVarFlag('FEATURES', arch, True) or "" # build tspec @@ -264,7 +266,7 @@ def rust_gen_target(d, thing, wd): tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE', True), prefix) tspec['objcopy'] = "{}objcopy".format(prefix) tspec['ar'] = "{}ar".format(prefix) - tspec['cpu'] = d.getVar('TARGET_LLVM_CPU', True) + tspec['cpu'] = cpu if features is not "": tspec['features'] = features tspec['dynamic-linking'] = True