<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60691>60691</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLVM JIT on Windows ARM32 (thumbv7-pc-win32)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          driver1998
      </td>
    </tr>
</table>

<pre>
    I am trying to bootstrap Mesa llvmpipe on Windows on ARM, so far ARM64 is working just fine.

But on ARM32 it doesn't seem to work.

A reduced repro (tested on ARM64 machine, LLVM 15.0.7):
```
$ cat test.ll
; test.ll
define i32 @main() {
 ret i32 42
}

$ lli test.ll
error: Function 'main' uses ARM instructions, but the target does not support ARM mode execution.

$ /d/install/bin/lli --march=thumbv7 test.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: D:\\install\\bin\\lli.exe --march=thumbv7 test.ll
Exception Code: 0xC0000005
#0 0x1fce1000
#1 0x003ffb72 llvm::orc::runAsMain(int (*)(int, char**), llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::Optional<llvm::StringRef>) D:/llvm-project-15.0.7.src/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp:39:10
#2 0x000f5066 runOrcJIT(char const*) D:/llvm-project-15.0.7.src/llvm/tools/lli/lli.cpp:1153:14
#3 0x000f2d88 main D:/llvm-project-15.0.7.src/llvm/tools/lli/lli.cpp:507:12
#4 0x000f13e6 __tmainCRTStartup /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:329:15
#5 0x000f142a .l_start /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:206:9
#6 0x77005650 (C:\windows\System32\KERNEL32.DLL+0x5650)
#7 0x770fbad4 (C:\windows\SYSTEM32\ntdll.dll+0x4bad4)
Segmentation fault

$ lli --march=thumb test.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: D:\\install\\bin\\lli.exe --march=thumb test.ll
Exception Code: 0xC0000005
#0 0x24581000
#1 0x003ffb72 llvm::orc::runAsMain(int (*)(int, char**), llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::Optional<llvm::StringRef>) D:/llvm-project-15.0.7.src/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp:39:10
#2 0x000f5066 runOrcJIT(char const*) D:/llvm-project-15.0.7.src/llvm/tools/lli/lli.cpp:1153:14
#3 0x000f2d88 main D:/llvm-project-15.0.7.src/llvm/tools/lli/lli.cpp:507:12
#4 0x000f13e6 __tmainCRTStartup /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:329:15
#5 0x000f142a .l_start /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:206:9
#6 0x77005650 (C:\windows\System32\KERNEL32.DLL+0x5650)
#7 0x770fbad4 (C:\windows\SYSTEM32\ntdll.dll+0x4bad4)
Segmentation fault

$ lli --march=thumb --jit-kind=mcjit test.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: D:\\install\\bin\\lli.exe --march=thumb --jit-kind=mcjit test.ll
Exception Code: 0xC0000005
#0 0x1fce1000
#1 0x0030882e llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) D:/llvm-project-15.0.7.src/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp:585:37
#2 0x002f5ba0 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, char const* const*) D:/llvm-project-15.0.7.src/llvm/lib/ExecutionEngine/ExecutionEngine.cpp:467:10
#3 0x000f3b88 main D:/llvm-project-15.0.7.src/llvm/tools/lli/lli.cpp:744:18
#4 0x000f13e6 __tmainCRTStartup /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:329:15
#5 0x000f142a .l_start /build/mingw-w64/mingw-w64-crt/build-armv7/../crt/crtexe.c:206:9
#6 0x77005650 (C:\windows\System32\KERNEL32.DLL+0x5650)
#7 0x770fbad4 (C:\windows\SYSTEM32\ntdll.dll+0x4bad4)
Segmentation fault
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWF1v2zoS_TX0y8ACRerzwQ-ObC_aTbZFku1inwKKom0mlGiQVOL8-wtSlu2kLXqRFugFGsOwRHJ4ZkjOnJOQWSs3nRAzlF6gdDFhvdtqM2uMfBQmLstiUuvmefYBWAvOPMtuA05DrbWzzrAdXAnLQKnHdid3AnQH_5Ndo5-sf51fXyFSgdWwZsa3sgSkhSdtHjzOfW8drGUnIoQXCM-H34veHeZSAtJBo4XtEMkdWCFa79zPfzFlDkY0PRcNGLEzGhApnLBONAegLIGW8a3shA_n8vLLFcRphKMckRLRAwjK8OE7NEkCnDnwQJFSh0568bKjET5-kJQASnDLZIdIgUgJKL8YLMAIF8YTcsDIF-exez9KyZewwhhtEJ3Dqu-4k7oDRPIBPYfeCutXBbKzzvRh3PqF1b0DtxXgmNmIYeOg0w5sv9tp48KcVjcCxF7w3k-LXkeCyKpBZOWRmVKIrGrvc-UDnE5bZvgW0YXb9m39mL8M-fPlcn6zBNvXrXTAoO43_jS8X6dh69zO-q0mK0RWG-m2fR1x3Qbsx_Ex3Rl9L7jzEVjbC4vICljXgOy46hsRVscNs1uoGX9whvExd24c4w_Q9O3ueKA4gvD5bPTGsBaY2fSt6JyPAxbeLK1QWo1rDQ2_3PCilIzEXvxo1cs9F7twQJVuhAfG-wqHTzruKsWA9_Gaixj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