 +            .arg("-relocation-model=pic")
 +            .arg("-o").arg(dst.join("rust_try.o"))
 +            .arg(src.join("../rt/rust_try.ll"))
-+            .status().unwrap().success()
++            .status_or_panic().success()
 +    }
 +
 +    let mut cmd = Command::new(ctxt.cc());

+            .arg(format!("RANLIB={} s", ar))
+            .arg(format!("CPPFLAGS=-I {}", ctxt.src().join("../rt/").display()))
+            .arg("EXTRA_CFLAGS=-g1 -ffunction-sections -fdata-sections")
+            .status().unwrap().success()
+    }
+
+    assert! {
+        Command::new("make")
+            .arg("-C").arg(dst)
+            .arg(if dynamic { "build_lib_shared" } else { "build_lib_static" })
+            .status().unwrap().success()
+    }
+
+    if dynamic {

+use std::io::{Read, Write};
+use std::ops::{Range, RangeTo};
+use std::path::{Path, PathBuf};
+use std::process::{Command, ExitStatus};
+use std::{env, iter};
+
+trait StatusOrPanic {
+    fn status_or_panic(&mut self) -> ExitStatus;
+}
+
+impl StatusOrPanic for Command {
+    fn status_or_panic(&mut self) -> ExitStatus {
+        self.status().unwrap_or_else(|_| {
+            panic!("error: failed to execute {:?}", self)
+        })
+    }
+}
+
+fn main() {
+    let ref ctxt = Ctxt::new().unwrap();
