lang/rust: fix build on powerpc64 elfv2

After upgrade to LLVM 10, core in stage 1 fails to compile (no clear reason, rustc crashes):
pid 26828 (rustc), jid 0, uid 0: exited on signal 11 (core dumped)

Compilation with GCC works fine, so switch to GCC for the time being.

PR:		244813
Approved by:	mikael
This commit is contained in:
Piotr Kubaj 2020-03-17 19:25:19 +00:00
parent 8b63b85e19
commit 9f2b11f787
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=528599
3 changed files with 32 additions and 1 deletions

View file

@ -92,7 +92,7 @@ EXTRA_PATCHES+= ${PATCHDIR}/libgit2
EXTRA_PATCHES+= ${PATCHDIR}/${ARCH}${BOOTSTRAPS_SUFFIX}
.endif
.if ${ARCH} == powerpc64 && ${PPC_ABI} == ELFv1
.if ${ARCH} == powerpc64
# The bootstrap is hardcoded to use gcc9
# but we can build with a newer or older compiler as provided by USE_GCC=yes
BUILD_DEPENDS+= gcc9:lang/gcc9

View file

@ -0,0 +1,13 @@
--- src/bootstrap/native.rs.orig 2019-11-04 15:45:21 UTC
+++ src/bootstrap/native.rs
@@ -241,6 +241,10 @@ impl Step for Llvm {
}
}
+ if target == "powerpc64-unknown-freebsd" {
+ cfg.define("CMAKE_EXE_LINKER_FLAGS", "-Wl,-rpath=/usr/local/lib/%CC% -L/usr/local/lib/%CC%");
+ }
+
// http://llvm.org/docs/HowToCrossCompileLLVM.html
if target != builder.config.build && !emscripten {
builder.ensure(Llvm {

View file

@ -0,0 +1,18 @@
--- src/librustc_llvm/build.rs.orig 2019-12-16 15:38:05 UTC
+++ src/librustc_llvm/build.rs
@@ -273,7 +273,14 @@ fn main() {
};
// C++ runtime library
- if !target.contains("msvc") {
+ if target == "powerpc64-unknown-freebsd" {
+ if is_crossed {
+ println!("cargo:rustc-link-search=native=%WRKDIR%/usr/local/lib/%CC%");
+ } else {
+ println!("cargo:rustc-link-search=native=/usr/local/lib/%CC%");
+ }
+ println!("cargo:rustc-link-lib=static=stdc++");
+ } else if !target.contains("msvc") {
if let Some(s) = llvm_static_stdcpp {
assert!(!cxxflags.contains("stdlib=libc++"));
let path = PathBuf::from(s);