emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

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

Open yejun81 opened this issue 5 months ago • 6 comments

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?

yejun81 avatar Aug 28 '24 14:08 yejun81