From 27cf2b6384ec92d3615d5f92f7e388bb65be9f5d Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 18 Mar 2026 12:59:23 -0700 Subject: [PATCH] Remove thread profiler completely from non-pthreads builds. NFC Split out from #26487 --- system/lib/pthread/threading_internal.h | 2 +- test/codesize/test_codesize_hello_dylink_all.json | 6 ++---- tools/system_libs.py | 5 +---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/system/lib/pthread/threading_internal.h b/system/lib/pthread/threading_internal.h index 5eed1be790b9d..abc6cbff7f22c 100644 --- a/system/lib/pthread/threading_internal.h +++ b/system/lib/pthread/threading_internal.h @@ -69,7 +69,7 @@ void _emscripten_thread_exit_joinable(pthread_t thread); void _emscripten_thread_exit(void* result); void _emscripten_process_dlopen_queue(void); -#ifdef NDEBUG +#if !defined(__EMSCRIPTEN_PTHREADS__) || defined(NDEBUG) #define emscripten_set_current_thread_status(newStatus) #define emscripten_conditional_set_current_thread_status(expectedStatus, newStatus) #else diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index a761e5ca7e669..471efd1a97219 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { "a.out.js": 244367, - "a.out.nodebug.wasm": 577323, - "total": 821690, + "a.out.nodebug.wasm": 577288, + "total": 821655, "sent": [ "IMG_Init", "IMG_Load", @@ -2243,7 +2243,6 @@ "emscripten_proxy_sync", "emscripten_proxy_sync_with_ctx", "emscripten_scan_stack", - "emscripten_set_thread_name", "emscripten_stack_get_base", "emscripten_stack_get_current", "emscripten_stack_get_end", @@ -4100,7 +4099,6 @@ "$emscripten_proxy_async", "$emscripten_proxy_execute_queue", "$emscripten_scan_stack", - "$emscripten_set_thread_name", "$emscripten_stack_get_base", "$emscripten_stack_get_current", "$emscripten_stack_get_end", diff --git a/tools/system_libs.py b/tools/system_libs.py index 9e442f425b5dd..f669f63ac471c 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -1211,6 +1211,7 @@ def get_files(self): 'pthread_kill.c', 'emscripten_thread_init.c', 'emscripten_yield.c', + 'thread_profiler.c', ]) else: ignore += ['thread'] @@ -1412,10 +1413,6 @@ def get_files(self): if settings.MAIN_MODULE: libc_files += files_in_path(path='system/lib/libc', filenames=['dynlink.c']) - libc_files += files_in_path( - path='system/lib/pthread', - filenames=['thread_profiler.c']) - libc_files += glob_in_path('system/lib/libc/compat', '*.c') # Check for missing file in non_lto_files list. Do this here