@@ -43,7 +43,6 @@ use rustc::ty::{self, Ty, TyCtxt};
43
43
use rustc:: ty:: maps:: Providers ;
44
44
use rustc:: dep_graph:: { DepNode , DepKind } ;
45
45
use rustc:: middle:: cstore:: { self , LinkMeta , LinkagePreference } ;
46
- use rustc:: hir:: map as hir_map;
47
46
use rustc:: util:: common:: { time, print_time_passes_entry} ;
48
47
use rustc:: session:: config:: { self , NoDebugInfo } ;
49
48
use rustc:: session:: Session ;
@@ -885,56 +884,6 @@ fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter {
885
884
}
886
885
}
887
886
888
- /// The context provided lists a set of reachable ids as calculated by
889
- /// middle::reachable, but this contains far more ids and symbols than we're
890
- /// actually exposing from the object file. This function will filter the set in
891
- /// the context to the set of ids which correspond to symbols that are exposed
892
- /// from the object file being generated.
893
- ///
894
- /// This list is later used by linkers to determine the set of symbols needed to
895
- /// be exposed from a dynamic library and it's also encoded into the metadata.
896
- pub fn find_exported_symbols ( tcx : TyCtxt ) -> NodeSet {
897
- tcx. reachable_set ( LOCAL_CRATE ) . 0 . iter ( ) . cloned ( ) . filter ( |& id| {
898
- // Next, we want to ignore some FFI functions that are not exposed from
899
- // this crate. Reachable FFI functions can be lumped into two
900
- // categories:
901
- //
902
- // 1. Those that are included statically via a static library
903
- // 2. Those included otherwise (e.g. dynamically or via a framework)
904
- //
905
- // Although our LLVM module is not literally emitting code for the
906
- // statically included symbols, it's an export of our library which
907
- // needs to be passed on to the linker and encoded in the metadata.
908
- //
909
- // As a result, if this id is an FFI item (foreign item) then we only
910
- // let it through if it's included statically.
911
- match tcx. hir . get ( id) {
912
- hir_map:: NodeForeignItem ( ..) => {
913
- let def_id = tcx. hir . local_def_id ( id) ;
914
- tcx. is_statically_included_foreign_item ( def_id)
915
- }
916
-
917
- // Only consider nodes that actually have exported symbols.
918
- hir_map:: NodeItem ( & hir:: Item {
919
- node : hir:: ItemStatic ( ..) , .. } ) |
920
- hir_map:: NodeItem ( & hir:: Item {
921
- node : hir:: ItemFn ( ..) , .. } ) |
922
- hir_map:: NodeImplItem ( & hir:: ImplItem {
923
- node : hir:: ImplItemKind :: Method ( ..) , .. } ) => {
924
- let def_id = tcx. hir . local_def_id ( id) ;
925
- let generics = tcx. generics_of ( def_id) ;
926
- let attributes = tcx. get_attrs ( def_id) ;
927
- ( generics. parent_types == 0 && generics. types . is_empty ( ) ) &&
928
- // Functions marked with #[inline] are only ever translated
929
- // with "internal" linkage and are never exported.
930
- !attr:: requests_inline ( & attributes)
931
- }
932
-
933
- _ => false
934
- }
935
- } ) . collect ( )
936
- }
937
-
938
887
pub fn trans_crate < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
939
888
rx : mpsc:: Receiver < Box < Any + Send > > )
940
889
-> OngoingCrateTranslation {
0 commit comments