diff options
| author | bors <bors@rust-lang.org> | 2014-03-26 01:41:57 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-26 01:41:57 -0700 |
| commit | de85948ac0a6bc0fde0484790296cb4e041e993f (patch) | |
| tree | 71c6553b77c1abad61ab27a6e2886fa4b7a017aa /src/libstd | |
| parent | 6bac5607c963c61d488a0d832458341589a560b3 (diff) | |
| parent | e2ae4585481879290879e46881916ce6e3dd22c1 (diff) | |
| download | rust-de85948ac0a6bc0fde0484790296cb4e041e993f.tar.gz rust-de85948ac0a6bc0fde0484790296cb4e041e993f.zip | |
auto merge of #13117 : alexcrichton/rust/no-crate-map, r=brson
This can be done now that logging has been moved out and libnative is the default (not libgreen)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/crate_map.rs | 104 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 3 |
3 files changed, 1 insertions, 108 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 021a932fc8b..9e13d70b0ce 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -84,7 +84,7 @@ // '__test' module. #[cfg(test)] #[start] fn start(argc: int, argv: **u8) -> int { - green::start(argc, argv, __test::main) + green::start(argc, argv, rustuv::event_loop, __test::main) } pub mod macros; diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs deleted file mode 100644 index 98f4986b2c7..00000000000 --- a/src/libstd/rt/crate_map.rs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use cast; -use option::{Some, None, Option}; -use ptr::RawPtr; -use rt::rtio::EventLoop; - -// Need to tell the linker on OS X to not barf on undefined symbols -// and instead look them up at runtime, which we need to resolve -// the crate_map properly. -#[cfg(target_os = "macos")] -#[link_args = "-Wl,-U,__rust_crate_map_toplevel"] -extern {} - -pub struct CrateMap<'a> { - version: i32, - event_loop_factory: Option<fn() -> ~EventLoop>, -} - -// When working on android, apparently weak symbols don't work so well for -// finding the crate map, and neither does dlopen + dlsym. This is mainly a -// problem when integrating a shared library with an existing application. -// Standalone binaries do not appear to have this problem. The reasons are a -// little mysterious, and more information can be found in #11731. -// -// For now we provide a way to tell libstd about the crate map manually that's -// checked before the normal weak symbol/dlopen paths. In theory this is useful -// on other platforms where our dlopen/weak linkage strategy mysteriously fails -// but the crate map can be specified manually. -static mut MANUALLY_PROVIDED_CRATE_MAP: *CrateMap<'static> = - 0 as *CrateMap<'static>; -#[no_mangle] -#[cfg(not(test))] -pub extern fn rust_set_crate_map(map: *CrateMap<'static>) { - unsafe { MANUALLY_PROVIDED_CRATE_MAP = map; } -} - -fn manual_crate_map() -> Option<&'static CrateMap<'static>> { - unsafe { - if MANUALLY_PROVIDED_CRATE_MAP.is_null() { - None - } else { - Some(cast::transmute(MANUALLY_PROVIDED_CRATE_MAP)) - } - } -} - -#[cfg(not(windows))] -pub fn get_crate_map() -> Option<&'static CrateMap<'static>> { - extern { - #[crate_map] - static CRATE_MAP: CrateMap<'static>; - } - - manual_crate_map().or_else(|| { - let ptr: (*CrateMap) = &'static CRATE_MAP; - if ptr.is_null() { - None - } else { - Some(&'static CRATE_MAP) - } - }) -} - -#[cfg(windows)] -pub fn get_crate_map() -> Option<&'static CrateMap<'static>> { - use c_str::ToCStr; - use unstable::dynamic_lib::dl; - - match manual_crate_map() { - Some(cm) => return Some(cm), - None => {} - } - - let sym = unsafe { - let module = dl::open_internal(); - let rust_crate_map_toplevel = if cfg!(target_arch = "x86") { - "__rust_crate_map_toplevel" - } else { - "_rust_crate_map_toplevel" - }; - let sym = rust_crate_map_toplevel.with_c_str(|buf| { - dl::symbol(module, buf) - }); - dl::close(module); - sym - }; - let ptr: (*CrateMap) = sym as *CrateMap; - if ptr.is_null() { - return None; - } else { - unsafe { - return Some(cast::transmute(sym)); - } - } -} diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 84e547619df..795281026a4 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -104,9 +104,6 @@ pub mod env; /// The local, managed heap pub mod local_heap; -/// Crate map -pub mod crate_map; - /// The runtime needs to be able to put a pointer into thread-local storage. mod local_ptr; |
