Skip to content

lldwasm: Reporting stack dump due to lld crash #114651

Closed as not planned
Closed as not planned
@anutosh491

Description

@anutosh491
  1. I am building an executable against emscripten
  2. I am making this call target_link_libraries(target PUBLIC ... clangCppInterOp ....)

Now how clangCppInterOp is framed is
i) We basically unzip and extract object file out of these using ar/emar x libs

clangInterpreter;lldWasm;clangAST;clangAnalysis;clangBasic;clangCodeGen;clangDriver;clangFrontend;clangFrontendTool;clangLex;clangParse;clangSema;clangSerialization;LLVMCore;LLVMMC;LLVMOption;LLVMOrcJIT;LLVMOrcDebugging;LLVMOrcShared;LLVMOrcTargetProcess;LLVMSupport;LLVMTarget;LLVMTargetParser;LLVMWebAssemblyCodeGen;LLVMWebAssemblyAsmParser;LLVMWebAssemblyDesc;LLVMWebAssemblyDisassembler;LLVMWebAssemblyInfo;LLVMWebAssemblyUtils;lldCommon;LLVMBinaryFormat;LLVMDemangle;LLVMLTO;LLVMObject;LLVMPasses;LLVMFrontendOpenMP;clangASTMatchers;LLVMAggressiveInstCombine;LLVMAnalysis;LLVMBitReader;LLVMBitWriter;LLVMCodeGenTypes;LLVMCoroutines;LLVMCoverage;LLVMExtensions;LLVMFrontendDriver;LLVMFrontendHLSL;LLVMFrontendOffloading;LLVMHipStdPar;LLVMipo;LLVMIRPrinter;LLVMIRReader;LLVMInstCombine;LLVMInstrumentation;LLVMLinker;LLVMObjCARCOpts;LLVMProfileData;LLVMScalarOpts;LLVMTransformUtils;LLVMWindowsDriver;clangAPINotes;clangEdit;LLVMBitstreamReader;clangExtractAPI;clangRewriteFrontend;clangARCMigrate;clangStaticAnalyzerFrontend;LLVMMCParser;clangSupport;LLVMRemarks;LLVMDebugInfoCodeView;LLVMExecutionEngine;LLVMJITLink;LLVMRuntimeDyld;LLVMDebugInfoDWARF;LLVMAsmPrinter;LLVMCodeGen;LLVMSelectionDAG;LLVMMCDisassembler;LLVMTextAPI;LLVMCFGuard;LLVMVectorize;LLVMAsmParser;LLVMSymbolize;clangIndex;clangInstallAPI;clangRewrite;clangCrossTU;clangStaticAnalyzerCheckers;clangStaticAnalyzerCore;LLVMDebugInfoPDB;LLVMDebugInfoBTF;clangFormat;clangToolingCore;LLVMTextAPIBinaryReader;LLVMDebugInfoMSF;clangToolingInclusions, LLVMSupport

All these are static libraries obtained from a wasm build for llvm

ii) Then we club these into a final libclangCppInterOp.a using ar/emar qc ...

Now when i move onto my executable using clangCppInterOp (linking with it) .... although the build works I end up getting this error. It says maybe reporting the crash would help

[100%] Linking CXX executable xcpp.js
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/wasm-ld -o xcpp.wasm --whole-archive CMakeFiles/xcpp.dir/src/main_emscripten_kernel.cpp.o /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libxeus-lite.a libxeus-cpp.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libxeus.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libclangCppInterOp.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libpugixml.a -L/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -lembind-rtti -lGL -lal -lhtml5 -lstubs -lc-asan -ldlmalloc -lcompiler_rt -lc++ -lc++abi -lsockets -lasan_rt -lasan_js -lubsan_rt -llsan_common_rt -lsanitizer_common_rt --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export-if-defined=setThrew --export-if-defined=malloc --export-if-defined=__errno_location --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=memcpy --export-if-defined=free --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=emscripten_builtin_malloc --export-if-defined=emscripten_builtin_free --export-if-defined=emscripten_builtin_memalign --export-if-defined=__cxa_is_pointer_type --export-if-defined=setTempRet0 --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=__get_exception_message --export-if-defined=fileno --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=sleep --export-if-defined=__getTypeName /var/folders/m1/cdn74f917994jd99d_2cpf440000gn/T/tmpzt4d3u33libemscripten_js_symbols.so --import-undefined --import-memory --strip-debug --export-dynamic --export-if-defined=main --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_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__errno_location --export-if-defined=memalign --export-if-defined=emscripten_builtin_memalign --export-if-defined=emscripten_builtin_malloc --export-if-defined=emscripten_builtin_free --export-if-defined=_asan_c_load_1 --export-if-defined=_asan_c_load_1u --export-if-defined=_asan_c_load_2 --export-if-defined=_asan_c_load_2u --export-if-defined=_asan_c_load_4 --export-if-defined=_asan_c_load_4u --export-if-defined=_asan_c_load_f --export-if-defined=_asan_c_load_d --export-if-defined=_asan_c_store_1 --export-if-defined=_asan_c_store_1u --export-if-defined=_asan_c_store_2 --export-if-defined=_asan_c_store_2u --export-if-defined=_asan_c_store_4 --export-if-defined=_asan_c_store_4u --export-if-defined=_asan_c_store_f --export-if-defined=_asan_c_store_d --export-if-defined=__funcs_on_exit --export-if-defined=malloc --export-if-defined=free --export-if-defined=__cxa_is_pointer_type --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=setThrew --export-if-defined=__cxa_free_exception --export-if-defined=__wasm_call_ctors --experimental-pic -pie -z stack-size=67108864 --initial-memory=575275008 --max-memory=2147483648 --no-entry
 #0 0x0000000102365e50 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100125e50)
 #1 0x0000000102363e60 llvm::sys::RunSignalHandlers() (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100123e60)
 #2 0x0000000102366a24 SignalHandler(int) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100126a24)
 #3 0x0000000195057584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
 #4 0x00000001026bc38c lld::wasm::ElemSection::writeBody() (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x10047c38c)
 #5 0x00000001026d4454 lld::wasm::SyntheticSection::finalizeContents() (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100494454)
 #6 0x00000001026d0330 lld::wasm::(anonymous namespace)::Writer::run() (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100490330)
 #7 0x00000001026c7174 lld::wasm::writeResult() (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100487174)
 #8 0x00000001026960b8 lld::wasm::(anonymous namespace)::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x1004560b8)
 #9 0x00000001026921ac lld::wasm::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x1004521ac)
