Skip to content

Commit 9b98d42

Browse files
authored
Remove __cxa_thread_atexit stubs (#15531)
Back in #14489 we started using the implemenation of `__cxa_thread_atexit` from libcxxabi so this is stub should never be needed. This change also involves renaming the test from `.c` to `.cpp` since C programs don't generally have access to `__cxa_thread_atexit` (its part of libcxxabi). I also removed the call to `__cxa_thread_atexit_impl` since we don't define that anywhere in emscripten. Also run this tests with threads enabled which would have resulted in an undefined reference to `__cxa_thread_atexit_impl` previously.
1 parent bb615a9 commit 9b98d42

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/library_pthread_stub.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ var LibraryPThreadStub = {
1616
return !ENVIRONMENT_IS_WORKER;
1717
#endif
1818
},
19-
20-
__cxa_thread_atexit: 'atexit',
21-
__cxa_thread_atexit_impl: 'atexit',
2219
};
2320

2421
mergeInto(LibraryManager.library, LibraryPThreadStub);

tests/core/test_atexit_threads.c renamed to tests/core/test_atexit_threads.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
#include <stdio.h>
99
#include <stdlib.h>
1010

11-
extern int __cxa_thread_atexit(void (*dtor)(void *), void *obj, void *dso_symbol);
12-
extern int __cxa_thread_atexit_impl(void (*dtor)(void *), void *obj, void *dso_symbol);
11+
extern "C" {
12+
int __cxa_thread_atexit(void (*dtor)(void *), void *obj, void *dso_symbol);
13+
}
1314

1415
static void cleanA() { printf("A\n"); }
1516
static void cleanB() { printf("B\n"); }
@@ -19,6 +20,5 @@ int main() {
1920
atexit(cleanA);
2021
atexit(cleanB);
2122
__cxa_thread_atexit(cleanCarg, (void*)100, NULL);
22-
__cxa_thread_atexit_impl(cleanCarg, (void*)234, NULL);
2323
return 0;
2424
}

tests/core/test_atexit_threads.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
C 234
21
C 100
32
B
43
A

tests/test_core.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,10 +2385,15 @@ def test_atexit(self):
23852385
self.set_setting('EXIT_RUNTIME')
23862386
self.do_core_test('test_atexit.c')
23872387

2388-
def test_atexit_threads(self):
2388+
def test_atexit_threads_stub(self):
23892389
# also tests thread exit (__cxa_thread_atexit)
23902390
self.set_setting('EXIT_RUNTIME')
2391-
self.do_core_test('test_atexit_threads.c')
2391+
self.do_core_test('test_atexit_threads.cpp')
2392+
2393+
@node_pthreads
2394+
def test_atexit_threads(self):
2395+
self.set_setting('EXIT_RUNTIME')
2396+
self.do_core_test('test_atexit_threads.cpp')
23922397

23932398
@no_asan('test relies on null pointer reads')
23942399
def test_pthread_specific(self):

0 commit comments

Comments
 (0)