File tree 3 files changed +14
-10
lines changed
3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -957,12 +957,9 @@ fn link_args(cmd: &mut Linker,
957
957
}
958
958
}
959
959
960
- // If we're building a dynamic library then some platforms need to make sure
961
- // that all symbols are exported correctly from the dynamic library.
962
- if crate_type != config:: CrateTypeExecutable ||
963
- sess. target . target . options . is_like_emscripten {
964
- cmd. export_symbols ( tmpdir, crate_type) ;
965
- }
960
+ // We are always giving the linker a list of exported symbols so it can hide
961
+ // as many symbols as possible.
962
+ cmd. export_symbols ( tmpdir, crate_type) ;
966
963
967
964
// When linking a dynamic library, we put the metadata into a section of the
968
965
// executable. This metadata is in a separate object file from the main
Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ fn main() {
27
27
for arg in env:: args ( ) . skip ( 1 ) {
28
28
let path = Path :: new ( & arg) ;
29
29
if !path. is_file ( ) {
30
+ let arg = if arg. ends_with ( "/list" ) && arg. contains ( "rustc." ) {
31
+ // Special case the linker script since it contains a temporary
32
+ // directory name created by the compiler
33
+ let end = arg. rfind ( "rustc." ) . unwrap ( ) ;
34
+ ( & arg[ ..end] ) . to_string ( )
35
+ } else {
36
+ arg. to_string ( )
37
+ } ;
38
+
30
39
out. push_str ( & arg) ;
31
40
out. push_str ( "\n " ) ;
32
41
continue
Original file line number Diff line number Diff line change 49
49
# Check that a Rust dylib does not export generics if -Zshare-generics=no
50
50
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rlib.*E)" -eq "0" ]
51
51
52
- # Check that an executable does not export any dynamic symbols
53
- [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
52
+ # Check that an executable does not export any dynamic Rust symbols
54
53
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_rust_function_from_exe)" -eq "0" ]
55
54
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
56
55
87
86
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_rust_function_from_rlib)" -eq "1" ]
88
87
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rlib.*E)" -eq "1" ]
89
88
90
- # Check that an executable does not export any dynamic symbols
91
- [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
89
+ # Check that an executable does not export any dynamic Rust symbols
92
90
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_rust_function_from_exe)" -eq "0" ]
93
91
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
94
92
endif
You can’t perform that action at this time.
0 commit comments