Open llvmbot opened 6 years ago
mentioned in issue llvm/llvm-bugzilla-archive#49196
mentioned in issue llvm/llvm-bugzilla-archive#47120
Bug llvm/llvm-bugzilla-archive#49196 has been marked as a duplicate of this bug.
Bug llvm/llvm-bugzilla-archive#47120 has been marked as a duplicate of this bug.
Yes, nobody has implemented either codeview or Windows EH support for 32-bit Windows ARM, and I believe nobody is actively working on it.
For ARM64 --target=aarch64-pc-windows-msvc works since LLVM 8.0, but --target=arm-pc-windows-msvc still not: with LLVM 10 SVN r372920 (26 September 2019) on https://llvm.org/builds/ clang-cl still crashed with fatal error: error in backend: target does not implement codeview register mapping
I'm not too surprised about the issue with the cleanupret
. The MS ABI C++ handling hasn't been exercised as heavily as the itanium ABI. It certainly would be nice to get more extensive testing for that ABI.
For reference, the AArch64 patches: https://reviews.llvm.org/D50166 , https://reviews.llvm.org/D50288 , https://reviews.llvm.org/D51524 .
The original error I received when trying to compile rust code was:
LLVM ERROR: Cannot select: t10: ch = cleanupret t9 In function: ZN4core3str21$LT$impl$u20$str$GT$4trim17h079b395f396c992aE
I then enabled some debugging options in the rust build system, which resulted in the following error:
LLVM ERROR: target does not implement codeview register mapping
It turns out the options I enabled caused -g to be passed to the rust compiler, which caused it to try to emit debugging info. If I remove the -g option, I'm back to the original error (cannot select cleanupret).
I can repro the 'cannot select cleanupret' error by compiling C++ code with a destructor.
#include <stdio.h>
#include <memory>
#include <stdexcept>
struct meow {
~meow()
{
printf("Farewell, cruel world\n");
}
int a;
};
int main()
{
meow a;
printf("Hello\n");
auto b = new meow; // might throw
printf("Goodbye\n");
return 0;
}
So I think if I implement support for the 'cleanupret' instruction on ARM, that should be sufficient to compile the rust code.
"target does not implement codeview register mapping" is related to debug info, not exception handling; you should be able to avoid this by disabling debug info, or emitting DWARF debug info.
The documentation for the ARM exception-handling tables was published recently; see https://docs.microsoft.com/en-us/cpp/build/arm-exception-handling .
The LLVM patches for AArch64 EH support should be posted in the next few weeks; they could probably serve as a model for the required changes for ARM if someone were interested.
I don't think anyone is working on WinEH for ARM or AArch64 right now.
Fixing this requires implementing the .xdata unwind codes for ARM and AArch64. There was some recent discussion of an AArch64 implementation on llvm-dev, but not ARM.
Clicked 'Submit' too early --
I ran into the following error when trying to compile C++ code containing a try/catch block for arm-pc-windows-msvc target: fatal error: error in backend: Funclet EH is not implemented for this target
My end goal is to compile Rust code for windows/arm. When I try to compile Rust code for Windows/ARM, I receive the following error: LLVM ERROR: target does not implement codeview register mapping
I believe both of these errors stem from lack of EH exception support for windows/ARM, but please correct me if I'm wrong. My understanding is that once the C++ code compiles, the Rust code will also work.
Is anyone familiar with EH support and willing to work with me to implement this feature?
The preprocessed source is available here: https://gist.githubusercontent.com/jordanrh1/74b0702c6e13aff8fcb486388672e732/raw/5e0137b6aef0860f9d2c4c589ae5477af8a7c514/clang_except_test-c25954.cpp
Extended Description
clang++ --target=arm-pc-windows-msvc -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE -v -o test.exe clang_except_test.cpp clang version 6.0.0 (tags/RELEASE_600/final) Target: arm-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\LLVM\bin "C:\Program Files\LLVM\bin\clang++.exe" -cc1 -triple thumbv7-pc-windows-msvc19.11.25547 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name clang_except_test.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu cortex-a9 -target-feature +strict-align -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -v -resource-dir "C:\Program Files\LLVM\lib\clang\6.0.0" -D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE -internal-isystem "C:\Program Files\LLVM\lib\clang\6.0.0\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" -fdeprecated-macro -fdebug-compilation-dir "d:\work\rust" -ferror-limit 19 -fmessage-length 80 -backend-option -arm-restrict-it -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25547 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -fcolor-diagnostics -o "C:\Users\jordanrh\AppData\Local\Temp\clang_except_test-8cb11c.o" -x c++ clang_except_test.cpp clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target x86_64-pc-windows-msvc
include "..." search starts here:
include <...> search starts here:
C:\Program Files\LLVM\lib\clang\6.0.0\include C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt End of search list. fatal error: error in backend: Funclet EH is not implemented for this target clang++.exe: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 6.0.0 (tags/RELEASE_600/final) Target: arm-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\LLVM\bin clang++.exe: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang++.exe: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang++.exe: note: diagnostic msg: C:\Users\jordanrh\AppData\Local\Temp\clang_except_test-c25954.cpp clang++.exe: note: diagnostic msg: C:\Users\jordanrh\AppData\Local\Temp\clang_except_test-c25954.sh clang++.exe: note: diagnostic msg:
make: *** [Makefile:4: test.exe] Error 70