Use snap runtime, and the old main.o, for stage1

This is intended to be reverted again after I register the next
snapshot.
This commit is contained in:
Marijn Haverbeke 2011-10-20 10:55:53 +02:00
parent 880b1ec9f5
commit 243c5c3479
3 changed files with 63 additions and 4 deletions

View File

@ -106,10 +106,16 @@ ifdef CFG_WINDOWSY
rt/main.ll: rt/main.ll.in
@$(call E, sed: $@)
$(Q)sed 's/MAIN/WinMain@16/' < $^ > $@
rt/main0.ll: rt/main0.ll.in
@$(call E, sed: $@)
$(Q)sed 's/MAIN/WinMain@16/' < $^ > $@
else
rt/main.ll: rt/main.ll.in
@$(call E, sed: $@)
$(Q)sed 's/MAIN/main/' < $^ > $@
rt/main0.ll: rt/main0.ll.in
@$(call E, sed: $@)
$(Q)sed 's/MAIN/main/' < $^ > $@
endif
rt/%.o: rt/%.ll $(MKFILES)

View File

@ -11,10 +11,6 @@ $$(TARGET_LIB$(1)$(2))/intrinsics.bc: $$(INTRINSICS_BC)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_LIB$(1)$(2))/main.o: rt/main.o
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_LIB$(1)$(2))/$$(CFG_STDLIB): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TARGET_SREQ$(1)$(2))
@ -27,9 +23,23 @@ $$(TARGET_LIB$(1)$(2))/libstd.rlib: \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) --lib --static -o $$@ $$<
ifeq ($(1), 0)
$$(TARGET_LIB$(1)$(2))/main.o: rt/main0.o
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): stage0/lib/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
else
$$(TARGET_LIB$(1)$(2))/main.o: rt/main.o
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): rt/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endif
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM): rustllvm/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)

43
src/rt/main0.ll.in Normal file
View File

@ -0,0 +1,43 @@
%0 = type { i32, [1 x i32] }
%1 = type { i32, i32 }
%2 = type { i32, %3 }
%3 = type { %tydesc*, %4, i1, {} }
%4 = type { i1*, i1* }
%5 = type { i32, i32, i32, i32, [0 x %6*] }
%6 = type { i32, i32, i32, i32, [0 x i8] }
%tydesc = type { %tydesc**, i32, i32, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*)*, void (i1*, %task*, i1*, %tydesc**, i8*, i8*, i8)* }
%task = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%vec = type { i32, i32, [0 x i8] }
@_rust_crate_map_toplevel = external global %0
declare i32 @rust_start(i32, i32, i32, i32)
declare external fastcc void @_rust_main(i1* nocapture, %task*, %2* nocapture, %vec*)
define void @_rust_main_wrap(i1* nocapture, %task *, %2* nocapture, %vec *)
{
tail call fastcc void @_rust_main(i1* %0, %task *%1, %2* nocapture %2, %vec* %3)
ret void
}
%nullary_fn = type void (i1*, %task*, %2*)
define void @_rust_spawn_wrap(
i1* nocapture, %task*, %2* nocapture, %nullary_fn* %f)
{
call void %f(i1* %0, %task *%1, %2* nocapture %2)
ret void
}
declare external void @set_spawn_wrapper(void (i1*, %task*, %2*, %nullary_fn*)*);
define i32 @"MAIN"(i32, i32) {
call void @set_spawn_wrapper(void (i1*, %task*, %2*, %nullary_fn*)* @_rust_spawn_wrap)
%result = tail call i32 @rust_start(i32 ptrtoint (void (i1*, %task*, %2*, %vec*)* @_rust_main_wrap to i32), i32 %0, i32 %1, i32 ptrtoint (%0* @_rust_crate_map_toplevel to i32))
ret i32 %result
}