summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJustin Hibbits <jrh29@alumni.cwru.edu>2014-11-18 06:17:20 +0000
committerJustin Hibbits <jrh29@alumni.cwru.edu>2014-11-18 06:17:20 +0000
commit6e94fa58c39ec536909e795ebb9bf3480ee4a36f (patch)
treef021d0a64841b088dafd8821d9c0e970bb5f62aa /lib/CodeGen/CodeGenModule.cpp
parent9be86dc92da310d4924c73a7d50fea6fce1a6066 (diff)
downloadclang-6e94fa58c39ec536909e795ebb9bf3480ee4a36f.tar.gz
Add PIC-level support to Clang.
Summary: This distinguishes between -fpic and -fPIC now, with the additions in LLVM for PIC level support. Test Plan: No regressions Reviewers: echristo, rafael Reviewed By: rafael Subscribers: rnk, emaste, llvm-commits Differential Revision: http://reviews.llvm.org/D5400 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index fe565523fd..a68f369457 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -391,6 +391,18 @@ void CodeGenModule::Release() {
getModule().addModuleFlag(llvm::Module::Error, "min_enum_size", EnumWidth);
}
+ if (uint32_t PLevel = Context.getLangOpts().PICLevel) {
+ llvm::PICLevel::Level PL = llvm::PICLevel::Default;
+ switch (PLevel) {
+ case 0: break;
+ case 1: PL = llvm::PICLevel::Small; break;
+ case 2: PL = llvm::PICLevel::Large; break;
+ default: llvm_unreachable("Invalid PIC Level");
+ }
+
+ getModule().setPICLevel(PL);
+ }
+
SimplifyPersonality();
if (getCodeGenOpts().EmitDeclMetadata)