emscripten-core / emscripten-core/emscripten

how to make the change of system lib source to work?

Open
#22,462 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 4d8e42ea6a89c73f90941fd1b6e899912e31dd34)
Target: wasm32-unknown-emscripten
Thread model: posix

i make a little change the emscripten_fetch.c file of the fetch lib,
https://github.com/emscripten-core/emscripten/blob/5a1578a50cf0a4d7120813984c9a71cccc97e61a/system/lib/fetch/emscripten_fetch.c#L88
to something like this:

```
printf("change calloc to malloc\n");
emscripten_fetch_t* fetch = (emscripten_fetch_t*)malloc(sizeof(emscripten_fetch_t));
if (!fetch) {
return NULL;
}
memset(fetch, 0, sizeof(emscripten_fetch_t));
```
after change the code ,i remove the libfetch*.a in cache/sysroot/lib folder, and after compile , in runtime, i see the 'change calloc to malloc' output in the browser console, but when i see the wasm decode in web browser, there is no malloc call, the calloc call is still there, why?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.