Move the glue asm code to a .o file. This reduces how much asm we print
in each "translation unit".
This commit is contained in:
parent
35bee753de
commit
55c80e763b
23
src/Makefile
23
src/Makefile
@ -90,6 +90,7 @@ ifdef CFG_WINDOWSY
|
||||
CFG_EXE_SUFFIX := .exe
|
||||
CFG_BOOT := ./rustboot.exe
|
||||
CFG_RUSTC := ./rustc.exe
|
||||
CFG_GLUE := ./glue.exe
|
||||
CFG_GCC_CFLAGS += -march=i686
|
||||
CFG_GCC_LINK_FLAGS += -shared -fPIC
|
||||
CFG_RUN_TARG = $(1)
|
||||
@ -101,6 +102,7 @@ ifdef CFG_UNIXY
|
||||
CFG_INFO := $(info cfg: unix-y environment)
|
||||
CFG_BOOT := ./rustboot
|
||||
CFG_RUSTC := ./rustc
|
||||
CFG_GLUE := ./glue
|
||||
CFG_OBJ_SUFFIX := .o
|
||||
CFG_RUN_TARG = LD_LIBRARY_PATH=. $(CFG_VALGRIND) $(1)
|
||||
CFG_GCC := 1
|
||||
@ -111,6 +113,7 @@ ifdef CFG_UNIXY
|
||||
CFG_RUNTIME := rustrt.dll
|
||||
CFG_STDLIB := std.dll
|
||||
CFG_RUSTC := ./rustc.exe
|
||||
CFG_GLUE := ./glue
|
||||
ifdef CFG_VALGRIND
|
||||
CFG_VALGRIND += wine
|
||||
endif
|
||||
@ -308,11 +311,13 @@ RUNTIME_LIBS := $(CFG_RUNTIME_LIBS)
|
||||
STDLIB_CRATE := lib/std.rc
|
||||
STDLIB_INPUTS := $(wildcard lib/*.rc lib/*.rs lib/*/*.rs)
|
||||
COMPILER_CRATE := comp/rustc.rc
|
||||
COMPILER_INPUTS := $(wildcard comp/*.rc comp/*.rs comp/*/*.rs)
|
||||
COMPILER_INPUTS := $(wildcard comp/rustc.rc comp/*.rs comp/*/*.rs)
|
||||
GLUE_CRATE := comp/glue.rc
|
||||
GLUE_INPUTS := $(wildcard comp/glue.rc comp/*.rs comp/*/*.rs)
|
||||
|
||||
GENERATED := boot/fe/lexer.ml boot/util/version.ml
|
||||
|
||||
all: $(CFG_RUSTC) $(MKFILES) $(GENERATED)
|
||||
all: $(CFG_RUSTC) $(CFG_GLUE) $(MKFILES) $(GENERATED) glue.o
|
||||
|
||||
boot/util/version.ml: Makefile
|
||||
$(CFG_QUIET)git log -1 \
|
||||
@ -368,6 +373,16 @@ $(CFG_RUSTC): $(COMPILER_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
|
||||
$(BOOT) -minimal -o $@ $<
|
||||
$(CFG_QUIET)chmod 0755 $@
|
||||
|
||||
$(CFG_GLUE): $(GLUE_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
|
||||
@$(call CFG_ECHO, compile: $<)
|
||||
$(BOOT) -minimal -o $@ $<
|
||||
$(CFG_QUIET)chmod 0755 $@
|
||||
|
||||
glue.o: glue.s
|
||||
|
||||
glue.s: $(CFG_GLUE)
|
||||
$(CFG_GLUE) > $@
|
||||
|
||||
self: $(CFG_RUSTC)
|
||||
@$(call CFG_ECHO, compile: $<)
|
||||
$(RUSTC) $(COMPILER_CRATE)
|
||||
@ -763,9 +778,9 @@ test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
|
||||
@$(call CFG_ECHO, assemble [llvm]: $<)
|
||||
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
|
||||
|
||||
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME)
|
||||
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME) glue.o
|
||||
@$(call CFG_ECHO, link [llvm]: $<)
|
||||
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ $< -L. -lrustrt
|
||||
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) glue.o -o $@ $< -L. -lrustrt
|
||||
@# dsymutil sometimes fails or prints a warning, but the
|
||||
@# program still runs. Since it simplifies debugging other
|
||||
@# programs, I\'ll live with the noise.
|
||||
|
37
src/comp/glue.rc
Normal file
37
src/comp/glue.rc
Normal file
@ -0,0 +1,37 @@
|
||||
// -*- rust -*-
|
||||
|
||||
use std;
|
||||
|
||||
mod front {
|
||||
mod ast;
|
||||
}
|
||||
|
||||
mod middle {
|
||||
mod ty;
|
||||
}
|
||||
|
||||
mod driver {
|
||||
mod session;
|
||||
}
|
||||
|
||||
mod glue {
|
||||
mod glue;
|
||||
}
|
||||
|
||||
mod back {
|
||||
mod abi;
|
||||
mod x86;
|
||||
}
|
||||
|
||||
mod util {
|
||||
mod common;
|
||||
}
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// fill-column: 78;
|
||||
// indent-tabs-mode: nil
|
||||
// c-basic-offset: 4
|
||||
// buffer-file-coding-system: utf-8-unix
|
||||
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
||||
// End:
|
11
src/comp/glue/glue.rs
Normal file
11
src/comp/glue/glue.rs
Normal file
@ -0,0 +1,11 @@
|
||||
import back.x86;
|
||||
import std._str;
|
||||
import std._vec;
|
||||
import std.os.libc;
|
||||
|
||||
fn main(vec[str] args) {
|
||||
auto module_asm = x86.get_module_asm() + "\n";
|
||||
auto bytes = _str.bytes(module_asm);
|
||||
auto b = _vec.buf[u8](bytes);
|
||||
libc.write(1, b, _vec.len[u8](bytes));
|
||||
}
|
@ -5708,8 +5708,6 @@ fn trans_crate(session.session sess, @ast.crate crate, str output,
|
||||
let ValueRef crate_ptr =
|
||||
llvm.LLVMAddGlobal(llmod, T_crate(tn), _str.buf("rust_crate"));
|
||||
|
||||
llvm.LLVMSetModuleInlineAsm(llmod, _str.buf(x86.get_module_asm()));
|
||||
|
||||
auto intrinsics = declare_intrinsics(llmod);
|
||||
|
||||
auto glues = make_glues(llmod, tn);
|
||||
|
Loading…
x
Reference in New Issue
Block a user