Skip to content
Snippets Groups Projects
Commit f0ee4a85 authored by Piotr Kubaj's avatar Piotr Kubaj
Browse files

lang/rust: fix build on armv7 the same way as for powerpc

parent 9fd80384
No related branches found
No related tags found
No related merge requests found
......@@ -111,12 +111,15 @@ IGNORE= is only for FreeBSD
.if ${ARCH} == powerpc
# bfd to link rustc_driver; lld currently can't
BUILD_DEPENDS+= ld.bfd:devel/binutils
LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT}
MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}"
.else
MAKE_ENV+= RUST_BACKTRACE=1
.endif
.if ${ARCH} == armv7 || ${ARCH} == powerpc
LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT}
MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}"
.endif
# rls doesn't build on rust nightly
# rls needs 64-bit atomics: it doesn't build on powerpc
.if !defined(NIGHTLY_DATE) && ${ARCH} != powerpc
......
From cbeec86a5594ef6ca36d0ea24b4cb7e3dbaded87 Mon Sep 17 00:00:00 2001
From: pkubaj <pkubaj@FreeBSD.org>
Date: Fri, 18 Nov 2022 12:36:49 +0000
Subject: [PATCH] Fix build on powerpc-unknown-freebsd
Probably also fixes build on arm and mips*. Related to https://github.com/rust-lang/rust/issues/104220
---
compiler/rustc_llvm/build.rs | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index d35e4191cc0b1..afdf9ac8883e9 100644
--- compiler/rustc_llvm/build.rs
+++ compiler/rustc_llvm/build.rs
@@ -237,18 +237,21 @@ fn main() {
if !is_crossed {
cmd.arg("--system-libs");
- } else if target.contains("windows-gnu") {
- println!("cargo:rustc-link-lib=shell32");
- println!("cargo:rustc-link-lib=uuid");
- } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
- println!("cargo:rustc-link-lib=z");
- } else if target.starts_with("arm")
+ }
+
+ if target.starts_with("arm")
|| target.starts_with("mips-")
|| target.starts_with("mipsel-")
|| target.starts_with("powerpc-")
{
// 32-bit targets need to link libatomic.
println!("cargo:rustc-link-lib=atomic");
+ println!("cargo:rustc-link-lib=z");
+ } else if target.contains("windows-gnu") {
+ println!("cargo:rustc-link-lib=shell32");
+ println!("cargo:rustc-link-lib=uuid");
+ } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
+ println!("cargo:rustc-link-lib=z");
}
cmd.args(&components);
--- compiler/rustc_llvm/build.rs.orig 2022-11-15 08:26:08.366900000 +0100
+++ compiler/rustc_llvm/build.rs 2022-11-15 08:29:07.101616000 +0100
@@ -235,20 +235,18 @@ fn main() {
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");
- if !is_crossed {
+ if target.starts_with("arm")
+ || target.starts_with("powerpc-")
+ {
+ println!("cargo:rustc-link-lib=atomic");
+ println!("cargo:rustc-link-lib=z");
+ } else if !is_crossed {
cmd.arg("--system-libs");
} else if target.contains("windows-gnu") {
println!("cargo:rustc-link-lib=shell32");
println!("cargo:rustc-link-lib=uuid");
} else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
println!("cargo:rustc-link-lib=z");
- } else if target.starts_with("arm")
- || target.starts_with("mips-")
- || target.starts_with("mipsel-")
- || target.starts_with("powerpc-")
- {
- // 32-bit targets need to link libatomic.
- println!("cargo:rustc-link-lib=atomic");
}
cmd.args(&components);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment