File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,9 @@ pub enum RelocMode {
288288 Static = 1 ,
289289 PIC = 2 ,
290290 DynamicNoPic = 3 ,
291+ ROPI = 4 ,
292+ RWPI = 5 ,
293+ ROPI_RWPI = 6 ,
291294}
292295
293296/// LLVMRustCodeModel
Original file line number Diff line number Diff line change @@ -37,11 +37,14 @@ use std::sync::mpsc::channel;
3737use std:: thread;
3838use libc:: { c_uint, c_void} ;
3939
40- pub const RELOC_MODEL_ARGS : [ ( & ' static str , llvm:: RelocMode ) ; 4 ] = [
40+ pub const RELOC_MODEL_ARGS : [ ( & ' static str , llvm:: RelocMode ) ; 7 ] = [
4141 ( "pic" , llvm:: RelocMode :: PIC ) ,
4242 ( "static" , llvm:: RelocMode :: Static ) ,
4343 ( "default" , llvm:: RelocMode :: Default ) ,
4444 ( "dynamic-no-pic" , llvm:: RelocMode :: DynamicNoPic ) ,
45+ ( "ropi" , llvm:: RelocMode :: ROPI ) ,
46+ ( "rwpi" , llvm:: RelocMode :: RWPI ) ,
47+ ( "ropi-rwpi" , llvm:: RelocMode :: ROPI_RWPI ) ,
4548] ;
4649
4750pub const CODE_GEN_MODEL_ARGS : [ ( & ' static str , llvm:: CodeModel ) ; 5 ] = [
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ extern "C" void LLVMRustPrintTargetFeatures(LLVMTargetMachineRef) {
290290
291291extern " C" LLVMTargetMachineRef LLVMRustCreateTargetMachine (
292292 const char *TripleStr, const char *CPU, const char *Feature,
293- LLVMRustCodeModel RustCM, LLVMRelocMode Reloc,
293+ LLVMRustCodeModel RustCM, int Reloc,
294294 LLVMRustCodeGenOptLevel RustOptLevel, bool UseSoftFloat,
295295 bool PositionIndependentExecutable, bool FunctionSections,
296296 bool DataSections) {
@@ -304,15 +304,26 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
304304 auto OptLevel = fromRust (RustOptLevel);
305305
306306 switch (Reloc) {
307- case LLVMRelocStatic :
307+ case 1 :
308308 RM = Reloc::Static;
309309 break ;
310- case LLVMRelocPIC :
310+ case 2 :
311311 RM = Reloc::PIC_;
312312 break ;
313- case LLVMRelocDynamicNoPic :
313+ case 3 :
314314 RM = Reloc::DynamicNoPIC;
315315 break ;
316+ #if LLVM_VERSION_GE(4, 0)
317+ case 4 :
318+ RM = Reloc::ROPI;
319+ break ;
320+ case 5 :
321+ RM = Reloc::RWPI;
322+ break ;
323+ case 6 :
324+ RM = Reloc::ROPI_RWPI;
325+ break ;
326+ #endif
316327 default :
317328#if LLVM_VERSION_LE(3, 8)
318329 RM = Reloc::Default;
You can’t perform that action at this time.
0 commit comments