Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to compile with 3.0.1-git and -fwasm-exceptions fails with clang error #15712

Closed
yowl opened this issue Dec 4, 2021 · 8 comments
Closed
Assignees

Comments

@yowl
Copy link

yowl commented Dec 4, 2021

Using this command line (i've added the new lines)

E:\GitHub\emsdk\upstream\emscripten\emcc.bat "E:\GitHub\runtimelab\artifacts\tests\coreclr\Browser.wasm.Debug\nativeaot\SmokeTests\Exceptions\Exceptions\native\Exceptions.bc" \
-c -o "E:\GitHub\runtimelab\artifacts\tests\coreclr\Browser.wasm.Debug\nativeaot\SmokeTests\Exceptions\Exceptions\native\Exceptions.o" \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 -g -fwasm-exceptions

Produces the error

shared:INFO: (Emscripten: Running sanity checks)
emcc: warning: linker setting ignored during compilation: 'ERROR_ON_UNDEFINED_SYMBOLS' [-Wunused-command-line-argument]
fatal error: error in backend: -wasm-enable-eh only allowed with -exception-model=wasm
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: E:/GitHub/emsdk/upstream/bin\\clang++.exe -target wasm32-unknown-emscripten -DEMSCRIPTEN -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=1 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=E:\\GitHub\\emsdk\\upstream\\emscripten\\cache\\sysroot -Xclang -iwithsysroot/include\\compat -c -g -fwasm-exceptions E:\\GitHub\\runtimelab\\artifacts\\tests\\coreclr\\Browser.wasm.Debug\\nativeaot\\SmokeTests\\Exceptions\\Exceptions\\native\\Exceptions.bc -o E:\\GitHub\\runtimelab\\artifacts\\tests\\coreclr\\Browser.wasm.Debug\\nativeaot\\SmokeTests\\Exceptions\\Exceptions\\native\\Exceptions.o
 #0 0x00007ffd9d504f69 (C:\WINDOWS\System32\KERNELBASE.dll+0x34f69)
 #1 0x00007ff75f380d4a (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x610d4a)
#2 0x00007ff75f3b7d09 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x647d09)
 #3 0x00007ff75ed78191 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x8191)
 #4 0x00007ff75f381f3d (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x611f3d)
 #5 0x00007ff75f381e05 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x611e05)
 #6 0x00007ff75edd0c8d (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x60c8d)
 #7 0x00007ff75f6bbb9b (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x94bb9b)
 #8 0x00007ff75f69317d (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x92317d)
 #9 0x00007ff75ff5d942 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x11ed942)
#10 0x00007ff75ff571be (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x11e71be)
#11 0x00007ff76032df14 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x15bdf14)
#12 0x00007ff76029d534 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x152d534)
#13 0x00007ff75f506a93 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x796a93)
#14 0x00007ff75f595ceb (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x825ceb)
#15 0x00007ff75ed77ec3 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x7ec3)
#16 0x00007ff75ed74cf4 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x4cf4)
#17 0x00007ff7600619a6 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x12f19a6)
#18 0x00007ff75f380b92 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x610b92)
#19 0x00007ff760061631 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x12f1631)
#20 0x00007ff75f4cc1e5 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x75c1e5)
#21 0x00007ff75f4cc6cb (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x75c6cb)
#22 0x00007ff75f4e1a57 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x771a57)
#23 0x00007ff75ed74505 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x4505)
#24 0x00007ff76243cd54 (E:\GitHub\emsdk\upstream\bin\clang++.exe+0x36ccd54)
#25 0x00007ffd9f5a7034 (C:\WINDOWS\System32\KERNEL32.DLL+0x17034)
#26 0x00007ffd9fbc2651 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x52651)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project 5d49511b3058cac17eb80d243d3e2ad5cb0cddb9)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: E:\GitHub\emsdk\upstream\bin
clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
emcc: error: 'E:/GitHub/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -DEMSCRIPTEN -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=1 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=E:\GitHub\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -c -g -fwasm-exceptions E:\GitHub\runtimelab\artifacts\tests\coreclr\Browser.wasm.Debug\nativeaot\SmokeTests\Exceptions\Exceptions\native\Exceptions.bc -o E:\GitHub\runtimelab\artifacts\tests\coreclr\Browser.wasm.Debug\nativeaot\SmokeTests\Exceptions\Exceptions\native\Exceptions.o' failed (returned 70)

It is because I start with llvm bitcode?

@sbc100
Copy link
Collaborator

sbc100 commented Dec 5, 2021

This looks like it might be related to #15370. Are you using 3.0.0 (the first version with the fix that issue) or above?

@sbc100
Copy link
Collaborator

sbc100 commented Dec 5, 2021

It looks like the issue relates to -exception-model=wasm not being set when compiling from bitcode with -fwasm-exceptions.

@aheejin, when we do linking we do pass -mllvm -exception-model=wasm .. should that moved to llvm_backend_args() so its passed at compile time too?

@yowl
Copy link
Author

yowl commented Dec 5, 2021

Thanks for looking this is 3.0.1-git

@yowl
Copy link
Author

yowl commented Dec 5, 2021

You can reproduce this more easily with

emcc -fwasm-exceptions  f:\1.ll

where 1.ll is

; ModuleID = '/mnt/e/1.bc'
source_filename = "e:\\1.c"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-emscripten"

define hidden i32 @main() #0 {

ret:
  ret i32 0
}

@yowl
Copy link
Author

yowl commented Dec 5, 2021

Its a bit strange, clang++ --help makes no mention of wasm-enable-eh or exception-model. clang++ from upstream\bin is clang version 14.0.0 (https://github.com/llvm/llvm-project 5d49511b3058cac17eb80d243d3e2ad5cb0cddb9)

@aheejin
Copy link
Member

aheejin commented Dec 17, 2021

Thanks for the report! I fixed this in LLVM, so I think you can try this with emsdk install tot soon. It usually takes several hours for LLVM commits to roll out to emsdk. We are planning to do a new release within a few days, so after that, you can also use emsdk install latest.

@yowl
Copy link
Author

yowl commented Dec 17, 2021

Thank you very much.

@yowl
Copy link
Author

yowl commented Dec 18, 2021

Yep, that now passes command line checks. Fails with my input with

Assertion failed: R == 0 && "Already initialized this value register!", file C:\b\s\w\ir\cache\builder\emscripten-releases\llvm-project\llvm\include\llvm/CodeGen/FunctionLoweringInfo.h, line 209

but I'll have to try to get a repro for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants