<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 - Error in WasmObjectWriter : Assertion `Sec.getKind().isMetadata()' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=42510">42510</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error in WasmObjectWriter : Assertion `Sec.getKind().isMetadata()' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Backend: WebAssembly
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi, 

Enabling -pthread as a CFLAG in our build system causes a crash in clang-9. I
will give the trace and source file with the run script. More details to come
in the comments.

Trace:
clang-9:
/b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/MC/WasmObjectWriter.cpp:1293:
virtual uint64_t (anonymous
namespace)::WasmObjectWriter::writeObject(llvm::MCAssembler &, const
llvm::MCAsmLayout &): Assertion `Sec.getKind().isMetadata()' failed.
Stack dump:
0.      Program arguments:
/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9 -cc1 -triple
wasm32-unknown-emscripten -emit-obj -mrelax-all -disable-free -main-file-name
interrupt.c -mrelocation-model static -mthread-model posix
-menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math
-fno-trapping-math -masm-verbose -mconstructor-aliases -fuse-init-array
-target-feature +atomics -target-cpu generic -dwarf-column-info
-debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file
/home/b1ue/vlc/vlc/build-em/src/misc/interrupt.gcno -nostdsysteminc
-nobuiltininc -resource-dir
/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/lib/clang/9.0.0 -dependency-file
misc/.deps/interrupt.Tpo -sys-header-deps -MP -MT misc/interrupt.lo -D
__EMSCRIPTEN_major__=1 -D __EMSCRIPTEN_minor__=38 -D __EMSCRIPTEN_tiny__=37 -D
_LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -D HAVE_CONFIG_H -I . -I
../../src -I .. -D MODULE_STRING="core" -D SYSDATADIR="/usr/local/share" -D
LIBDIR="/usr/local/lib" -D LIBEXECDIR="/usr/local/libexec" -D
LOCALEDIR="/usr/local/share/locale" -D PKGDATADIR="/usr/local/share/vlc" -D
PKGLIBDIR="/usr/local/lib/vlc" -D PKGLIBEXECDIR="/usr/local/libexec/vlc" -I
../../include -I ../include -I
/home/b1ue/vlc/vlc/contrib/wasm32-unknown-emscripten/include -D __NEED_ssize_t
-I /home/b1ue/vlc/vlc/contrib/wasm32-unknown-emscripten/include -D
__EMSCRIPTEN_PTHREADS__=1 -Werror=implicit-function-declaration
-Werror=unknown-warning-option -Werror=invalid-command-line-argument -Wall
-Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat
-Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes
-Werror-implicit-function-declaration -Winit-self -fconst-strings
-fdebug-compilation-dir /home/b1ue/vlc/vlc/build-em/src -ferror-limit 19
-fmessage-length 0 -fvisibility hidden -funroll-loops -pthread -stack-protector
2 -fobjc-runtime=gnustep -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -nobuiltininc -nostdsysteminc
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/include/libcxx
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/lib/libcxxabi/include
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/include/compat
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/include
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/include/libc
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/local/include
-isystem/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/emscripten/system/include/SDL
-mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj
-mllvm -disable-lsr -o misc/interrupt.o -x c ../../src/misc/interrupt.c 
1.      <eof> parser at end of file
2.      Code generation
 #0 0x00007fddcea3d3e4 PrintStackTraceSignalHandler(void*)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x6b13e4)
 #1 0x00007fddcea3b0de llvm::sys::RunSignalHandlers()
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x6af0de)
 #2 0x00007fddcea3d698 SignalHandler(int)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x6b1698)
 #3 0x00007fddd17bbcb0 __restore_rt (/usr/lib/libpthread.so.0+0x13cb0)
 #4 0x00007fddcdebb755 __GI_raise (/usr/lib/libc.so.6+0x3a755)
 #5 0x00007fddcdea6851 __GI_abort (/usr/lib/libc.so.6+0x25851)
 #6 0x00007fddcdea6727 _nl_load_domain.cold (/usr/lib/libc.so.6+0x25727)
 #7 0x00007fddcdeb4026 (/usr/lib/libc.so.6+0x33026)
 #8 0x00007fddcfce5c16 (anonymous
namespace)::WasmObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout
const&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x1959c16)
 #9 0x00007fddcfc94706 llvm::MCAssembler::Finish()
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x1908706)
#10 0x00007fddcf20e45c llvm::AsmPrinter::doFinalization(llvm::Module&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0xe8245c)
#11 0x00007fddceb88645 llvm::FPPassManager::doFinalization(llvm::Module&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x7fc645)
#12 0x00007fddceb88c96 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/../lib/libLLVM-9svn.so+0x7fcc96)
#13 0x0000000000652ddc clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0x652ddc)
#14 0x0000000000d6b025
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0xd6b025)
#15 0x00000000012fecf3 clang::ParseAST(clang::Sema&, bool, bool)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0x12fecf3)
#16 0x0000000000b642f0 clang::FrontendAction::Execute()
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0xb642f0)
#17 0x0000000000b094f1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0xb094f1)
#18 0x0000000000bff12d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0xbff12d)
#19 0x0000000000612034 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0x612034)
#20 0x0000000000610084 main
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0x610084)
#21 0x00007fddcdea7ee3 __libc_start_main (/usr/lib/libc.so.6+0x26ee3)
#22 0x000000000060d329 _start
(/home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin/clang-9+0x60d329)
clang-9: error: unable to execute command: Aborted (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0
(/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project
922759a63d7d8edbc47578b4718a38765093d24e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/b1ue/b1ue/workdir_vlc/emsdk/upstream/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/interrupt-32bf76.c
clang-9: note: diagnostic msg: /tmp/interrupt-32bf76.sh
clang-9: note: diagnostic msg: 

********************</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>