File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,20 @@ fn main() {
2424 static _F5: unsafe extern "C" fn ( * mut c_void , usize ) -> * mut c_void = jemalloc_sys:: realloc;
2525 #[ used]
2626 static _F6: unsafe extern "C" fn ( * mut c_void ) = jemalloc_sys:: free;
27+
28+ // On OSX, jemalloc doesn't directly override malloc/free, but instead
29+ // registers itself with the allocator's zone APIs in a ctor. However,
30+ // the linker doesn't seem to consider ctors as "used" when statically
31+ // linking, so we need to explicitly depend on the function.
32+ #[ cfg( target_os = "macos" ) ]
33+ {
34+ extern "C" {
35+ fn _rjem_je_zone_register ( ) ;
36+ }
37+
38+ #[ used]
39+ static _F7: unsafe extern "C" fn ( ) = _rjem_je_zone_register ( ) ;
40+ }
2741 }
2842
2943 rustc_driver:: set_sigpipe_handler ( ) ;
You can’t perform that action at this time.
0 commit comments