Skip to content

Commit 92dd9e2

Browse files
authored
Fix emscripten build by removing dummy atexit function (#4435)
Since emscripten-core/emscripten#15905 landed emscripten now includes its own dummy atexit function when building with EXIT_RUNTIME=0. This dummy function conflicts with the emscripten-provided one: ``` wasm-ld: error: duplicate symbol: atexit >>> defined in CMakeFiles/binaryen_wasm.dir/src/binaryen-c.cpp.o >>> defined in ...wasm32-emscripten/lto/libnoexit.a(atexit_dummy.o) ``` Normally overriding symbols from libc does not causes issues but one needs to be sure to override all the symbols in a given object file so that the object in question (atexit_dummy.o) does not get linked in. In this case some other symbol being defined in in atexit_dummy.o (e.g. __cxa_atexit) is likely the cause of the conflict. Overriding symbols from libc is likely to break in this way as the libc evolves, and since emscripten is now providing a dummy, just as we want, its better/safer to simply remove our dummy.
1 parent 1ef8f1f commit 92dd9e2

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/binaryen-c.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,10 +4617,6 @@ void BinaryenSetColorsEnabled(bool enabled) { Colors::setEnabled(enabled); }
46174617
bool BinaryenAreColorsEnabled() { return Colors::isEnabled(); }
46184618

46194619
#ifdef __EMSCRIPTEN__
4620-
// Override atexit - we don't need any global ctors to actually run, and
4621-
// otherwise we get clutter in the output in debug builds
4622-
int atexit(void (*function)(void)) { return 0; }
4623-
46244620
// Internal binaryen.js APIs
46254621

46264622
// Returns the size of a Literal object.

0 commit comments

Comments
 (0)