File tree 3 files changed +28
-0
lines changed
compiler/rustc_codegen_ssa/src/back
tests/run-make/executable-no-mangle-strip
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,9 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
221
221
222
222
file. set_macho_build_version ( macho_object_build_version_for_target ( sess) )
223
223
}
224
+ if binary_format == BinaryFormat :: MachO {
225
+ file. set_subsections_via_symbols ( ) ;
226
+ }
224
227
if binary_format == BinaryFormat :: Coff {
225
228
// Disable the default mangler to avoid mangling the special "@feat.00" symbol name.
226
229
let original_mangling = file. mangling ( ) ;
Original file line number Diff line number Diff line change
1
+ unsafe extern "C" {
2
+ unsafe static UNDEFINED : usize ;
3
+ }
4
+
5
+ #[ unsafe( no_mangle) ]
6
+ pub fn used ( ) {
7
+ println ! ( "UNDEFINED = {}" , unsafe { UNDEFINED } ) ;
8
+ }
9
+
10
+ pub fn marker ( ) -> usize {
11
+ 0
12
+ }
13
+
14
+ fn main ( ) {
15
+ assert_eq ! ( marker( ) , 0_usize ) ;
16
+ }
Original file line number Diff line number Diff line change
1
+ // Test that functions marked with `#[no_mangle]` are GC-ed
2
+
3
+ //@ only-apple
4
+
5
+ use run_make_support:: rustc;
6
+
7
+ fn main ( ) {
8
+ rustc ( ) . arg ( "main.rs" ) . run ( ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments