From 155735aa5180c23bddd6fed1f6e659f9a0aaa346 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 13 Mar 2016 22:20:51 -0700 Subject: [PATCH] rustbuild: Fix cross compiling to FreeBSD This commit fixes our support for cross compiling a compiler to run on FreeBSD. Over the weekend I managed to get a cross compiler from Linux to FreeBSD [1] which I hope to soon use to start producing FreeBSD nightly compilers. With the `make dist` support added in #32237 we should be able to produce standard rustc/rust-std packages for FreeBSD through a new slave with this cross compiler. Currently, however, we don't "Just Work" when cross compiling FreeBSD and a number of changes were required (part of this PR). They include: * A few build fixes were needed in LLVM. Our own branch has been rebased on the actual 3.8 release and I applied one extra commit [2] which contains two fixes: 1. The LLVM CMake build system passes the `-Wl,-z,defs` flag on many platforms, but *not* when `CMAKE_SYSTEM_NAME` is "FreeBSD". Unfortunately this doesn't take into account when we're cross compiling, and as predicted the build will fail if `-Wl,-z,defs` is passed (see [3] for more info). To fix this we test `TARGET_TRIPLE` instead of the `CMAKE_SYSTEM_NAME` which is what we're compiling for which fixes the problem. 2. The `PATH_MAX` constant is apparently defined in a different location than many other Unix systems, so a file which required this just needed some help to keep compiling. * Support for compiling compiler-rt with CMake has been added to rustbuild. It looks like it just emulates Linux in what it compiles as it didn't seem to naturally produce anything else... At least the architecture is right, so seems good for now at least! [1]: https://github.com/alexcrichton/port-of-rust/blob/master/prebuilt/freebsd/Dockerfile [2]: https://github.com/rust-lang/llvm/commit/be89e4b5 [3]: https://bugs.webkit.org/show_bug.cgi?id=138420 --- src/bootstrap/build/native.rs | 3 ++- src/llvm | 2 +- src/rustllvm/llvm-auto-clean-trigger | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/build/native.rs b/src/bootstrap/build/native.rs index a9d84b60fbf..52595d3638c 100644 --- a/src/bootstrap/build/native.rs +++ b/src/bootstrap/build/native.rs @@ -113,7 +113,8 @@ pub fn compiler_rt(build: &Build, target: &str) { let dst = build.compiler_rt_out(target); let arch = target.split('-').next().unwrap(); let mode = if build.config.rust_optimize {"Release"} else {"Debug"}; - let (dir, build_target, libname) = if target.contains("linux") { + let (dir, build_target, libname) = if target.contains("linux") || + target.contains("freebsd") { let os = if target.contains("android") {"-android"} else {""}; let arch = if arch.starts_with("arm") && target.contains("eabihf") { "armhf" diff --git a/src/llvm b/src/llvm index 69ef168544e..be89e4b532f 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 69ef168544e4f15b793dd35d272008fde9a6e835 +Subproject commit be89e4b532fba8544f629c257460b63fe26c680d diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger index bb34b6f38bf..c6b01def198 100644 --- a/src/rustllvm/llvm-auto-clean-trigger +++ b/src/rustllvm/llvm-auto-clean-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be forcibly cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2016-02-20 +2016-03-13