File tree 6 files changed +26
-15
lines changed
6 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,14 @@ fn main() {
21
21
#[ cfg( feature = "gen-tests" ) ]
22
22
tests:: generate ( ) ;
23
23
24
- // Build missing intrinsics from compiler-rt C source code
25
- #[ cfg( feature = "c" ) ]
26
- c:: compile ( & llvm_target) ;
24
+ // Build missing intrinsics from compiler-rt C source code. If we're
25
+ // mangling names though we assume that we're also in test mode so we don't
26
+ // build anything and we rely on the upstream implementation of compiler-rt
27
+ // functions
28
+ if !cfg ! ( feature = "mangled-names" ) {
29
+ #[ cfg( feature = "c" ) ]
30
+ c:: compile ( & llvm_target) ;
31
+ }
27
32
28
33
// To compile intrinsics.rs for thumb targets, where there is no libc
29
34
if llvm_target[ 0 ] . starts_with ( "thumb" ) {
@@ -4099,11 +4104,9 @@ mod c {
4099
4104
// also needs to satisfy intrinsics that jemalloc or C in general may
4100
4105
// need, so include a few more that aren't typically needed by
4101
4106
// LLVM/Rust.
4102
- if env:: var_os ( "CARGO_FEATURE_RUSTBUILD" ) . is_some ( ) {
4103
- sources. extend ( & [
4104
- "ffsdi2.c" ,
4105
- ] ) ;
4106
- }
4107
+ sources. extend ( & [
4108
+ "ffsdi2.c" ,
4109
+ ] ) ;
4107
4110
4108
4111
if target_os != "ios" {
4109
4112
sources. extend (
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ for rlib in $(echo $path); do
93
93
uniq -d | \
94
94
grep -v __x86.get_pc_thunk | \
95
95
grep -v __builtin_cl | \
96
+ grep -v __builtin_ctz | \
96
97
grep ' T __'
97
98
98
99
if test $? = 0; then
Original file line number Diff line number Diff line change 13
13
#![ feature( lang_items) ]
14
14
#![ feature( start) ]
15
15
#![ feature( i128_type) ]
16
+ #![ feature( global_allocator) ]
17
+ #![ feature( allocator_api) ]
16
18
#![ cfg_attr( windows, feature( panic_unwind) ) ]
17
19
#![ no_std]
18
20
@@ -22,6 +24,10 @@ extern crate compiler_builtins;
22
24
#[ cfg( windows) ]
23
25
extern crate panic_unwind;
24
26
27
+ #[ cfg( not( thumb) ) ]
28
+ #[ global_allocator]
29
+ static A : alloc_system:: System = alloc_system:: System ;
30
+
25
31
// NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
26
32
// compiler-rt provides a C/assembly implementation.
27
33
Original file line number Diff line number Diff line change @@ -112,8 +112,9 @@ intrinsics! {
112
112
int_to_float!( i, u32 , f64 )
113
113
}
114
114
115
- #[ use_c_shim_if( all( any( target_arch = "x86" , target_arch = "x86_64" ) ,
116
- not( windows) ) ) ]
115
+ #[ use_c_shim_if( all( not( target_env = "msvc" ) ,
116
+ any( target_arch = "x86" ,
117
+ all( not( windows) , target_arch = "x86_64" ) ) ) ) ]
117
118
#[ arm_aeabi_alias = __aeabi_ul2d]
118
119
pub extern "C" fn __floatundidf( i: u64 ) -> f64 {
119
120
int_to_float!( i, u64 , f64 )
Original file line number Diff line number Diff line change 44
44
#![ cfg( not( windows) ) ] // Windows already has builtins to do this
45
45
46
46
#[ naked]
47
- #[ no_mangle]
47
+ #[ cfg_attr ( not ( feature = "mangled-names" ) , no_mangle) ]
48
48
#[ cfg( target_arch = "x86_64" ) ]
49
49
pub unsafe extern fn __rust_probestack ( ) {
50
50
// Our goal here is to touch each page between %rsp+8 and %rsp+8-%rax,
@@ -87,7 +87,7 @@ pub unsafe extern fn __rust_probestack() {
87
87
}
88
88
89
89
#[ naked]
90
- #[ no_mangle]
90
+ #[ cfg_attr ( not ( feature = "mangled-names" ) , no_mangle) ]
91
91
#[ cfg( target_arch = "x86" ) ]
92
92
pub unsafe extern fn __rust_probestack ( ) {
93
93
// This is the same as x86_64 above, only translated for 32-bit sizes. Note
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use core::intrinsics;
10
10
11
11
#[ cfg( windows) ]
12
12
#[ naked]
13
- #[ no_mangle]
13
+ #[ cfg_attr ( not ( feature = "mangled-names" ) , no_mangle) ]
14
14
pub unsafe fn ___chkstk_ms ( ) {
15
15
asm ! ( "push %rcx
16
16
push %rax
@@ -34,7 +34,7 @@ pub unsafe fn ___chkstk_ms() {
34
34
35
35
#[ cfg( windows) ]
36
36
#[ naked]
37
- #[ no_mangle]
37
+ #[ cfg_attr ( not ( feature = "mangled-names" ) , no_mangle) ]
38
38
pub unsafe fn __alloca ( ) {
39
39
asm ! ( "mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
40
40
jmp ___chkstk // Jump to ___chkstk since fallthrough may be unreliable" ) ;
@@ -43,7 +43,7 @@ pub unsafe fn __alloca() {
43
43
44
44
#[ cfg( windows) ]
45
45
#[ naked]
46
- #[ no_mangle]
46
+ #[ cfg_attr ( not ( feature = "mangled-names" ) , no_mangle) ]
47
47
pub unsafe fn ___chkstk ( ) {
48
48
asm ! ( "push %rcx
49
49
cmp $$0x1000,%rax
You can’t perform that action at this time.
0 commit comments