#10 0x0000000102377144 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100137144)
#11 0x00000001022c156c lld_main(int, char**, llvm::ToolContext const&) (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x10008156c)
#12 0x00000001022c1bf0 main (/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/lld+0x100081bf0)
#13 0x0000000194c9e0e0 
em++: error: '/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/bin/wasm-ld -o xcpp.wasm --whole-archive CMakeFiles/xcpp.dir/src/main_emscripten_kernel.cpp.o /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libxeus-lite.a libxeus-cpp.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libxeus.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libclangCppInterOp.a /Users/anutosh491/micromamba/envs/xeus-cpp-wasm-host/lib/libpugixml.a -L/Users/anutosh491/micromamba/envs/xeus-cpp-wasm-build/lib/python3.13/site-packages/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -lembind-rtti -lGL -lal -lhtml5 -lstubs -lc-asan -ldlmalloc -lcompiler_rt -lc++ -lc++abi -lsockets -lasan_rt -lasan_js -lubsan_rt -llsan_common_rt -lsanitizer_common_rt --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export-if-defined=setThrew --export-if-defined=malloc --export-if-defined=__errno_location --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=memcpy --export-if-defined=free --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=emscripten_builtin_malloc --export-if-defined=emscripten_builtin_free --export-if-defined=emscripten_builtin_memalign --export-if-defined=__cxa_is_pointer_type --export-if-defined=setTempRet0 --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=__get_exception_message --export-if-defined=fileno --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=sleep --export-if-defined=__getTypeName /var/folders/m1/cdn74f917994jd99d_2cpf440000gn/T/tmpzt4d3u33libemscripten_js_symbols.so --import-undefined --import-memory --strip-debug --export-dynamic --export-if-defined=main --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_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=fflush --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__errno_location --export-if-defined=memalign --export-if-defined=emscripten_builtin_memalign --export-if-defined=emscripten_builtin_malloc --export-if-defined=emscripten_builtin_free --export-if-defined=_asan_c_load_1 --export-if-defined=_asan_c_load_1u --export-if-defined=_asan_c_load_2 --export-if-defined=_asan_c_load_2u --export-if-defined=_asan_c_load_4 --export-if-defined=_asan_c_load_4u --export-if-defined=_asan_c_load_f --export-if-defined=_asan_c_load_d --export-if-defined=_asan_c_store_1 --export-if-defined=_asan_c_store_1u --export-if-defined=_asan_c_store_2 --export-if-defined=_asan_c_store_2u --export-if-defined=_asan_c_store_4 --export-if-defined=_asan_c_store_4u --export-if-defined=_asan_c_store_f --export-if-defined=_asan_c_store_d --export-if-defined=__funcs_on_exit --export-if-defined=malloc --export-if-defined=free --export-if-defined=__cxa_is_pointer_type --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=setThrew --export-if-defined=__cxa_free_exception --export-if-defined=__wasm_call_ctors --experimental-pic -pie -z stack-size=67108864 --initial-memory=575275008 --max-memory=2147483648 --no-entry' failed (received SIGSEGV (-11))
make[2]: *** [xcpp.js] Error 1
make[1]: *** [CMakeFiles/xcpp.dir/all] Error 2
make: *** [all] Error 2
emmake: error: 'make install' failed (returned 2)

Not sure what might be the reason behind this !

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]lld:wasmworksformeResolved as "works for me"

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions