Skip to content
Snippets Groups Projects
Verified Commit 756a0d2e authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Initialize pthreads if it is linked

parent 1becb8c4
No related branches found
No related tags found
No related merge requests found
Pipeline #2168 passed with warnings
......@@ -44,6 +44,13 @@ unsafe fn copy_string_array(array: *const *const c_char, len: usize) -> Vec<*mut
vec
}
// In the case that pthread is not linked, pthread_init can be replaced
#[linkage = "weak"]
#[no_mangle]
extern "C" fn pthread_init() -> c_int {
0
}
#[inline(never)]
#[no_mangle]
pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
......@@ -53,6 +60,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
static __init_array_start: extern "C" fn();
static __init_array_end: extern "C" fn();
fn pthread_init() -> c_int;
fn _init();
fn main(argc: isize, argv: *mut *mut c_char, envp: *mut *mut c_char) -> c_int;
}
......@@ -77,6 +85,9 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
stdio::stdout = stdio::default_stdout.get();
stdio::stderr = stdio::default_stderr.get();
// Initialize pthreads
pthread_init();
// Call init section
_init();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment