[PATCH] D29222: MCJIT: Support setting relocation model from C wrappers

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 15:15:30 PST 2017


deadalnix added inline comments.


================
Comment at: include/llvm-c/ExecutionEngine.h:46
   unsigned OptLevel;
+  LLVMRelocMode RelMode;
   LLVMCodeModel CodeModel;
----------------
evgeny777 wrote:
> deadalnix wrote:
> > Sadly, many people are using the C API in foreign languages (as in not C, not German or French).
> > 
> > I know there is no promise to keep the OrcJIT API stable at this stage, so maybe that's ok, but it's a bit unfortunate that this ends up being in the ExecutionEngine rather than some Orc specific header. Maybe deproting Orc specific declaration from there to some Orc specific header would be better.
> What exactly declaration are you talking about?
> 
> As far as I know relocation model is not something specific to ORC. At least I used legacy MCJIT API with PIC long time go, but I used C++ API (llvm/ExecutionEngine.h). The fact one can't use PIC from C API looks like as a limitation of C API to me.
The C API has stricter backward compatibility constraints than the regular C++ API, because it is used from other language. These users won't get any error, just weird crash because the structure layout do not match anymore.

Is MCJIT going away at some point ? If so I'd just duplicate the struct and use it for Orc.


================
Comment at: include/llvm/Support/CodeGenCWrappers.h:63
+  switch (Model) {
+  case LLVMRelocDefault:
+  case LLVMRelocStatic:
----------------
evgeny777 wrote:
> deadalnix wrote:
> > Why not use Reloc::Default ?
> > 
> > I've been thinking that Reloc::Default should probably not default to static every time, because more and more linux distro use PIE by default on amd64. Maybe default should become whatever the target uses as default.
> Just because there is no such enumeration value. See llvm/Support/CodeGen.h
I see @rafael blasted it away. What's the reason ?


Repository:
  rL LLVM

https://reviews.llvm.org/D29222





More information about the llvm-commits mailing list