@@ -76,7 +76,7 @@ use std::c_str::ToCStr;
76
76
use std:: cell:: { Cell , RefCell } ;
77
77
use std:: libc:: c_uint;
78
78
use 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 } ;
80
80
use syntax:: ast_map:: PathName ;
81
81
use syntax:: ast_util:: { local_def, is_local} ;
82
82
use syntax:: attr:: AttrMetaMethods ;
@@ -2316,65 +2316,6 @@ pub fn symname(name: &str, hash: &str, vers: &str) -> ~str {
2316
2316
link:: exported_name( ast_map:: Values ( path. iter( ) ) . chain( None ) , hash, vers)
2317
2317
}
2318
2318
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
-
2378
2319
pub fn crate_ctxt_to_encode_parms<' r>( cx: & ' r CrateContext , ie: encoder:: EncodeInlinedItem <' r>)
2379
2320
-> encoder:: EncodeParams <' r> {
2380
2321
@@ -2467,26 +2408,6 @@ pub fn trans_crate(krate: ast::Crate,
2467
2408
trans_mod( & ccx, & krate. module) ;
2468
2409
}
2469
2410
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
-
2490
2411
glue:: emit_tydescs( & ccx) ;
2491
2412
if ccx. sess( ) . opts. debuginfo != NoDebugInfo {
2492
2413
debuginfo:: finalize( & ccx) ;
@@ -2537,7 +2458,6 @@ pub fn trans_crate(krate: ast::Crate,
2537
2458
// symbol. This symbol is required for use by the libmorestack library that
2538
2459
// we link in, so we must ensure that this symbol is not internalized (if
2539
2460
// defined in the crate).
2540
- reachable.push(ccx.crate_map_name.to_owned());
2541
2461
reachable. push( ~"main");
2542
2462
reachable.push(~" rust_stack_exhausted");
2543
2463
reachable.push(~" rust_eh_personality"); // referenced from .eh_frame section on some platforms
0 commit comments