<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 - lld::wasm::LinkingSection::writeBody(): Assertion `isec->getComdatName() == comdat' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=46227">46227</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld::wasm::LinkingSection::writeBody(): Assertion `isec->getComdatName() == comdat' 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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>wasm
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>claude@mathr.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, sbc@chromium.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiling Gem (a plugin for Pure-data) with Emscripten ("latest" as of today)
fails at the link stage with an assertion failure in wasm-ld:

```
(very long link command omitted)
em++: warning: Assuming object file output in the absence of `-c`, based on
output filename. Add with `-c` or `-r` to avoid this warning [-Wemcc]
em++: warning: ignoring unsupported linker flag: `-soname` [-Wlinkflags]
wasm-ld:
/b/s/w/ir/cache/builder/emscripten-releases/llvm-project/lld/wasm/SyntheticSections.cpp:468:
virtual void lld::wasm::LinkingSection::writeBody(): Assertion
`isec->getComdatName() == comdat' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: /home/empd/src/emsdk/upstream/bin/wasm-ld
@/tmp/emscripten_6AmlHz.rsp 
 #0 0x00007fa590cc08c4 PrintStackTraceSignalHandler(void*)
(/home/empd/src/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x7df8c4)
 #1 0x00007fa590cbe50e llvm::sys::RunSignalHandlers()
(/home/empd/src/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x7dd50e)
 #2 0x00007fa590cc0a85 SignalHandler(int)
(/home/empd/src/emsdk/upstream/bin/../lib/libLLVM-11git.so+0x7dfa85)
 #3 0x00007fa5940fb730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x00007fa5901ba7bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb)
 #5 0x00007fa5901a5535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535)
 #6 0x00007fa5901a540f (/lib/x86_64-linux-gnu/libc.so.6+0x2240f)
 #7 0x00007fa5901b3102 (/lib/x86_64-linux-gnu/libc.so.6+0x30102)
 #8 0x000000000078b4e2 lld::wasm::LinkingSection::writeBody()
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x78b4e2)
 #9 0x000000000077ccaa lld::wasm::SyntheticSection::finalizeContents()
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x77ccaa)
#10 0x0000000000776aa8 lld::wasm::(anonymous namespace)::Writer::run()
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x776aa8)
#11 0x000000000076fda1 lld::wasm::writeResult()
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x76fda1)
#12 0x0000000000754198 lld::wasm::(anonymous
namespace)::LinkerDriver::link(llvm::ArrayRef<char const*>)
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x754198)
#13 0x000000000074e6a7 lld::wasm::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&, llvm::raw_ostream&)
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x74e6a7)
#14 0x0000000000487021 main
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x487021)
#15 0x00007fa5901a709b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#16 0x0000000000486aaa _start
(/home/empd/src/emsdk/upstream/bin/wasm-ld+0x486aaa)
em++: error: '/home/empd/src/emsdk/upstream/bin/wasm-ld
@/tmp/emscripten_6AmlHz.rsp' failed (-6)
make[3]: *** [Makefile:737: Gem.la] Error 1
```

To reproduce, on a system with `debootstrap`:

```
# on host system
sudo mkdir empd
sudo debootstrap --variant minbase buster empd/
sudo chroot empd/ /bin/bash
# inside chroot
mount -t proc proc /proc
mount -t tmpfs tmpfs /dev/shm/
apt install sudo git-core python2.7 nodejs build-essential cmake default-jre
llvm clang autoconf automake libtool pkg-config
adduser --add_extra_groups empd
adduser empd sudo
su - empd
# as empd user
mkdir tmp
cd tmp/
git clone <a href="https://github.com/juj/emsdk.git">https://github.com/juj/emsdk.git</a>
cd emsdk/
./emsdk install latest
./emsdk activate latest
. ./emsdk_env.sh 
cd ..
git clone --recursive <a href="https://github.com/claudeha/libpd.git">https://github.com/claudeha/libpd.git</a>
cd libpd
git checkout emscripten
cd pure-data
git remote add claudeha <a href="https://github.com/claudeha/pure-data.git">https://github.com/claudeha/pure-data.git</a>
git fetch claudeha
git checkout claudeha/emscripten
cd ..
mkdir build
cd build
emcmake cmake .. -DPD_UTILS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release
emmake make
cd ../../
git clone <a href="https://github.com/claudeha/Gem.git">https://github.com/claudeha/Gem.git</a>
cd Gem/
git checkout emscripten
./autogen.sh 
CXXFLAGS="-s USE_REGAL=1 -DREGAL_LOG=1 -DREGAL_LOG_ALL=1 -DREGAL_LOG_ONCE=1 -s
USE_SDL=2 -s LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0" CFLAGS="-s
USE_REGAL=1 -DREGAL_LOG=1 -DREGAL_LOG_ALL=1 -DREGAL_LOG_ONCE=1 -s USE_SDL=2 -s
LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0" EMMAKEN_CFLAGS="-s
USE_REGAL=1 -DREGAL_LOG=1 -DREGAL_LOG_ALL=1 -DREGAL_LOG_ONCE=1 -s USE_SDL=2 -s
LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0" GL_CFLAGS="-s
USE_REGAL=1 -DREGAL_LOG=1 -DREGAL_LOG_ALL=1 -DREGAL_LOG_ONCE=1 -s USE_SDL=2 -s
LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0" GL_LIBS="-s USE_REGAL=1
-s USE_SDL=2 -s LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0"
GLU_CFLAGS="-s USE_REGAL=1 -DREGAL_LOG=1 -DREGAL_LOG_ALL=1 -DREGAL_LOG_ONCE=1
-s USE_SDL=2 -s LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0"
GLU_LIBS="-s USE_REGAL=1 -s USE_SDL=2 -s LEGACY_GL_EMULATION=0 -s
ERROR_ON_UNDEFINED_SYMBOLS=0"  LIBS="-s USE_REGAL=1 -s USE_SDL=2 -s
LEGACY_GL_EMULATION=0 -s ERROR_ON_UNDEFINED_SYMBOLS=0" emconfigure ./configure
--prefix=${HOME}/opt --with-pd=${HOME}/src/libpd/pure-data/src --without-ALL
--disable-multicontext --without-glew --without-glewmx --without-glut
emmake make -j $(nproc) -k
emmake make
```</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>