diff options
| author | bors <bors@rust-lang.org> | 2019-06-15 10:18:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-15 10:18:09 +0000 |
| commit | dbebcee8d07b77eae3725988879001e6205c6e47 (patch) | |
| tree | ab9ec9225a499924eba707ca02369bb22f53945d /src/librustc_codegen_ssa | |
| parent | 9f8cd9da7b6380b5658163141c767a321f5f0f62 (diff) | |
| parent | f8f9a2869cce570c994d96afb82f4162b1b44cca (diff) | |
| download | rust-dbebcee8d07b77eae3725988879001e6205c6e47.tar.gz rust-dbebcee8d07b77eae3725988879001e6205c6e47.zip | |
Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichton
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/back/linker.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index c605c2e47c9..32696d46cd5 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -377,25 +377,18 @@ impl<'a> Linker for GccLinker<'a> { return; } - // If we're compiling a dylib, then we let symbol visibility in object - // files to take care of whether they're exported or not. - // - // If we're compiling a cdylib, however, we manually create a list of - // exported symbols to ensure we don't expose any more. The object files - // have far more public symbols than we actually want to export, so we - // hide them all here. - if crate_type == CrateType::Dylib || - crate_type == CrateType::ProcMacro { - return - } + // We manually create a list of exported symbols to ensure we don't expose any more. + // The object files have far more public symbols than we actually want to export, + // so we hide them all here. - // Symbol visibility takes care of this for the WebAssembly. - // Additionally the only known linker, LLD, doesn't support the script - // arguments just yet - if self.sess.target.target.arch == "wasm32" { + if !self.sess.target.target.options.limit_rdylib_exports { return; } + if crate_type == CrateType::ProcMacro { + return + } + let mut arg = OsString::new(); let path = tmpdir.join("list"); |
