提交 15e34deb 编写于 作者: B Brian Anderson

Eliminate glue.o. Closes #990

上级 e1ba559c
......@@ -172,7 +172,6 @@ SREQ$(1) = stage$(1)/rustc$(X) \
stage$(1)/$$(CFG_RUNTIME) \
$$(call CFG_STDLIB_DEFAULT,stage$(1),stage$(1)) \
stage$(1)/$$(CFG_RUSTLLVM) \
stage$(1)/lib/glue.o \
stage$(1)/lib/main.o \
stage$(1)/lib/$$(CFG_RUNTIME) \
$$(MKFILES)
......@@ -181,7 +180,6 @@ SREQ$(1) = stage$(1)/rustc$(X) \
stage$(1)/$$(CFG_RUNTIME) \
$$(call CFG_STDLIB_DEFAULT,stage$(1),stage$(1)) \
stage$(1)/$$(CFG_RUSTLLVM) \
stage$(1)/lib/glue.o \
stage$(1)/lib/main.o \
stage$(1)/lib/$$(CFG_RUNTIME) \
stage$(1)/lib/$$(CFG_STDLIB) \
......
......@@ -13,22 +13,22 @@ clean:
$(Q)rm -f $(C_DEPFILES:%.d=%.d.tmp)
$(Q)rm -f $(CRATE_DEPFILES:%.d=%.d.tmp)
$(Q)rm -f $(GENERATED)
$(Q)rm -f stage0/rustc$(X) stage0/lib/glue* stage0/lib/main.o
$(Q)rm -f stage0/rustc$(X) stage0/lib/main.o
$(Q)rm -f stage0/lib/$(CFG_RUNTIME) stage0/lib/$(CFG_STDLIB)
$(Q)rm -f stage0/$(CFG_RUNTIME) stage0/$(CFG_STDLIB)
$(Q)rm -f stage0/lib/libstd.rlib
$(Q)rm -f stage0/$(CFG_RUSTLLVM) stage0/lib/intrinsics.bc
$(Q)rm -f stage1/rustc$(X) stage1/lib/glue* stage1/lib/main.o
$(Q)rm -f stage1/rustc$(X) stage1/lib/main.o
$(Q)rm -f stage1/lib/$(CFG_RUNTIME) stage1/lib/$(CFG_STDLIB)
$(Q)rm -f stage1/$(CFG_RUNTIME) stage1/$(CFG_STDLIB)
$(Q)rm -f stage1/$(CFG_RUSTLLVM) stage1/lib/intrinsics.bc
$(Q)rm -f stage1/lib/libstd.rlib
$(Q)rm -f stage2/rustc$(X) stage2/lib/glue* stage2/lib/main.o
$(Q)rm -f stage2/rustc$(X) stage2/lib/main.o
$(Q)rm -f stage2/lib/$(CFG_RUNTIME) stage2/lib/$(CFG_STDLIB)
$(Q)rm -f stage2/$(CFG_RUNTIME) stage2/$(CFG_STDLIB)
$(Q)rm -f stage2/$(CFG_RUSTLLVM) stage2/lib/intrinsics.bc
$(Q)rm -f stage2/lib/libstd.rlib
$(Q)rm -f stage3/rustc$(X) stage3/lib/glue* stage3/lib/main.o
$(Q)rm -f stage3/rustc$(X) stage3/lib/main.o
$(Q)rm -f stage3/lib/$(CFG_RUNTIME) stage3/lib/$(CFG_STDLIB)
$(Q)rm -f stage3/$(CFG_RUNTIME) stage3/$(CFG_STDLIB)
$(Q)rm -f stage3/$(CFG_RUSTLLVM) stage3/lib/intrinsics.bc
......
snap-stage1: stage1/rustc$(X) stage1/lib/glue.o stage1/lib/$(CFG_RUNTIME) \
snap-stage1: stage1/rustc$(X) stage1/lib/$(CFG_RUNTIME) \
stage1/$(CFG_RUSTLLVM) stage1/lib/main.o
$(S)src/etc/make-snapshot.py stage1
snap-stage2: stage2/rustc$(X) stage2/lib/glue.o stage2/lib/$(CFG_STDLIB) \
snap-stage2: stage2/rustc$(X) stage2/lib/$(CFG_STDLIB) \
stage2/lib/libstd.rlib stage2/lib/$(CFG_RUNTIME) \
stage2/$(CFG_RUSTLLVM) stage2/lib/main.o
$(S)src/etc/make-snapshot.py stage2
snap-stage3: stage3/rustc$(X) stage3/lib/glue.o stage3/lib/$(CFG_STDLIB) \
snap-stage3: stage3/rustc$(X) stage3/lib/$(CFG_STDLIB) \
stage3/lib/libstd.rlib stage3/lib/$(CFG_RUNTIME) \
stage3/$(CFG_RUSTLLVM) stage3/lib/main.o
$(S)src/etc/make-snapshot.py stage3
......
......@@ -63,14 +63,6 @@ stage$(2)/lib/intrinsics.bc: $$(INTRINSICS_BC)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
stage$(2)/lib/glue.o: stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, generate: $$@)
$$(STAGE$(2)) -c -o $$@ --glue
stage$(2)/lib/main.o: rt/main.o
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
......@@ -84,7 +76,7 @@ stage$(2)/lib/$$(CFG_STDLIB): $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/glue.o \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib -o $$@ $$<
......@@ -93,7 +85,7 @@ stage$(2)/lib/libstd.rlib: $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/glue.o \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib --static -o $$@ $$<
......@@ -111,15 +103,6 @@ stage$(2)/lib/rustc/$(3)/intrinsics.bc: $$(INTRINSICS_BC)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
stage$(2)/lib/rustc/$(3)/glue.o: \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, generate: $$@)
$$(STAGE$(2)) -c -o $$@ --glue
stage$(2)/lib/rustc/$(3)/main.o: rt/main.o
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
......@@ -135,7 +118,7 @@ stage$(2)/lib/rustc/$(3)/$$(CFG_STDLIB): \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/rustc/$(3)/glue.o \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib -o $$@ $$<
......@@ -145,7 +128,7 @@ stage$(2)/lib/rustc/$(3)/libstd.rlib: \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
stage$(2)/$$(CFG_RUSTLLVM) \
stage$(2)/lib/rustc/$(3)/glue.o \
stage$(2)/lib/intrinsics.bc \
$$(SREQ$(1))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib --static -o $$@ $$<
......
......@@ -497,14 +497,13 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
fn link_binary(sess: session::session,
binary_dir: str,
saved_out_filename: str) {
let glu: str = binary_dir + "/lib/glue.o";
let main: str = binary_dir + "/lib/main.o";
let stage: str = "-L" + binary_dir + "/lib";
let prog: str = "gcc";
// The invocations of gcc share some flags across platforms
let gcc_args =
[stage, "-Lrt", "-lrustrt", glu, "-m32", "-o", saved_out_filename,
[stage, "-Lrt", "-lrustrt", "-m32", "-o", saved_out_filename,
saved_out_filename + ".o"];
let lib_cmd;
......
......@@ -238,7 +238,6 @@ fn usage(argv0: str) {
-v --version print version info and exit
-o <filename> write output to <filename>
--glue generate glue.bc file
--lib compile a library crate
--static use or produce static libraries
--pretty [type] pretty-print the input instead of compiling
......@@ -424,7 +423,7 @@ fn parse_pretty(sess: session::session, name: str) -> pp_mode {
fn opts() -> [getopts::opt] {
ret [optflag("h"), optflag("help"), optflag("v"), optflag("version"),
optflag("glue"), optflag("emit-llvm"), optflagopt("pretty"),
optflag("emit-llvm"), optflagopt("pretty"),
optflag("ls"), optflag("parse-only"), optflag("no-trans"),
optflag("O"), optopt("OptLevel"), optmulti("L"), optflag("S"),
optflag("c"), optopt("o"), optflag("g"), optflag("save-temps"),
......@@ -458,15 +457,6 @@ fn main(args: [str]) {
let sess = build_session(sopts);
let n_inputs = vec::len::<str>(match.free);
let output_file = getopts::opt_maybe_str(match, "o");
let glue = opt_present(match, "glue");
if glue {
if n_inputs > 0u {
sess.fatal("No input files allowed with --glue.");
}
let out = option::from_maybe::<str>("glue.bc", output_file);
middle::trans::make_common_glue(sess, out);
ret;
}
if n_inputs == 0u {
sess.fatal("No input filename given.");
} else if n_inputs > 1u {
......
......@@ -6044,35 +6044,6 @@ fn decl_no_op_type_glue(llmod: ModuleRef, taskptr_type: TypeRef) -> ValueRef {
ret decl_cdecl_fn(llmod, abi::no_op_type_glue_name(), ty);
}
fn make_glues(llmod: ModuleRef, taskptr_type: TypeRef) -> @glue_fns {
ret @{no_op_type_glue: decl_no_op_type_glue(llmod, taskptr_type)};
}
fn make_common_glue(sess: session::session, output: str) {
// FIXME: part of this is repetitive and is probably a good idea
// to autogen it.
let task_type = T_task();
let taskptr_type = T_ptr(task_type);
let llmod = str::as_buf("rust_out", {|buf|
llvm::LLVMModuleCreateWithNameInContext
(buf, llvm::LLVMGetGlobalContext())
});
let _: () =
str::as_buf(x86::get_data_layout(),
{|buf| llvm::LLVMSetDataLayout(llmod, buf) });
let _: () =
str::as_buf(x86::get_target_triple(),
{|buf| llvm::LLVMSetTarget(llmod, buf) });
mk_target_data(x86::get_data_layout());
declare_intrinsics(llmod);
let _: () =
str::as_buf(x86::get_module_asm(),
{|buf| llvm::LLVMSetModuleInlineAsm(llmod, buf) });
make_glues(llmod, taskptr_type);
link::write::run_passes(sess, llmod, output);
}
fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
let elttype = T_struct([T_int(), T_int()]);
let maptype = T_array(elttype, ccx.module_data.size() + 1u);
......@@ -6183,7 +6154,6 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
tn.associate("taskptr", taskptr_type);
let tydesc_type = T_tydesc(taskptr_type);
tn.associate("tydesc", tydesc_type);
let glues = make_glues(llmod, taskptr_type);
let hasher = ty::hash_ty;
let eqer = ty::eq_ty;
let tag_sizes = map::mk_hashmap::<ty::t, uint>(hasher, eqer);
......@@ -6212,7 +6182,6 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
tydescs: tydescs,
module_data: new_str_hash::<ValueRef>(),
lltypes: lltypes,
glues: glues,
names: namegen(0),
sha: sha,
type_sha1s: sha1s,
......
......@@ -41,8 +41,6 @@
type derived_tydesc_info = {lltydesc: ValueRef, escapes: bool};
type glue_fns = {no_op_type_glue: ValueRef};
tag tydesc_kind {
tk_static; // Static (monomorphic) type descriptor.
tk_param; // Type parameter.
......@@ -111,7 +109,6 @@
tydescs: hashmap<ty::t, @tydesc_info>,
module_data: hashmap<str, ValueRef>,
lltypes: hashmap<ty::t, TypeRef>,
glues: @glue_fns,
names: namegen,
sha: std::sha1::sha1,
type_sha1s: hashmap<ty::t, str>,
......
......@@ -9,7 +9,7 @@ def unpack_snapshot(snap):
print("opening snapshot " + dl_path)
tar = tarfile.open(dl_path)
kernel = get_kernel()
for name in snapshot_files[kernel]:
for name in old_snapshot_files[kernel]:
p = "rust-stage0/" + name
fp = os.path.join("stage0", name)
print("extracting " + fp)
......
......@@ -15,7 +15,8 @@ download_url_base = "http://dl.rust-lang.org/stage0-snapshots"
download_dir_base = "dl"
download_unpack_base = os.path.join(download_dir_base, "unpack")
snapshot_files = {
# FIXME: Transitional
old_snapshot_files = {
"linux": ["rustc", "lib/glue.o", "lib/libstd.so", "lib/main.o",
"librustrt.so", "librustllvm.so", "lib/intrinsics.bc"],
"macos": ["rustc", "lib/glue.o", "lib/libstd.dylib", "lib/main.o",
......@@ -24,6 +25,15 @@ snapshot_files = {
"rustrt.dll", "rustllvm.dll", "lib/intrinsics.bc"]
}
snapshot_files = {
"linux": ["rustc", "lib/libstd.so", "lib/main.o",
"librustrt.so", "librustllvm.so", "lib/intrinsics.bc"],
"macos": ["rustc", "lib/libstd.dylib", "lib/main.o",
"librustrt.dylib", "librustllvm.dylib", "lib/intrinsics.bc"],
"winnt": ["rustc.exe", "lib/std.dll", "lib/main.o",
"rustrt.dll", "rustllvm.dll", "lib/intrinsics.bc"]
}
def parse_line(n, line):
global snapshotfile
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册