|
1 |
| -#[cfg(not(test))] |
2 |
| -use crate::alloc::{self, Layout}; |
3 | 1 | use crate::num::NonZeroUsize;
|
4 |
| -#[cfg(not(test))] |
5 |
| -use crate::slice; |
6 |
| -#[cfg(not(test))] |
7 |
| -use crate::str; |
8 | 2 |
|
9 | 3 | use super::waitqueue::{
|
10 | 4 | try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable,
|
@@ -165,10 +159,11 @@ impl RWLock {
|
165 | 159 | pub unsafe fn destroy(&self) {}
|
166 | 160 | }
|
167 | 161 |
|
| 162 | +// The following functions are needed by libunwind. These symbols are named |
| 163 | +// in pre-link args for the target specification, so keep that in sync. |
168 | 164 | #[cfg(not(test))]
|
169 | 165 | const EINVAL: i32 = 22;
|
170 | 166 |
|
171 |
| -// used by libunwind port |
172 | 167 | #[cfg(not(test))]
|
173 | 168 | #[no_mangle]
|
174 | 169 | pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 {
|
@@ -198,39 +193,6 @@ pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RWLock) -> i32 {
|
198 | 193 | return 0;
|
199 | 194 | }
|
200 | 195 |
|
201 |
| -// the following functions are also used by the libunwind port. They're |
202 |
| -// included here to make sure parallel codegen and LTO don't mess things up. |
203 |
| -#[cfg(not(test))] |
204 |
| -#[no_mangle] |
205 |
| -pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { |
206 |
| - if s < 0 { |
207 |
| - return; |
208 |
| - } |
209 |
| - let buf = slice::from_raw_parts(m as *const u8, s as _); |
210 |
| - if let Ok(s) = str::from_utf8(&buf[..buf.iter().position(|&b| b == 0).unwrap_or(buf.len())]) { |
211 |
| - eprint!("{}", s); |
212 |
| - } |
213 |
| -} |
214 |
| - |
215 |
| -#[cfg(not(test))] |
216 |
| -#[no_mangle] |
217 |
| -// NB. used by both libunwind and libpanic_abort |
218 |
| -pub unsafe extern "C" fn __rust_abort() { |
219 |
| - crate::sys::abort_internal(); |
220 |
| -} |
221 |
| - |
222 |
| -#[cfg(not(test))] |
223 |
| -#[no_mangle] |
224 |
| -pub unsafe extern "C" fn __rust_c_alloc(size: usize, align: usize) -> *mut u8 { |
225 |
| - alloc::alloc(Layout::from_size_align_unchecked(size, align)) |
226 |
| -} |
227 |
| - |
228 |
| -#[cfg(not(test))] |
229 |
| -#[no_mangle] |
230 |
| -pub unsafe extern "C" fn __rust_c_dealloc(ptr: *mut u8, size: usize, align: usize) { |
231 |
| - alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align)) |
232 |
| -} |
233 |
| - |
234 | 196 | #[cfg(test)]
|
235 | 197 | mod tests {
|
236 | 198 | use super::*;
|
|
0 commit comments