@@ -11,7 +11,6 @@ use rustc_middle::ty::print::{Print, Printer};
1111use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , Subst } ;
1212use rustc_middle:: ty:: { self , FloatTy , Instance , IntTy , Ty , TyCtxt , TypeFoldable , UintTy } ;
1313use rustc_span:: symbol:: kw;
14- use rustc_target:: abi:: call:: FnAbi ;
1514use rustc_target:: abi:: Integer ;
1615use rustc_target:: spec:: abi:: Abi ;
1716
@@ -58,41 +57,6 @@ pub(super) fn mangle<'tcx>(
5857 std:: mem:: take ( & mut cx. out )
5958}
6059
61- pub ( super ) fn mangle_typeid_for_fnabi < ' tcx > (
62- _tcx : TyCtxt < ' tcx > ,
63- fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
64- ) -> String {
65- // LLVM uses type metadata to allow IR modules to aggregate pointers by their types.[1] This
66- // type metadata is used by LLVM Control Flow Integrity to test whether a given pointer is
67- // associated with a type identifier (i.e., test type membership).
68- //
69- // Clang uses the Itanium C++ ABI's[2] virtual tables and RTTI typeinfo structure name[3] as
70- // type metadata identifiers for function pointers. The typeinfo name encoding is a
71- // two-character code (i.e., “TS”) prefixed to the type encoding for the function.
72- //
73- // For cross-language LLVM CFI support, a compatible encoding must be used by either
74- //
75- // a. Using a superset of types that encompasses types used by Clang (i.e., Itanium C++ ABI's
76- // type encodings[4]), or at least types used at the FFI boundary.
77- // b. Reducing the types to the least common denominator between types used by Clang (or at
78- // least types used at the FFI boundary) and Rust compilers (if even possible).
79- // c. Creating a new ABI for cross-language CFI and using it for Clang and Rust compilers (and
80- // possibly other compilers).
81- //
82- // Option (b) may weaken the protection for Rust-compiled only code, so it should be provided
83- // as an alternative to a Rust-specific encoding for when mixing Rust and C and C++ -compiled
84- // code. Option (c) would require changes to Clang to use the new ABI.
85- //
86- // [1] https://llvm.org/docs/TypeMetadata.html
87- // [2] https://itanium-cxx-abi.github.io/cxx-abi/abi.html
88- // [3] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-special-vtables
89- // [4] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-type
90- //
91- // FIXME(rcvalle): See comment above.
92- let arg_count = fn_abi. args . len ( ) + fn_abi. ret . is_indirect ( ) as usize ;
93- format ! ( "typeid{}" , arg_count)
94- }
95-
9660struct BinderLevel {
9761 /// The range of distances from the root of what's
9862 /// being printed, to the lifetimes in a binder.
0 commit comments