@@ -76,7 +76,7 @@ use std::c_str::ToCStr;
7676use std:: cell:: { Cell , RefCell } ;
7777use std:: libc:: c_uint;
7878use std:: local_data;
79- use syntax:: abi:: { X86 , X86_64 , Arm , Mips , Rust , RustIntrinsic , OsWin32 } ;
79+ use syntax:: abi:: { X86 , X86_64 , Arm , Mips , Rust , RustIntrinsic } ;
8080use syntax:: ast_map:: PathName ;
8181use syntax:: ast_util:: { local_def, is_local} ;
8282use syntax:: attr:: AttrMetaMethods ;
@@ -2316,65 +2316,6 @@ pub fn symname(name: &str, hash: &str, vers: &str) -> ~str {
23162316 link:: exported_name( ast_map:: Values ( path. iter( ) ) . chain( None ) , hash, vers)
23172317}
23182318
2319- pub fn decl_crate_map( ccx: & mut CrateContext ) {
2320- let mut n_subcrates = 1 ;
2321- while ccx. sess( ) . cstore. have_crate_data( n_subcrates) {
2322- n_subcrates += 1 ;
2323- }
2324- let is_top = !ccx. sess( ) . building_library. get( ) || ccx. sess( ) . opts. cg. gen_crate_map;
2325- let sym_name = if is_top {
2326- ~"_rust_crate_map_toplevel"
2327- } else {
2328- symname(" _rust_crate_map_" + ccx.link_meta.crateid.name,
2329- ccx.link_meta.crate_hash.as_str(),
2330- ccx.link_meta.crateid.version_or_default())
2331- };
2332-
2333- let maptype = Type::struct_(ccx, [
2334- Type::i32(ccx), // version
2335- ccx.int_type.ptr_to(), // event loop factory
2336- ], false);
2337- let map = sym_name.with_c_str(|buf| {
2338- unsafe {
2339- llvm::LLVMAddGlobal(ccx.llmod, maptype.to_ref(), buf)
2340- }
2341- });
2342- lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
2343-
2344- // On windows we'd like to export the toplevel cratemap
2345- // such that we can find it from libstd.
2346- if ccx.sess().targ_cfg.os == OsWin32 && is_top {
2347- unsafe { llvm::LLVMRustSetDLLExportStorageClass(map) }
2348- }
2349-
2350- ccx.crate_map_name = sym_name;
2351- ccx.crate_map = map;
2352- }
2353-
2354- pub fn fill_crate_map(ccx: &CrateContext, map: ValueRef) {
2355- let event_loop_factory = match ccx.tcx.lang_items.event_loop_factory() {
2356- Some(did) => unsafe {
2357- if is_local(did) {
2358- llvm::LLVMConstPointerCast(get_item_val(ccx, did.node),
2359- ccx.int_type.ptr_to().to_ref())
2360- } else {
2361- let name = csearch::get_symbol(&ccx.sess().cstore, did);
2362- let global = name.with_c_str(|buf| {
2363- llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type.to_ref(), buf)
2364- });
2365- global
2366- }
2367- },
2368- None => C_null(ccx.int_type.ptr_to())
2369- };
2370- unsafe {
2371- llvm::LLVMSetInitializer(map, C_struct(ccx,
2372- [C_i32(ccx, 2),
2373- event_loop_factory,
2374- ], false));
2375- }
2376- }
2377-
23782319pub fn crate_ctxt_to_encode_parms<' r>( cx: & ' r CrateContext , ie: encoder:: EncodeInlinedItem <' r>)
23792320 -> encoder:: EncodeParams <' r> {
23802321
@@ -2467,26 +2408,6 @@ pub fn trans_crate(krate: ast::Crate,
24672408 trans_mod( & ccx, & krate. module) ;
24682409 }
24692410
2470- fill_crate_map(&ccx, ccx.crate_map);
2471-
2472- // win32: wart with exporting crate_map symbol
2473- // We set the crate map (_rust_crate_map_toplevel) to use dll_export
2474- // linkage but that ends up causing the linker to look for a
2475- // __rust_crate_map_toplevel symbol (extra underscore) which it will
2476- // subsequently fail to find. So to mitigate that we just introduce
2477- // an alias from the symbol it expects to the one that actually exists.
2478- if ccx.sess().targ_cfg.os == OsWin32 && !ccx.sess().building_library.get() {
2479-
2480- let maptype = val_ty(ccx.crate_map).to_ref();
2481-
2482- " __rust_crate_map_toplevel".with_c_str(|buf| {
2483- unsafe {
2484- llvm::LLVMAddAlias(ccx.llmod, maptype,
2485- ccx.crate_map, buf);
2486- }
2487- })
2488- }
2489-
24902411 glue:: emit_tydescs( & ccx) ;
24912412 if ccx. sess( ) . opts. debuginfo != NoDebugInfo {
24922413 debuginfo:: finalize( & ccx) ;
@@ -2537,7 +2458,6 @@ pub fn trans_crate(krate: ast::Crate,
25372458 // symbol. This symbol is required for use by the libmorestack library that
25382459 // we link in, so we must ensure that this symbol is not internalized (if
25392460 // defined in the crate).
2540- reachable.push(ccx.crate_map_name.to_owned());
25412461 reachable. push( ~"main");
25422462 reachable.push(~" rust_stack_exhausted");
25432463 reachable.push(~" rust_eh_personality"); // referenced from .eh_frame section on some platforms
0 commit comments