<div dir="ltr">ping. any takers?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 1, 2015 at 9:31 PM, Mukul Sabharwal <span dir="ltr"><<a href="mailto:mjsabby@gmail.com" target="_blank">mjsabby@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Resending since I wasn't part of mailing list at the time<div class="HOEnZb"><div class="h5"><span></span><br><div><br>On Wednesday, April 1, 2015, Mukul Sabharwal <<a href="mailto:mjsabby@gmail.com" target="_blank">mjsabby@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi reames,<br>
<br>
An LLVMSharp user filed a bug report (<a href="https://github.com/mjsabby/LLVMSharp/issues/3" target="_blank">https://github.com/mjsabby/LLVMSharp/issues/3</a>) that using the library they were unable to call SetGC("shadow-stack") on a function and then subsequently ask MCJIT to finalize the object containing the function.<br>
<br>
They also created an LLVM bug report (<a href="https://llvm.org/bugs/show_bug.cgi?id=23095" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=23095</a>) that demonstrates the problem.<br>
<br>
I have investigated the root cause for this and it is because LLVMSharp and other C binding users do not have access to llvm::linkShadowStackGC (in addition to other GCs defined in llvm/include/llvm/CodeGen/GCs.h) which GC clients of the C++ API would need to call in order to successfully complete this scenario.<br>
<br>
I'm proposing to expose LLVMLinkShadowStackGC via the C bindings. The ShadowStackGC is very useful functionality that is referenced in the official documentation and likely to be beneficial to many users.<br>
<br>
I'm consciously choosing not to link other GCs, but maybe I should? Let me know as part of the review feedback if I should also expose other GCs (currently StatepointExample, Erlang, and Ocaml)<br>
<br>
REPOSITORY<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D8788" target="_blank">http://reviews.llvm.org/D8788</a><br>
<br>
Files:<br>
  include/llvm-c/Core.h<br>
  lib/IR/Core.cpp<br>
<br>
Index: include/llvm-c/Core.h<br>
===================================================================<br>
--- include/llvm-c/Core.h<br>
+++ include/llvm-c/Core.h<br>
@@ -1921,6 +1921,13 @@<br>
 void LLVMSetGC(LLVMValueRef Fn, const char *Name);<br>
<br>
 /**<br>
+* Link the Shadow Stack GC<br>
+*<br>
+* @see llvm::linkShadowStackGC()<br>
+*/<br>
+void LLVMLinkShadowStackGC();<br>
+<br>
+/**<br>
  * Add an attribute to a function.<br>
  *<br>
  * @see llvm::Function::addAttribute()<br>
Index: lib/IR/Core.cpp<br>
===================================================================<br>
--- lib/IR/Core.cpp<br>
+++ lib/IR/Core.cpp<br>
@@ -14,6 +14,7 @@<br>
<br>
 #include "llvm-c/Core.h"<br>
 #include "llvm/Bitcode/ReaderWriter.h"<br>
+#include "llvm/CodeGen/GCs.h"<br>
 #include "llvm/IR/Attributes.h"<br>
 #include "llvm/IR/CallSite.h"<br>
 #include "llvm/IR/Constants.h"<br>
@@ -1709,6 +1710,10 @@<br>
     F->clearGC();<br>
 }<br>
<br>
+void LLVMLinkShadowStackGC() {<br>
+  llvm::linkShadowStackGC();<br>
+}<br>
+<br>
 void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {<br>
   Function *Func = unwrap<Function>(Fn);<br>
   const AttributeSet PAL = Func->getAttributes();<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</blockquote></div><br><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>Sent from MetroMail<br>
</font></span></blockquote></div><br></div>