Skip to content

Fix emscripten build by removing dummy atexit function - #4435

Merged
sbc100 merged 1 commit into
mainfrom
fix_emscripten_build
Jan 9, 2022
Merged

Fix emscripten build by removing dummy atexit function#4435
sbc100 merged 1 commit into
mainfrom
fix_emscripten_build

Conversation

@sbc100

@sbc100 sbc100 commented Jan 8, 2022

Copy link
Copy Markdown
Member

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.

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.
@sbc100
sbc100 requested a review from kripken January 8, 2022 23:08
@sbc100
sbc100 merged commit 92dd9e2 into main Jan 9, 2022
@sbc100
sbc100 deleted the fix_emscripten_build branch January 9, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants