Skip to content

Commit 81927ca

Browse files
authored
Rollup merge of rust-lang#59752 - Zoxc:dylib-fix, r=michaelwoerister
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.
2 parents fec3c44 + 2f948ea commit 81927ca

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/librustc_codegen_ssa/back/linker.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -372,15 +372,11 @@ impl<'a> Linker for GccLinker<'a> {
372372
}
373373

374374
fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType) {
375-
// If we're compiling a dylib, then we let symbol visibility in object
376-
// files to take care of whether they're exported or not.
377-
//
378-
// If we're compiling a cdylib, however, we manually create a list of
379-
// exported symbols to ensure we don't expose any more. The object files
380-
// have far more public symbols than we actually want to export, so we
381-
// hide them all here.
382-
if crate_type == CrateType::Dylib ||
383-
crate_type == CrateType::ProcMacro {
375+
// We manually create a list of exported symbols to ensure we don't expose any more.
376+
// The object files have far more public symbols than we actually want to export,
377+
// so we hide them all here.
378+
379+
if crate_type == CrateType::ProcMacro {
384380
return
385381
}
386382

0 commit comments

Comments
 (0)