Eliminate glue.o. Closes #990
This commit is contained in:
parent
e1ba559c03
commit
15e34deba3
10 changed files with 25 additions and 79 deletions
|
|
@ -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 @@ options:
|
|||
-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 @@ obj namegen(mutable i: int) {
|
|||
|
||||
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 @@ type crate_ctxt =
|
|||
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>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue