File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/test/run-make/symbol-visibility Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 99else
1010
1111NM =nm -D
12- DYLIB_EXT =so
1312CDYLIB_NAME =liba_cdylib.so
1413RDYLIB_NAME =liba_rust_dylib.so
1514EXE_NAME =an_executable
15+ COMBINED_CDYLIB_NAME =libcombined_rlib_dylib.so
1616
1717ifeq ($(UNAME ) ,Darwin)
1818NM =nm -gU
19- DYLIB_EXT =dylib
2019CDYLIB_NAME =liba_cdylib.dylib
2120RDYLIB_NAME =liba_rust_dylib.dylib
2221EXE_NAME =an_executable
22+ COMBINED_CDYLIB_NAME =libcombined_rlib_dylib.dylib
2323endif
2424
2525all :
2626 $(RUSTC ) an_rlib.rs
2727 $(RUSTC ) a_cdylib.rs
2828 $(RUSTC ) a_rust_dylib.rs
2929 $(RUSTC ) an_executable.rs
30+ $(RUSTC ) a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib
3031
3132 # Check that a cdylib exports its public #[no_mangle] functions
3233 [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c public_c_function_from_cdylib)" -eq "1" ]
4748 [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
4849 [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_rust_function_from_exe)" -eq "0" ]
4950
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" ]
5060endif
You can’t perform that action at this time.
0 commit comments