Skip to content

Commit 77448a9

Browse files
authored
Fix for -pthread + -sRELOCATABLE (#22110)
Fixes: #22108
1 parent daa89dc commit 77448a9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/library_pthread.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,12 @@ var LibraryPThread = {
12421242
}
12431243
}
12441244
},
1245+
#elif RELOCATABLE
1246+
// Provide a dummy version of _emscripten_thread_exit_joinable when
1247+
// RELOCATABLE is used without MAIN_MODULE. This is because the call
1248+
// site in pthread_create.c is not able to distinguish between these
1249+
// two cases.
1250+
_emscripten_thread_exit_joinable: (thread) => {},
12451251
#endif // MAIN_MODULE
12461252

12471253
$checkMailbox__deps: ['$callUserCallback',

test/test_other.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11922,6 +11922,10 @@ def test_pthread_reuse(self):
1192211922
self.set_setting('PTHREAD_POOL_SIZE', 1)
1192311923
self.do_run_in_out_file_test('other/test_pthread_reuse.c')
1192411924

11925+
@node_pthreads
11926+
def test_pthread_relocatable(self):
11927+
self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sRELOCATABLE'])
11928+
1192511929
def test_stdin_preprocess(self):
1192611930
create_file('temp.h', '#include <string>')
1192711931
outputStdin = self.run_process([EMCC, '-x', 'c++', '-dM', '-E', '-'], input="#include <string>", stdout=PIPE).stdout

0 commit comments

Comments
 (0)