File tree 3 files changed +22
-5
lines changed
3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,9 @@ pub enum RelocMode {
288
288
Static = 1 ,
289
289
PIC = 2 ,
290
290
DynamicNoPic = 3 ,
291
+ ROPI = 4 ,
292
+ RWPI = 5 ,
293
+ ROPI_RWPI = 6 ,
291
294
}
292
295
293
296
/// LLVMRustCodeModel
Original file line number Diff line number Diff line change @@ -37,11 +37,14 @@ use std::sync::mpsc::channel;
37
37
use std:: thread;
38
38
use libc:: { c_uint, c_void} ;
39
39
40
- pub const RELOC_MODEL_ARGS : [ ( & ' static str , llvm:: RelocMode ) ; 4 ] = [
40
+ pub const RELOC_MODEL_ARGS : [ ( & ' static str , llvm:: RelocMode ) ; 7 ] = [
41
41
( "pic" , llvm:: RelocMode :: PIC ) ,
42
42
( "static" , llvm:: RelocMode :: Static ) ,
43
43
( "default" , llvm:: RelocMode :: Default ) ,
44
44
( "dynamic-no-pic" , llvm:: RelocMode :: DynamicNoPic ) ,
45
+ ( "ropi" , llvm:: RelocMode :: ROPI ) ,
46
+ ( "rwpi" , llvm:: RelocMode :: RWPI ) ,
47
+ ( "ropi-rwpi" , llvm:: RelocMode :: ROPI_RWPI ) ,
45
48
] ;
46
49
47
50
pub 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) {
290
290
291
291
extern " C" LLVMTargetMachineRef LLVMRustCreateTargetMachine (
292
292
const char *TripleStr, const char *CPU, const char *Feature,
293
- LLVMRustCodeModel RustCM, LLVMRelocMode Reloc,
293
+ LLVMRustCodeModel RustCM, int Reloc,
294
294
LLVMRustCodeGenOptLevel RustOptLevel, bool UseSoftFloat,
295
295
bool PositionIndependentExecutable, bool FunctionSections,
296
296
bool DataSections) {
@@ -304,15 +304,26 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
304
304
auto OptLevel = fromRust (RustOptLevel);
305
305
306
306
switch (Reloc) {
307
- case LLVMRelocStatic :
307
+ case 1 :
308
308
RM = Reloc::Static;
309
309
break ;
310
- case LLVMRelocPIC :
310
+ case 2 :
311
311
RM = Reloc::PIC_;
312
312
break ;
313
- case LLVMRelocDynamicNoPic :
313
+ case 3 :
314
314
RM = Reloc::DynamicNoPIC;
315
315
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
316
327
default :
317
328
#if LLVM_VERSION_LE(3, 8)
318
329
RM = Reloc::Default;
You can’t perform that action at this time.
0 commit comments