Skip to content

Commit 36ce3d3

Browse files
committed
ThreadStart-related changes in asan_emscripten.cpp
This deals with the following upstream changes: llvm/llvm-project@4e1b55a llvm/llvm-project@fd16d46 by adding `ThreadStartParams` class as `asan_win.cpp` did.
1 parent 67108b2 commit 36ce3d3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

system/lib/compiler-rt/lib/asan/asan_emscripten.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,19 @@ int emscripten_builtin_pthread_create(pthread_t *thread,
5454
void *(*callback)(void *), void *arg);
5555
}
5656

57+
struct ThreadStartParams {
58+
thread_callback_t start_routine;
59+
void *arg;
60+
};
61+
5762
static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) {
5863
AsanThread *t = (AsanThread *)arg;
5964
SetCurrentThread(t);
60-
return t->ThreadStart(GetTid());
65+
t->ThreadStart(GetTid());
66+
ThreadStartParams params;
67+
t->GetStartData(params);
68+
auto res = (*params.start_routine)(params.arg);
69+
return res;
6170
}
6271

6372
INTERCEPTOR(int, pthread_create, pthread_t *thread,
@@ -72,8 +81,8 @@ INTERCEPTOR(int, pthread_create, pthread_t *thread,
7281
pthread_attr_getdetachstate(attr, &detached);
7382

7483
u32 current_tid = GetCurrentTidOrInvalid();
75-
AsanThread *t =
76-
AsanThread::Create(start_routine, arg, current_tid, &stack, detached);
84+
ThreadStartParams params = {start_routine, arg};
85+
AsanThread* t = AsanThread::Create(params, current_tid, &stack, detached);
7786

7887
int result;
7988
{

0 commit comments

Comments
 (0)