<div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div>So... there is no way to make throw and catch working in a jitted code under Windows?  </div></blockquote><div><br></div><div>I have used throw and catch in jitted code, so "no way" is too strong. But there's a large range of possible states between "no way" and "always enabled OOTB". Currently, this is pretty close to the "mostly unimplemented" side of the spectrum in LLVM.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font size="2" face="sans-serif">Also - to get rid of reallocation problems,
it's no help to compile to .elf files?</font>
<br></blockquote><div> </div><div>I never dug through the spec fully, but if I remember correctly, ELF does not support the relocation type that is required by the Windows unwind table specification (specifically, 32-bit image-base relative). So yes, this would get rid of relocation problems. But it might then be tricky to build the unwind information. (Perhaps this wouldn't be feasible in a static environment, but it's possible in a JIT environment, since this is indeed how it's done in JuliaLang).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><font size="1" color="#5f5f5f" face="sans-serif">From:      
 </font><font size="1" face="sans-serif">Jameson Nash <<a href="mailto:vtjnash@gmail.com" target="_blank">vtjnash@gmail.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">To:      
 </font><font size="1" face="sans-serif">Hayden Livingston <<a href="mailto:halivingston@gmail.com" target="_blank">halivingston@gmail.com</a>>,
<a href="mailto:bjoern.gaier@horiba.com" target="_blank">bjoern.gaier@horiba.com</a></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Cc:      
 </font><font size="1" face="sans-serif">LLVM Developers Mailing
List <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>, Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Date:      
 </font><font size="1" face="sans-serif">16.10.2017 23:04</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Subject:    
   </font><font size="1" face="sans-serif">Re: [llvm-dev]
Clang/LLVM JIT - When to use "registerEHFrames()"</font>
<br>
<hr noshade>
<br>
<br>
<br><font size="3">Historically? I implemented support for exceptions back
in LLVM 3.3, before LLVM had an implementation of a Windows unwinder.</font>
<br>
<br><font size="3">Currently? As recent as LLVM 4.0, I don't think the JIT
was fully capable of handling COFF files, and LLVM wouldn't emit the correct
sections (with the COFF-formatted unwind tables) when used in ELF mode.</font>
<br>
<br><font size="3">The prolog is known to be standard since Julia disables
FPO on all code, so the hand-coded values simply needed to declare that
to the unwinder. Windows doesn't have epilog records (it instead infers
them from the structure of the assembly itself, and requires that LLVM
only generate function returns using a particular finite set of instructions),
so that has to be handled elsewhere during machine code selection/emission.</font>
<br><font size="3"><br>
</font>
<br><font size="3">On Tue, Oct 10, 2017 at 11:07 AM Hayden Livingston <</font><a href="mailto:halivingston@gmail.com" target="_blank"><font size="3" color="blue"><u>halivingston@gmail.com</u></font></a><font size="3">>
wrote:</font>
<br><font size="3">Julia is a language, and you can use their code.<br>
<br>
Jameson Nash, could you please let us know why Julia's code has hard<br>
coded values for the unwinding? Is your prolog/epilog some standard<br>
one?<br>
<br>
On Fri, Oct 6, 2017 at 2:47 AM,  <</font><a href="mailto:bjoern.gaier@horiba.com" target="_blank"><font size="3" color="blue"><u>bjoern.gaier@horiba.com</u></font></a><font size="3">>
wrote:<br>
> Hello everyone,<br>
><br>
> I was following the discussion, but I have to admit, that my skills
aren't<br>
> high enough to follow you guys. For my current exception problem,
I don't<br>
> have to stick around with the PECOFF format, so I used clang to don't<br>
> compile to a PECOFF, but to a ELF file. Interesting, now I'm missing
the<br>
> functions:<br>
> __cxa_allocate_exception<br>
> __cxa_throw<br>
> _ZTI<br>
><br>
> I loaded the DLL "libstdc++.dll" and found all of the addresses
- but the<br>
> application still crashes when the exception is thrown.<br>
><br>
> So... Do you think, that "Julias Code" could help me? You
mentioned her in<br>
> one of the mails, but I don't know her - or her code.<br>
><br>
> Also, is it a better idea to compile all dynamic code to the ELF format,<br>
> because PECOFF isn't fully supported?<br>
><br>
> Kind regards<br>
> Björn<br>
><br>
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816,<br>
> USt.ID-Nr. DE 114 165 789<br>
> Geschäftsführer: Hiroshi Kawamura, Dr Hiroshi Nakamura, Markus Bode,
Heiko<br>
> Lampert, Takashi Nagano, Takeshi Fukushima.</font>
<br>
<br><font size="2" face="sans-serif"><br>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr.
DE 114 165 789<br>
Geschäftsführer: Hiroshi Kawamura, Dr Hiroshi Nakamura, Markus Bode, Heiko
Lampert, Takashi Nagano, Takeshi Fukushima.</font></blockquote></div></div>