From f25ae44e165dfed669615783877de4fbe97e48e4 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 3 Jan 2019 00:33:44 +0000 Subject: [PATCH] [LLVM-C] Expand LLVMRelocMode Summary: Add read[only|write] PIC relocation models to the C API and teach the TargetMachine API about it. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D56187 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350279 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm-c/TargetMachine.h | 5 ++++- lib/Target/TargetMachineC.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/llvm-c/TargetMachine.h b/include/llvm-c/TargetMachine.h index bcfa0012c3c..c06e9edc9aa 100644 --- a/include/llvm-c/TargetMachine.h +++ b/include/llvm-c/TargetMachine.h @@ -39,7 +39,10 @@ typedef enum { LLVMRelocDefault, LLVMRelocStatic, LLVMRelocPIC, - LLVMRelocDynamicNoPic + LLVMRelocDynamicNoPic, + LLVMRelocROPI, + LLVMRelocRWPI, + LLVMRelocROPI_RWPI } LLVMRelocMode; typedef enum { diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index 37d398d580f..bae45ae28c4 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -115,6 +115,15 @@ LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T, case LLVMRelocDynamicNoPic: RM = Reloc::DynamicNoPIC; break; + case LLVMRelocROPI: + RM = Reloc::ROPI; + break; + case LLVMRelocRWPI: + RM = Reloc::RWPI; + break; + case LLVMRelocROPI_RWPI: + RM = Reloc::ROPI_RWPI; + break; default: break; } -- 2.50.1