File tree 2 files changed +13
-3
lines changed
test/run-make/symbol-visibility
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -747,7 +747,7 @@ impl<'a> Linker for EmLinker<'a> {
747
747
fn exported_symbols ( tcx : TyCtxt , crate_type : CrateType ) -> Vec < String > {
748
748
let mut symbols = Vec :: new ( ) ;
749
749
750
- let export_threshold = symbol_export:: threshold ( tcx ) ;
750
+ let export_threshold = symbol_export:: crates_export_threshold ( & [ crate_type ] ) ;
751
751
for & ( ref name, _, level) in tcx. exported_symbols ( LOCAL_CRATE ) . iter ( ) {
752
752
if level. is_below_threshold ( export_threshold) {
753
753
symbols. push ( name. clone ( ) ) ;
Original file line number Diff line number Diff line change 9
9
else
10
10
11
11
NM =nm -D
12
- DYLIB_EXT =so
13
12
CDYLIB_NAME =liba_cdylib.so
14
13
RDYLIB_NAME =liba_rust_dylib.so
15
14
EXE_NAME =an_executable
15
+ COMBINED_CDYLIB_NAME =libcombined_rlib_dylib.so
16
16
17
17
ifeq ($(UNAME ) ,Darwin)
18
18
NM =nm -gU
19
- DYLIB_EXT =dylib
20
19
CDYLIB_NAME =liba_cdylib.dylib
21
20
RDYLIB_NAME =liba_rust_dylib.dylib
22
21
EXE_NAME =an_executable
22
+ COMBINED_CDYLIB_NAME =libcombined_rlib_dylib.dylib
23
23
endif
24
24
25
25
all :
26
26
$(RUSTC ) an_rlib.rs
27
27
$(RUSTC ) a_cdylib.rs
28
28
$(RUSTC ) a_rust_dylib.rs
29
29
$(RUSTC ) an_executable.rs
30
+ $(RUSTC ) a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib
30
31
31
32
# Check that a cdylib exports its public #[no_mangle] functions
32
33
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c public_c_function_from_cdylib)" -eq "1" ]
47
48
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
48
49
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_rust_function_from_exe)" -eq "0" ]
49
50
51
+
52
+ # Check the combined case, where we generate a cdylib and an rlib in the same
53
+ # compilation session:
54
+ # Check that a cdylib exports its public #[no_mangle] functions
55
+ [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c public_c_function_from_cdylib)" -eq "1" ]
56
+ # Check that a cdylib exports the public #[no_mangle] functions of dependencies
57
+ [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
58
+ # Check that a cdylib DOES NOT export any public Rust functions
59
+ [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
50
60
endif
You can’t perform that action at this time.
0 commit comments