Skip to content

Commit 9cd734c

Browse files
committed
---
yaml --- r: 3124 b: refs/heads/master c: a77180f h: refs/heads/master v: v3
1 parent d60588a commit 9cd734c

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9b5ebe726c1f9dc83b11fb3b77dd24f201d7b777
2+
refs/heads/master: a77180f4f5ae5c61b0e80748b749a7fac71b7bf5

trunk/mk/stage3.mk

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
1+
stage3/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
22
stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
33
$(LREQ) $(MKFILES)
4-
@$(call E, compile: $@)
5-
$(STAGE2) -c --shared -o $@ $<
6-
7-
stage3/$(CFG_STDLIB): stage2/std.o stage2/glue.o
8-
@$(call E, link: $@)
9-
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o $(CFG_GCCISH_LINK_FLAGS) -o \
10-
$@ $< -Lstage2 -Lrt -lrustrt
4+
@$(call E, compile_and_link: $@)
5+
$(STAGE2) --shared -o $@ $<
116

127
stage3/librustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2)
138
@$(call E, compile: $@)

trunk/src/comp/driver/rustc.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -399,37 +399,34 @@ fn main(vec[str] args) {
399399
let str prog = "gcc";
400400
// The invocations of gcc share some flags across platforms
401401

402-
let vec[str] common_cflags =
403-
["-fno-strict-aliasing", "-fPIC", "-Wall", "-fno-rtti",
404-
"-fno-exceptions", "-g"];
405-
let vec[str] common_libs =
406-
[stage, "-Lrustllvm", "-Lrt", "-lrustrt", "-lrustllvm", "-lstd",
407-
"-lm"];
402+
let vec[str] common_args = [stage, "-Lrt", "-lrustrt",
403+
"-fno-strict-aliasing", "-fPIC", "-Wall",
404+
"-fno-rtti", "-fno-exceptions", "-g", glu, "-o",
405+
saved_out_filename, saved_out_filename + ".o"];
406+
407+
auto shared_cmd;
408+
408409
alt (sess.get_targ_cfg().os) {
409410
case (session::os_win32) {
410-
gcc_args =
411-
common_cflags +
412-
["-march=i686", "-O2", glu, main, "-o",
413-
saved_out_filename, saved_out_filename + ".o"] +
414-
common_libs;
411+
shared_cmd = "-shared";
412+
gcc_args = common_args + ["-march=i686", "-O2"];
415413
}
416414
case (session::os_macos) {
417-
gcc_args =
418-
common_cflags +
419-
["-arch i386", "-O0", "-m32", glu, main, "-o",
420-
saved_out_filename, saved_out_filename + ".o"] +
421-
common_libs;
415+
shared_cmd = "-dynamiclib";
416+
gcc_args = common_args + ["-arch i386", "-O0", "-m32"];
422417
}
423418
case (session::os_linux) {
424-
gcc_args =
425-
common_cflags +
426-
["-march=i686", "-O2", "-m32", glu, main, "-o",
427-
saved_out_filename, saved_out_filename + ".o"] +
428-
common_libs;
419+
shared_cmd = "-shared";
420+
gcc_args = common_args + ["-march=i686", "-O2", "-m32"];
429421
}
430422
}
431-
// We run 'gcc' here
423+
if (sopts.shared) {
424+
gcc_args += [shared_cmd];
425+
} else {
426+
gcc_args += ["-Lrustllvm", "-lrustllvm", "-lstd", "-lm", main];
427+
}
432428

429+
// We run 'gcc' here
433430
run::run_program(prog, gcc_args);
434431
// Clean up on Darwin
435432

0 commit comments

Comments
 (0)