فهرست منبع

Remove detailed abort, too many compatibility issues

Jeremy Soller 1 سال پیش
والد
کامیت
0646140d99
3فایلهای تغییر یافته به همراه3 افزوده شده و 31 حذف شده
  1. 0 6
      include/bits/stdlib.h
  2. 2 4
      src/c/stack_chk.c
  3. 1 21
      src/header/stdlib/mod.rs

+ 0 - 6
include/bits/stdlib.h

@@ -1,12 +1,6 @@
 #ifndef _BITS_STDLIB_H
 #define _BITS_STDLIB_H
 
-// C++ needs abort to be a function, and cannot use this
-#ifndef __cplusplus
-// Override abort function with detailed abort in C
-#define abort() __abort(__func__, __FILE__, __LINE__)
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif

+ 2 - 4
src/c/stack_chk.c

@@ -2,11 +2,9 @@
 
 uintptr_t __stack_chk_guard = 0xd048c37519fcadfe;
 
-// manually define detailed abort function
-void __abort(const char *func, const char *file, int line) __attribute__((noreturn));
+void abort(void) __attribute__((noreturn));
 
 __attribute__((noreturn))
 void __stack_chk_fail(void) {
-    // call detailed abort function
-    __abort(__func__, __FILE__, __LINE__);
+    abort();
 }

+ 1 - 21
src/header/stdlib/mod.rs

@@ -91,27 +91,7 @@ pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
 
 #[no_mangle]
 pub unsafe extern "C" fn abort() -> ! {
-    eprintln!("Legacy Abort");
-
-    intrinsics::abort();
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn __abort(
-    func: *const c_char,
-    file: *const c_char,
-    line: c_int,
-) -> ! {
-    let func = CStr::from_ptr(func).to_str().unwrap();
-    let file = CStr::from_ptr(file).to_str().unwrap();
-
-    eprintln!(
-        "{}: {}:{}: Abort",
-        func,
-        file,
-        line
-    );
-
+    eprintln!("Abort");
     intrinsics::abort();
 }