[PATCH] D91870: [WebAssembly] Add support for table linking to wasm-ld

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 07:17:31 PST 2021


sbc100 added a comment.

It looks like this change once again broke some emscripten tests.  This time it made it past our auto-rollers because they run the tests in questions.

The only real issue looks like a crash:

https://app.circleci.com/pipelines/github/emscripten-core/emscripten/10572/workflows/c3d06117-e1a6-4c55-95b0-80333209ad10

See the browsers tests log:

https://circleci.com/api/v1.1/project/github/emscripten-core/emscripten/388624/output/107/0?file=true&allocation-id=6006f0022f4f9c06d96ced0d-0-build%2F7C3546A8

  /tmp/emscripten_test_browser_ixzsc8j6/building/glbook/Chapter_2/Hello_Triangle/CH02_HelloTriangle.o
  wasm-ld: /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/lld/wasm/SymbolTable.cpp:278: lld::wasm::DefinedTable *lld::wasm::SymbolTable::addSyntheticTable(llvm::StringRef, uint32_t, lld::wasm::InputTable *): Assertion `!s || s->isUndefined()' failed.
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
  Stack dump:
  0.	Program arguments: /root/emsdk/upstream/bin/wasm-ld -o test.wasm /tmp/emscripten_test_browser_ixzsc8j6/building/glbook/Chapter_2/Hello_Triangle/CH02_HelloTriangle.o /tmp/emscripten_temp_eu76mn7s/report_result_0.o -L/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++abi-noexcept.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libdlmalloc.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc_rt_wasm.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
   #0 0x00007f93c0d537f3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/root/emsdk/upstream/bin/../lib/libLLVM-12git.so+0x84f7f3)
   #1 0x00007f93c0d5153e llvm::sys::RunSignalHandlers() (/root/emsdk/upstream/bin/../lib/libLLVM-12git.so+0x84d53e)
   #2 0x00007f93c0d53cbf SignalHandler(int) (/root/emsdk/upstream/bin/../lib/libLLVM-12git.so+0x84fcbf)
   #3 0x00007f93c43a6890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
   #4 0x00007f93bfb9be97 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ee97)
   #5 0x00007f93bfb9d801 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40801)
   #6 0x00007f93bfb8d39a (/lib/x86_64-linux-gnu/libc.so.6+0x3039a)
   #7 0x00007f93bfb8d412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
   #8 0x00000000007caba2 (/root/emsdk/upstream/bin/wasm-ld+0x7caba2)
   #9 0x00000000007b43f3 lld::wasm::(anonymous namespace)::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/root/emsdk/upstream/bin/wasm-ld+0x7b43f3)
  #10 0x00000000007ad836 lld::wasm::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) (/root/emsdk/upstream/bin/wasm-ld+0x7ad836)
  #11 0x000000000048df76 lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) (/root/emsdk/upstream/bin/wasm-ld+0x48df76)
  #12 0x000000000048db00 main (/root/emsdk/upstream/bin/wasm-ld+0x48db00)
  #13 0x00007f93bfb7eb97 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
  #14 0x000000000048d7da _start (/root/emsdk/upstream/bin/wasm-ld+0x48d7da)
  emcc: error: '/root/emsdk/upstream/bin/wasm-ld -o test.wasm /tmp/emscripten_test_browser_ixzsc8j6/building/glbook/Chapter_2/Hello_Triangle/CH02_HelloTriangle.o /tmp/emscripten_temp_eu76mn7s/report_result_0.o -L/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++abi-noexcept.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libdlmalloc.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc_rt_wasm.a /root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (-6)

I'm pretty sure thse test uses partial linking (`wasm-ld -r`) so I guess that is the problem.    We are probably generating the `__indirect_function_table` in the relocatable case when we should no be.  It should only be the final link to an executable that generates it, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91870/new/

https://reviews.llvm.org/D91870



More information about the llvm-commits mailing list