Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <abort_> Hi
- <abort_> I'm trying to fill a bug report to the project
- <abort_> but I can't even register on the bugtracking system
- <abort_> because you have to send first an email somewhere, I already did that
- <abort_> but in the meantime perhaps someone can help me with my problem:
- <abort_> I'm trying to compile some stuff with emscripten to webassembly
- <abort_> emscripten uses LLVM as a backedn to generate WASM
- <abort_> nad links stuff with wasm-ld
- <abort_> but I'm seeing this error on several different projects now:
- <abort_> wasm-ld: /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/include/llvm/Support/Casting.h:264: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = lld::wasm::FunctionSymbol, Y = const lld::wasm::Symbol]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
- <abort_> Stack dump:
- <abort_> 0. Program arguments: /src/emsdk/emsdk/upstream/bin/wasm-ld -o libf2c.bc --allow-undefined --lto-O0 f77vers.o i77vers.o -L/src/emsdk/emsdk/upstream/emscripten/system/local/lib s_rnge.o -L/src/emsdk/emsdk/upstream/emscripten/system/lib abort_.o -L/src/emsdk/emsdk/.emscripten_cache/wasm-obj exit_.o getarg_.o iargc_.o getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o ctype.o derf_.o derfc_.o erf_.o erfc_.o sig_die.o uninit.o pow_ci.o
- <abort_> pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o r_cosh.o r_dim.o r_exp.o r_imag.o r_int.o r_lg10.o r_log.o r_mod.o r_nint.o r_sign.o r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o d_cnjg.o d_cos.o d_cosh.o
- <abort_> d_dim.o d_exp.o d_imag.o d_int.o d_lg10.o d_log.o d_mod.o d_nint.o d_prod.o d_sign.o d_sin.o d_sinh.o d_sqrt.o d_tan.o d_tanh.o i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_len_trim.o i_mod.o i_nint.o i_sign.o lbitbits.o lbitshft.o i_ceiling.o h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o h_nint.o h_sign.o l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o ef1asc_.o ef1cmc_.o f77_aloc.o s_cat.o s_cmp.o s_copy.o backspac.o
- <abort_> close.o dfe.o dolio.o due.o endfile.o err.o fmt.o fmtlib.o ftell_.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o dtime_.o etime_.o --import-memory --import-table -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export __wasm_call_ctors --export __data_end --export main
- <abort_> --export malloc --export free --export setThrew --export __errno_location --export fflush -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024 --relocatable
- <abort_> #0 0x00007f1dcc7cb0b4 PrintStackTraceSignalHandler(void*) (/src/emsdk/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x7000b4)
- <abort_> #1 0x00007f1dcc7c8e3e llvm::sys::RunSignalHandlers() (/src/emsdk/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x6fde3e)
- <abort_> #2 0x00007f1dcc7cb368 SignalHandler(int) (/src/emsdk/emsdk/upstream/bin/../lib/libLLVM-10svn.so+0x700368)
- <abort_> #3 0x00007f1dcf7528e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128e0)
- <abort_> #4 0x00007f1dcbc12f3b raise (/lib/x86_64-linux-gnu/libc.so.6+0x35f3b)
- <abort_> #5 0x00007f1dcbc142f1 abort (/lib/x86_64-linux-gnu/libc.so.6+0x372f1)
- <abort_> #6 0x00007f1dcbc0ba8a (/lib/x86_64-linux-gnu/libc.so.6+0x2ea8a)
- <abort_> #7 0x00007f1dcbc0bb02 (/lib/x86_64-linux-gnu/libc.so.6+0x2eb02)
- <abort_> #8 0x00000000006e19f0 lld::wasm::GlobalSection::writeBody() (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6e19f0)
- <abort_> #9 0x00000000006d22aa lld::wasm::SyntheticSection::finalizeContents() (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6d22aa)
- <abort_> #10 0x00000000006cc638 (anonymous namespace)::Writer::run() (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6cc638)
- <abort_> #11 0x00000000006c51a1 lld::wasm::writeResult() (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6c51a1)
- <abort_> #12 0x00000000006a79bd (anonymous namespace)::LinkerDriver::link(llvm::ArrayRef<char const*>) (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6a79bd)
- <abort_> #13 0x00000000006a24d8 lld::wasm::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&) (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x6a24d8)
- <abort_> #14 0x000000000041f45b main (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x41f45b)
- <abort_> #15 0x00007f1dcbbffb17 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x22b17)
- <abort_> #16 0x000000000041efe9 _start (/src/emsdk/emsdk/upstream/bin/wasm-ld+0x41efe9)
- <LebedevRI> yeah, maybe don't actually paste the entire backtrace into irc
- <AaronBallman> please do not put large pastes into the chat like that, use something like pastebin
- <abort_> sorry
- <AaronBallman> it happens :-)
- <abort_> I'm building llvm to see if I can debug the issue
- <abort_> but I have no clue about what it could be
- <LebedevRI> best to follow the guidelines stated on how to receive account
- <abort_> yes they tell you to send an email to request an account to some address
- <abort_> I already did that
- <jrtc27> else if (auto *f = cast<DefinedFunction>(sym))
- <jrtc27> change that to a dyn_cast, obviously broken
- <jrtc27> well, maybe the code does expect it to be one of the two, but it's written in a very misleading way if so
- <abort_> I'm not an expert in C++ and much less in cryptic c++ templates
- <abort_> :(
- <abort_> this is the code in Casting.h:264
- <abort_> only fouur lines)
- <abort_> template <class X, class Y>
- <abort_> inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
- <abort_> assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
- <abort_> return cast_convert_val<X, Y*,
- <abort_> typename simplify_type<Y*>::SimpleType>::doit(Val);
- <abort_> }
- <LebedevRI> you want to look at lld::wasm::GlobalSection::writeBody()
- <jrtc27> I mean lld/wasm/SyntheticSections.cpp's GlobalSection::writeBody
- <abort_> yes I also opened that
- <abort_> ok
- <jrtc27> "cast" is a "do the cast and abort if wrong", "dyn_cast" is a "do the cast and return null if wrong"
- <abort_> lets see
- <jrtc27> so checking the result of "cast" for null is a code smell
- <jrtc27> given your --allow-undefined I suspect that there's an UndefinedFunction or something in gotSymbols
- <jrtc27> but I don't know wasm linking, only ELF
- <abort_> I'll try to change that line
- <abort_> just to see what happens
- <abort_> the issue appears with very different codebases
- <abort_> I have seen it with sqlite, with lz4 and now with this (libf2c)
- <abort_> its a fortran to c transpiler
- <abort_> well, the "runtime"/support library
- <abort_> that's why I'm guessing it's a problem with llvm and not with my build setup
- <abort_> also it didn't happen in the previous versions
- <abort_> yup
- <abort_> that line was added in a very recent commit
- <abort_> It looks like the guy wrongly wrote "cast" instead of "dyn_cast" as you said
- <abort_> because in the previous line he does use dyn_cast
- <abort_> :DDD
- <abort_> thanks a lot guys
Advertisement
Add Comment
Please, Sign In to add comment