diff options
| author | bors <bors@rust-lang.org> | 2017-01-27 10:01:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-01-27 10:01:45 +0000 |
| commit | 8367fb7ba6abae89ab7e17c1b3987ee321f5bb71 (patch) | |
| tree | 21b4f4f8b07ec2058229ef9dbbb316a7155fd1b8 /src/liballoc_jemalloc | |
| parent | fece9c735678d152da721711f6f4aba1f0b8ab15 (diff) | |
| parent | 3d6f263b2a162974725cdcb914ba9ad9c2dbef84 (diff) | |
| download | rust-8367fb7ba6abae89ab7e17c1b3987ee321f5bb71.tar.gz rust-8367fb7ba6abae89ab7e17c1b3987ee321f5bb71.zip | |
Auto merge of #39252 - alexcrichton:less-exports, r=nrc
Hide a few more standard library symbols These commits touch up some of the symbol visibility rules for some crates related to the standard library, notably: * Symbols that are `pub extern` and `#[no_mangle]` which are internal-to-rust ABI things are no longer at the `C` export level, but the `Rust` export level. This includes allocators, panic runtimes, and compiler builtins. * The libbacktrace library is now compiled with `-fvisibility=hidden` to ensure that we don't export those symbols.
Diffstat (limited to 'src/liballoc_jemalloc')
| -rw-r--r-- | src/liballoc_jemalloc/build.rs | 11 | ||||
| -rw-r--r-- | src/liballoc_jemalloc/lib.rs | 2 | ||||
| -rw-r--r-- | src/liballoc_jemalloc/pthread_atfork_dummy.c | 16 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index 1edcb0b1f24..1143df0c630 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -181,4 +181,15 @@ fn main() { } else if !target.contains("windows") && !target.contains("musl") { println!("cargo:rustc-link-lib=pthread"); } + + // The pthread_atfork symbols is used by jemalloc on android but the really + // old android we're building on doesn't have them defined, so just make + // sure the symbols are available. + if target.contains("androideabi") { + println!("cargo:rerun-if-changed=pthread_atfork_dummy.c"); + gcc::Config::new() + .flag("-fvisibility=hidden") + .file("pthread_atfork_dummy.c") + .compile("libpthread_atfork_dummy.a"); + } } diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 241f8149d24..fc8a5455d1d 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -143,7 +143,7 @@ mod imp { // we're building on doesn't have them defined, so just make sure the symbols // are available. #[no_mangle] - #[cfg(target_os = "android")] + #[cfg(all(target_os = "android", not(cargobuild)))] pub extern "C" fn pthread_atfork(_prefork: *mut u8, _postfork_parent: *mut u8, _postfork_child: *mut u8) diff --git a/src/liballoc_jemalloc/pthread_atfork_dummy.c b/src/liballoc_jemalloc/pthread_atfork_dummy.c new file mode 100644 index 00000000000..4e3df0ab26c --- /dev/null +++ b/src/liballoc_jemalloc/pthread_atfork_dummy.c @@ -0,0 +1,16 @@ +// Copyright 2017 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. + +// See comments in build.rs for why this exists +int pthread_atfork(void* prefork, + void* postfork_parent, + void* postfork_child) { + return 0; +} |
