diff --git a/libc-test/src/functional/exit_constructor.c b/libc-test/src/functional/exit_constructor.c new file mode 100644 index 0000000000000000000000000000000000000000..5fedfa32e8dab4864b9133abcd80d4286cb667ee --- /dev/null +++ b/libc-test/src/functional/exit_constructor.c @@ -0,0 +1,11 @@ +#include +#include "test.h" + +__attribute__((constructor)) +void B_ctor() { + exit(t_status); +} + +int main() { + return t_status; +} \ No newline at end of file diff --git a/libc-test/src/functional/test_src_functional.gni b/libc-test/src/functional/test_src_functional.gni index e4014779227b43e516b1400a37940ea8919e759e..2801e9412b0a1b71af1ca7d9283df8f32aea572d 100644 --- a/libc-test/src/functional/test_src_functional.gni +++ b/libc-test/src/functional/test_src_functional.gni @@ -80,6 +80,7 @@ functional_list = [ "wcstol", "dlclose_reset", "atexit_dlclose", + "exit_constructor", ] if (use_pthread_cancel) { diff --git a/porting/linux/user/ldso/dynlink.c b/porting/linux/user/ldso/dynlink.c index 42d56dca9dd85f1fa4df98e1140f92e15c8f702a..ac73ba1a56b4fbcb495359e33cafac2ad179b994 100644 --- a/porting/linux/user/ldso/dynlink.c +++ b/porting/linux/user/ldso/dynlink.c @@ -2570,7 +2570,7 @@ static void do_init_fini(struct dso **queue) { struct dso *p; size_t dyn[DYN_CNT], i; - int self = __pthread_self()->tid; + pthread_t self = __pthread_self(); pthread_mutex_lock(&init_fini_lock); for (i=0; (p=queue[i]); i++) { diff --git a/porting/linux/user/src/internal/dynlink.h b/porting/linux/user/src/internal/dynlink.h index d90d5e732a0ca2fa3a62fbd78c3cf26d9605f198..620ea808411c6f9dda4c79935980ce7cde9e76b7 100644 --- a/porting/linux/user/src/internal/dynlink.h +++ b/porting/linux/user/src/internal/dynlink.h @@ -106,7 +106,7 @@ struct dso { dev_t dev; ino_t ino; uint64_t file_offset; - int ctor_visitor; + pthread_t ctor_visitor; char *rpath_orig, *rpath; struct tls_module tls; size_t tls_id;