[PATCH] D19687: Set PIELevel module flag

Sriraman Tallam via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 13:59:29 PDT 2016


tmsriram created this revision.
tmsriram added reviewers: rnk, davidxl.
tmsriram added a subscriber: cfe-commits.

In patch http://reviews.llvm.org/D19671, I added a patch to create PIELevel module flag.  This patch sets the flag.

http://reviews.llvm.org/D19687

Files:
  lib/CodeGen/CodeGenModule.cpp

Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -488,6 +488,18 @@
     getModule().setPICLevel(PL);
   }
 
+  if (uint32_t PLevel = Context.getLangOpts().PIELevel) {
+    llvm::PIELevel::Level PL = llvm::PIELevel::Default;
+    switch (PLevel) {
+    case 0: break;
+    case 1: PL = llvm::PIELevel::Small; break;
+    case 2: PL = llvm::PIELevel::Large; break;
+    default: llvm_unreachable("Invalid PIE Level");
+    }
+
+    getModule().setPIELevel(PL);
+  }
+
   SimplifyPersonality();
 
   if (getCodeGenOpts().EmitDeclMetadata)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19687.55481.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160428/7120ba85/attachment.bin>


More information about the cfe-commits mailing list