about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorZack Corr <zack@z0w0.me>2012-08-30 12:24:43 +1000
committerBrian Anderson <banderson@mozilla.com>2012-08-31 16:20:36 -0700
commit638db28c472c1edadc3c37f900df28f14cca7665 (patch)
tree25b13f38ff3eec2d63eb41defef2ffe016d990e2 /src/rustc
parentefb576a60dbd12cdd9c732cb5d8b202283b9864a (diff)
jit: Correct formatting and argv[0] for JITted programs
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/back/link.rs9
-rw-r--r--src/rustc/driver/driver.rs10
-rw-r--r--src/rustc/driver/rustc.rs2
-rw-r--r--src/rustc/driver/session.rs2
4 files changed, 13 insertions, 10 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs
index 9632da761cb..695bdcbc5ea 100644
--- a/src/rustc/back/link.rs
+++ b/src/rustc/back/link.rs
@@ -85,22 +85,19 @@ mod jit {
             m: ModuleRef,
             opt: c_int,
             stacks: bool) unsafe {
-        let ptr = llvm::LLVMRustJIT(rusti::morestack_addr(), pm, m, opt, stacks);
+        let ptr = llvm::LLVMRustJIT(rusti::morestack_addr(),
+                                    pm, m, opt, stacks);
 
         if ptr::is_null(ptr) {
             llvm_err(sess, ~"Could not JIT");
         } else {
-            let bin = match os::self_exe_path() {
-                Some(path) => path.to_str(),
-                _ => ~"rustc"
-            };
             let closure = Closure {
                 code: ptr,
                 env: ptr::null()
             };
             let func: fn(~[~str]) = unsafe::transmute(closure);
 
-            func(~[bin]);
+            func(~[sess.opts.binary]);
         }
     }
 }
diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs
index 2d5b36debaa..a1864357d60 100644
--- a/src/rustc/driver/driver.rs
+++ b/src/rustc/driver/driver.rs
@@ -428,7 +428,8 @@ fn host_triple() -> ~str {
         };
 }
 
-fn build_session_options(matches: getopts::Matches,
+fn build_session_options(binary: ~str,
+                         matches: getopts::Matches,
                          demitter: diagnostic::emitter) -> @session::options {
     let crate_type = if opt_present(matches, ~"lib") {
         session::lib_crate
@@ -553,6 +554,7 @@ fn build_session_options(matches: getopts::Matches,
           maybe_sysroot: sysroot_opt,
           target_triple: target,
           cfg: cfg,
+          binary: binary,
           test: test,
           parse_only: parse_only,
           no_trans: no_trans,
@@ -736,7 +738,8 @@ mod test {
               Err(f) => fail ~"test_switch_implies_cfg_test: " +
                              getopts::fail_str(f)
             };
-        let sessopts = build_session_options(matches, diagnostic::emit);
+        let sessopts = build_session_options(
+            ~"rustc", matches, diagnostic::emit);
         let sess = build_session(sessopts, diagnostic::emit);
         let cfg = build_configuration(sess, ~"whatever", str_input(~""));
         assert (attr::contains_name(cfg, ~"test"));
@@ -754,7 +757,8 @@ mod test {
                     getopts::fail_str(f);
               }
             };
-        let sessopts = build_session_options(matches, diagnostic::emit);
+        let sessopts = build_session_options(
+            ~"rustc", matches, diagnostic::emit);
         let sess = build_session(sessopts, diagnostic::emit);
         let cfg = build_configuration(sess, ~"whatever", str_input(~""));
         let test_items = attr::find_meta_items_by_name(cfg, ~"test");
diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs
index 42982550325..2289a51e7c4 100644
--- a/src/rustc/driver/rustc.rs
+++ b/src/rustc/driver/rustc.rs
@@ -166,7 +166,7 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
       _ => early_error(demitter, ~"multiple input filenames provided")
     };
 
-    let sopts = build_session_options(matches, demitter);
+    let sopts = build_session_options(binary, matches, demitter);
     let sess = build_session(sopts, demitter);
     let odir = getopts::opt_maybe_str(matches, ~"out-dir");
     let odir = option::map(odir, |o| Path(o));
diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs
index 47aa3019de1..a1785355af8 100644
--- a/src/rustc/driver/session.rs
+++ b/src/rustc/driver/session.rs
@@ -114,6 +114,7 @@ type options =
      maybe_sysroot: Option<Path>,
      target_triple: ~str,
      cfg: ast::crate_cfg,
+     binary: ~str,
      test: bool,
      parse_only: bool,
      no_trans: bool,
@@ -256,6 +257,7 @@ fn basic_options() -> @options {
         maybe_sysroot: None,
         target_triple: driver::host_triple(),
         cfg: ~[],
+        binary: ~"rustc",
         test: false,
         parse_only: false,
         no_trans: false,