emscripten-core / emscripten-core/emscripten
Invalid TableNumber error when linking static lib into a shared module
- Lingua principale
- C++
- Stelle
- 27.6k
- Fork
- 3.6k
- Merge medio
- 1g 14h
- PR unite (30g)
- 125
Descrizione
Hello! I'm trying to compile some shared modules that link Flang's `libFortranRuntime.a` ([flang source](https://github.com/IsabelParedes/llvm-project/tree/flang19/flang/runtime)). This has been successful with versions 3.1.61 and older. However, starting with versions 3.1.62 (up to 4.0.5), there is an `Invalid TableNumber` error that occurs.
**Version of emscripten/emsdk:**
```sh
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.62 (34c1aa36052b1882058f22aa1916437ba0872690)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
**Failing command line in full:**
```
emcc libFortranRuntime.a -o test.so -sSIDE_MODULE=1
```
**Full link command and output with `-v` appended:**
Output with error v3.1.62:
```
/.../emsdk/upstream/bin/clang --version
/.../emsdk/upstream/bin/wasm-ld -o tst.so libFortranRuntime.a -L/.../emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-memory --strip-debug --export=__wasm_call_ctors --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js--export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic -shared --no-export-dynamic --stack-first
/.../emsdk/upstream/bin/wasm-ld -o tst.so --whole-archive libFortranRuntime.a -L/.../emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-memory --strip-debug --export-dynamic --export=__wasm_call_ctors --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic -shared --stack-first
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex16Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex4Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex4Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex8Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex8Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex16Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
/.../emsdk/upstream/bin/llvm-objcopy tst.so tst.so --remove-section=.debug* --remove-section=producers
/.../emsdk/upstream/bin/llvm-objcopy: error: 'tst.so': invalid TableNumber
emcc: error: '/.../emsdk/upstream/bin/llvm-objcopy tst.so tst.so --remove-section=.debug* --remove-section=producers' failed (returned 1)
```
Output **without** error v3.1.61:
```
/.../emsdk/upstream/bin/clang --version
/.../emsdk/upstream/bin/wasm-ld -o tst.so libFortranRuntime.a -L/.../emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-memory --strip-debug --export=__wasm_call_ctors --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js--export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic -shared --no-export-dynamic --stack-first
/.../emsdk/upstream/bin/wasm-ld -o tst.so --whole-archive libFortranRuntime.a -L/.../emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-memory --strip-debug --export-dynamic --export=__wasm_call_ctors --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic -shared --stack-first
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex16Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex16
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex4Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex4Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex8Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex8Value
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppDotProductComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(dot-product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppProductComplex4
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(product.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppReduceComplex16Ref
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(reduce.cpp.o)
wasm-ld: warning: function signature mismatch: _FortranACppSumComplex8
>>> defined as (i32, i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(complex-reduction.c.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in libFortranRuntime.a(sum.cpp.o)
/.../emsdk/upstream/bin/llvm-objcopy tst.so tst.so --remove-section=.debug* --remove-section=producers
/.../emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --side-module tst.so -o tst.so --detect-features
```
I would appreciate any help with this error. Please let me know if you need more details. Thank you!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Riproduci il problema con emcc 3.1.62 o versioni successive usando libFortranRuntime.a e -sSIDE_MODULE=1, quindi confronta le fasi wasm-ld e llvm-objcopy con la versione 3.1.61. Concentrati sul tst.so generato e sull’errore Invalid TableNumber; il lavoro è completato quando il modulo condiviso viene collegato e il passaggio objcopy post-link termina senza quell’errore.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, wasm
- Ambito
- build-system, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100