How to migrate Target option PositionIndependentExecutable for LLVM v3.9?

Hi LLVM developers,

I am migrating dragonegg to GCC v6.8 and LLVM v3.9 right now https://github.com/xiangzhai/dragonegg

There was PositionIndependentExecutable Target option before LLVM v3.9 https://github.com/llvm-mirror/llvm/blob/release_38/include/llvm/Target/TargetOptions.h#L181 but after LLVM v3.9 https://reviews.llvm.org/D19733 it suggested to use PIELevel module flags instead of Target option PositionIndependentExecutable. so could I migrate it like this?

#if LLVM_VERSION_CODE > LLVM_VERSION(3, 8)
TheModule->setPIELevel(PIELevel::Large);
#else
   Options.PositionIndependentExecutable = flag_pie; // -fPIE
#endif

please give me some suggestion, thanks a lot!

Hi Xlous,

感谢您的回复!

You can use following c++ code ship to determines what version of Clang you used currently.

yes! https://github.com/xiangzhai/dragonegg/blob/gcc-6_3-branch/include/dragonegg/Internals.h#L33

but I prefer to find out the "equivalent" just like migrate x86_sse2_psrl_dq for LLVM v3.9 :slight_smile: