Skip to content

Invalid TableNumber error when linking static lib into a shared module #23965

Open
@IsabelParedes

Description

@IsabelParedes

Hello! I'm trying to compile some shared modules that link Flang's libFortranRuntime.a (flang source). 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:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions