From 90ca05e5e58f90bbdec0c2b403ce9f61a1cfabbd Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Tue, 18 Nov 2014 06:17:20 +0000 Subject: 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 llvm-svn: 222227 --- clang/lib/CodeGen/CodeGenModule.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fe565523fd9c..a68f36945773 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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) -- cgit v1.2.3