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