Skip to content

Commit

Permalink
Auto merge of #40123 - TimNN:llvm40, r=<try>
Browse files Browse the repository at this point in the history
[WIP] LLVM 4.0 Upgrade

Since nobody has done this yet, I decided to get things started:

**Todo:**

* [ ] push the relevant commits to `rust-lang/llvm` and `rust-lang/compiler-rt`
* [ ] cleanup `.gitmodules`
* [ ] Verify if there are any other commits from `rust-lang/llvm` which need backporting
* [x] Investigate / fix debuginfo ("`<optimized out>`") failures
* [x] Use correct emscripten version in docker image

---

Closes #37609.

---

**Test results:**

* `FAIL`: `IMAGE=armhf-gnu` [travis](https://travis-ci.org/rust-lang/rust/jobs/205860539) (looks to be qemu related, or rather the client / server tools)
* `FAIL`: `IMAGE=emscripten` [travis](https://travis-ci.org/rust-lang/rust/jobs/205978867) (with an updated emcc: one bad emcc optimization: emscripten-core/emscripten-fastcomp#176) ~~[travis](https://travis-ci.org/rust-lang/rust/jobs/205860559) (mainly (only?) due to emcc / rust llvm version mismatch)~~
* `FAIL`: `IMAGE=dist-powerpc64-linux` [travis](https://travis-ci.org/rust-lang/rust/jobs/206514546) (llvm unreachable when compiling core: `Invalid PPC CTR loop!
UNREACHABLE executed at .../PPCCTRLoops.cpp:722!`, reported as [upstream bug #32485](https://bugs.llvm.org//show_bug.cgi?id=32485))
* `SUCCESS/TIMEOUT`: `IMAGE=dist-arm-linux` [travis](https://travis-ci.org/rust-lang/rust/jobs/206514540) (passes locally)
* `SUCCESS/TIMEOUT`: `IMAGE=dist-armv7-aarch64-linux` [travis](https://travis-ci.org/rust-lang/rust/jobs/206514541) (passes locally)
* `SUCCESS`: `IMAGE=arm-android` (fixed)
* `SUCCESS`: `IMAGE=cross`
* `SUCCESS`: `IMAGE=linux-tested-targets`
* `SUCCESS`: `IMAGE=dist-android`
* `SUCCESS`: `IMAGE=dist-freebsd` (fixed)
* `SUCCESS`: `IMAGE=dist-fuchsia`
* `SUCCESS`: `IMAGE=dist-mips-linux`
* `SUCCESS`: `IMAGE=dist-mips64-linux`
* `SUCCESS`: `IMAGE=dist-powerpc-linux`
* `SUCCESS`: `IMAGE=dist-s390x-linux-netbsd` (fixed)
* `SUCCESS`: `IMAGE=dist-x86-linux` (fixed)
* `SUCCESS`: `IMAGE=i686-gnu`
* `SUCCESS`: `IMAGE=i686-gnu-nopt`
* `SUCCESS`: `IMAGE=x86_64-gnu-llvm-3.7`
* `SUCCESS`: `IMAGE=x86_64-gnu`
* `SUCCESS`: `IMAGE=x86_64-gnu-aux`
* `SUCCESS`: `IMAGE=x86_64-gnu-debug`
* `SUCCESS`: `IMAGE=x86_64-gnu-nopt`
* `SUCCESS`: `IMAGE=x86_64-gnu-full-bootstrap`
* `SUCCESS`: `IMAGE=x86_64-gnu-distcheck`
* `SUCCESS`: `IMAGE=x86_64-gnu-incremental`
  • Loading branch information
bors committed Apr 8, 2017
2 parents a610117 + 17e01d3 commit 1781be5
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[submodule "src/llvm"]
path = src/llvm
url = https://github.com/rust-lang/llvm.git
url = https://github.com/TimNN/llvm.git
branch = master
[submodule "src/compiler-rt"]
path = src/compiler-rt
url = https://github.com/rust-lang/compiler-rt.git
url = https://github.com/llvm-mirror/compiler-rt.git
[submodule "src/jemalloc"]
path = src/jemalloc
url = https://github.com/rust-lang/jemalloc.git
Expand Down
6 changes: 3 additions & 3 deletions src/ci/docker/emscripten/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ WORKDIR /tmp
COPY build-emscripten.sh /tmp/
RUN ./build-emscripten.sh
ENV PATH=$PATH:/tmp/emsdk_portable
ENV PATH=$PATH:/tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin
ENV PATH=$PATH:/tmp/emsdk_portable/clang/fastcomp/build_incoming_32/bin
ENV PATH=$PATH:/tmp/emsdk_portable/node/4.1.1_32bit/bin
ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/tag-1.37.1
ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/tag-1.37.1
ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/incoming
ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/incoming

ENV RUST_CONFIGURE_ARGS --target=asmjs-unknown-emscripten

Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/emscripten/build-emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ chmod 755 emsdk_portable

source emsdk_portable/emsdk_env.sh
hide_output emsdk update
hide_output emsdk install --build=Release sdk-tag-1.37.1-32bit
hide_output emsdk activate --build=Release sdk-tag-1.37.1-32bit
hide_output emsdk install --build=Release --enable-assertions sdk-incoming-32bit
hide_output emsdk activate --build=Release sdk-incoming-32bit
9 changes: 5 additions & 4 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ docker_dir="`dirname $script`"
ci_dir="`dirname $docker_dir`"
src_dir="`dirname $ci_dir`"
root_dir="`dirname $src_dir`"
tag=rust-ci-$image

source "$ci_dir/shared.sh"

retry docker \
docker \
build \
--rm \
-t rust-ci \
-t $tag \
"`dirname "$script"`/$image"

objdir=$root_dir/obj
objdir=$root_dir/obj/$image

mkdir -p $HOME/.cargo
mkdir -p $objdir/tmp
Expand Down Expand Up @@ -60,5 +61,5 @@ exec docker \
--volume "$HOME/rustsrc:$HOME/rustsrc" \
--privileged \
--rm \
rust-ci \
$tag \
/checkout/src/ci/run.sh
8 changes: 7 additions & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.

set -e
set -eE

function err(){
sleep infinity
}

trap "err" ERR

if [ "$NO_CHANGE_USER" = "" ]; then
if [ "$LOCAL_USER_ID" != "" ]; then
Expand Down
2 changes: 1 addition & 1 deletion src/compiler-rt
Submodule compiler-rt updated 680 files
6 changes: 6 additions & 0 deletions src/libcompiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ fn main() {
}

if target.contains("arm") && !target.contains("ios") {
// (At least) udivsi3.S is broken for Thumb 1 which our gcc uses by
// default, we don't want Thumb 2 since it isn't supported on some
// devices, so disable thumb entirely.
// Upstream bug: https://bugs.llvm.org/show_bug.cgi?id=32492
cfg.define("__ARM_ARCH_ISA_THUMB", Some("0"));

sources.extend(&["arm/aeabi_cdcmp.S",
"arm/aeabi_cdcmpeq_check_nan.c",
"arm/aeabi_cfcmp.S",
Expand Down
2 changes: 1 addition & 1 deletion src/llvm
Submodule llvm updated 8731 files
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ fn main() {
exit_success_if_unwind::bar(do_panic);
}
}
let s = Command::new(env::args_os().next().unwrap()).arg("foo").status();

let mut cmd = Command::new(env::args_os().next().unwrap());
cmd.arg("foo");


// ARMv6 hanges while printing the backtrace, see #41004
if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") {
cmd.env("RUST_BACKTRACE", "0");
}

let s = cmd.status();
assert!(s.unwrap().code() != Some(0));
}

Expand Down
11 changes: 10 additions & 1 deletion src/test/run-pass/panic-runtime/abort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ fn main() {
panic!("try to catch me");
}
}
let s = Command::new(env::args_os().next().unwrap()).arg("foo").status();

let mut cmd = Command::new(env::args_os().next().unwrap());
cmd.arg("foo");

// ARMv6 hanges while printing the backtrace, see #41004
if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") {
cmd.env("RUST_BACKTRACE", "0");
}

let s = cmd.status();
assert!(s.unwrap().code() != Some(0));
}
10 changes: 9 additions & 1 deletion src/tools/qemu-test-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ fn main() {
}

fn spawn_emulator(rootfs: &Path, tmpdir: &Path) {
use std::os::unix::io::{FromRawFd, IntoRawFd};
use std::fs::OpenOptions;

// Generate a new rootfs image now that we've updated the test server
// executable. This is the equivalent of:
//
Expand All @@ -71,6 +74,10 @@ fn spawn_emulator(rootfs: &Path, tmpdir: &Path) {
&mut t!(File::create(&rootfs_img))));
assert!(t!(child.wait()).success());

let log = OpenOptions::new().create(true).append(true).open("qemu.log").unwrap();
let qout = unsafe { Stdio::from_raw_fd(log.try_clone().unwrap().into_raw_fd()) };
let qerr = unsafe { Stdio::from_raw_fd(log.try_clone().unwrap().into_raw_fd()) };

// Start up the emulator, in the background
let mut cmd = Command::new("qemu-system-arm");
cmd.arg("-M").arg("vexpress-a15")
Expand All @@ -80,7 +87,8 @@ fn spawn_emulator(rootfs: &Path, tmpdir: &Path) {
.arg("-dtb").arg("/tmp/vexpress-v2p-ca15-tc1.dtb")
.arg("-append").arg("console=ttyAMA0 root=/dev/ram rdinit=/sbin/init init=/sbin/init")
.arg("-nographic")
.arg("-redir").arg("tcp:12345::12345");
.arg("-redir").arg("tcp:12345::12345")
.stdout(qout).stderr(qerr);
t!(cmd.spawn());

// Wait for the emulator to come online
Expand Down
28 changes: 28 additions & 0 deletions src/tools/qemu-test-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(libc)]

extern crate libc;

/// This is a small server which is intended to run inside of an emulator. This
/// server pairs with the `qemu-test-client` program in this repository. The
/// `qemu-test-client` connects to this server over a TCP socket and performs
Expand Down Expand Up @@ -41,7 +45,31 @@ macro_rules! t {

static TEST: AtomicUsize = ATOMIC_USIZE_INIT;

fn debug() {
::std::env::set_var("RUST_BACKTRACE", "1");

unsafe {
let pid = libc::fork();
if pid == 0 {
println!("@@ Child is running.");
return; // we are the child
}
assert!(pid > 0);

println!("@@ Watcher is running.");

let mut status: libc::c_int = 0;
libc::waitpid(pid, &mut status, 0);

println!("@@EXIT@@: {}", status);

::std::process::exit(0);
}
}

fn main() {
debug();

println!("starting test server");
let listener = t!(TcpListener::bind("10.0.2.15:12345"));
println!("listening!");
Expand Down

0 comments on commit 1781be5

Please sign in to comment.