<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WebAssembly: handleWeakUndefines(): Assertion `FuncSym->Signature' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=40219">40219</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WebAssembly: handleWeakUndefines(): Assertion `FuncSym->Signature' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alonzakai@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Running emcc on this testcase:

===
#include <stdio.h>

extern int __attribute__((weak)) externWeak();

int main() {
  printf("%p\n", externWeak);
  if (externWeak) externWeak();
  printf("ok.\n");
}
===

fails with

===
$ emcc a.cpp
wasm-ld: lld/wasm/Driver.cpp:309: void handleWeakUndefines(): Assertion
`FuncSym->Signature' failed.
Stack dump:
0.      Program arguments: llvm/build/bin/wasm-ld --export-dynamic -z
stack-size=5242880 --global-base=1024 --initial-memory=16777216 -o
/tmp/emscripten_temp_sTTiBb/a.out.wasm --no-entry --allow-undefined
--import-memory --import-table --export __wasm_call_ctors --export __data_end
--lto-O0 /tmp/emscripten_temp_sTTiBb/a_0.o .emscripten_cache/wasm_bc/libc.bc
.emscripten_cache/wasm_bc/libc-wasm.bc .emscripten_cache/wasm_bc/libdlmalloc.bc
.emscripten_cache/wasm_bc/libcompiler_rt.a
.emscripten_cache/wasm_bc/libcompiler_rt_wasm.a
.emscripten_cache/wasm_bc/libc_rt_wasm.a --max-memory=16777216 -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr --export main --export malloc --export free --export setThrew
--export __errno_location --export fflush 
#0 0x000055a51502006a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(llvm/build/bin/wasm-ld+0x52a06a)
#1 0x000055a51501e594 llvm::sys::RunSignalHandlers()
(llvm/build/bin/wasm-ld+0x528594)
#2 0x000055a51501e6c2 SignalHandler(int) (llvm/build/bin/wasm-ld+0x5286c2)
#3 0x00007f67cd2f70c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
#4 0x00007f67cbacefcf gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
#5 0x00007f67cbad03fa abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
#6 0x00007f67cbac7e37 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
#7 0x00007f67cbac7ee2 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
#8 0x000055a514f09ced handleWeakUndefines() (llvm/build/bin/wasm-ld+0x413ced)
#9 0x000055a51524e707 (anonymous
namespace)::LinkerDriver::link(llvm::ArrayRef<char const*>) (.constprop.320)
(llvm/build/bin/wasm-ld+0x758707)
#10 0x000055a51524ef3f lld::wasm::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&) (llvm/build/bin/wasm-ld+0x758f3f)
#11 0x000055a514f75577 main (llvm/build/bin/wasm-ld+0x47f577)
#12 0x00007f67cbabc2b1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
#13 0x000055a515007e4a _start (llvm/build/bin/wasm-ld+0x511e4a)
===

See also

 * <a href="https://github.com/kripken/emscripten-fastcomp/pull/248">https://github.com/kripken/emscripten-fastcomp/pull/248</a>
 * <a href="https://github.com/kripken/emscripten/pull/7805">https://github.com/kripken/emscripten/pull/7805</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>