From eb811a903fb1856203a8e2233efe50cd36d2e5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Mon, 13 Jun 2011 16:08:07 -0400 Subject: [PATCH] Enough driver support to link an empty program on linux. Will try to update the Makefiles to use it. --- src/comp/driver/rustc.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index a35a07d78fe..6b1a8d395ee 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -421,8 +421,20 @@ fn main(vec[str] args) { compile_input(sess, env, ifile, ofile); } case (some(?ofile)) { + // FIXME: what about windows? This will create a foo.exe.o. saved_out_filename = ofile; - compile_input(sess, env, ifile, ofile); + auto temp_filename; + alt (sopts.output_type) { + case (link::output_type_exe) { + // FIXME: what about shared? + temp_filename = ofile + ".o"; + } + case (_) { + temp_filename = ofile; + } + } + + compile_input(sess, env, ifile, temp_filename); } } @@ -431,11 +443,10 @@ fn main(vec[str] args) { // // TODO: Factor this out of main. if (sopts.output_type == link::output_type_exe) { - - //FIXME: Should we make the 'stage3's variable here? - let str glu = "stage3/glue.o"; + auto binary_dir = fs::dirname(binary); + let str glu = binary_dir + "/glue.o"; let str main = "rt/main.o"; - let str stage = "-Lstage3"; + let str stage = "-L" + binary_dir; let vec[str] gcc_args; let str prog = "gcc"; let str exe_suffix = "";