[PATCH] D42217: Set Module Metadata "AvoidPLT" when -fno-plt is used.

Sriraman Tallam via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 16:51:15 PST 2018


tmsriram created this revision.
tmsriram added reviewers: rnk, rafael.

Set Module Metadata "AvoidPLT" when -fno-plt is used.

Please see:
https://reviews.llvm.org/D42216 for more details.

This allows processing of calls to intrinsics easily.


https://reviews.llvm.org/D42217

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGen/noplt.c


Index: test/CodeGen/noplt.c
===================================================================
--- test/CodeGen/noplt.c
+++ test/CodeGen/noplt.c
@@ -1,7 +1,8 @@
-// RUN: %clang_cc1 -emit-llvm -fno-plt %s -o - | FileCheck %s -check-prefix=CHECK-NOPLT
+// RUN: %clang_cc1 -emit-llvm -fno-plt %s -o - | FileCheck %s -check-prefix=CHECK-NOPLT -check-prefix=CHECK-NOPLT-METADATA
 
 // CHECK-NOPLT: Function Attrs: nonlazybind
 // CHECK-NOPLT-NEXT: declare {{.*}}i32 @foo
+// CHECK-NOPLT-METADATA: !"AvoidPLT"
 int foo();
 
 int bar() {
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -555,6 +555,10 @@
       getModule().setPIELevel(static_cast<llvm::PIELevel::Level>(PLevel));
   }
 
+  if (CodeGenOpts.NoPLT) {
+    getModule().setAvoidPLT();
+  }
+
   SimplifyPersonality();
 
   if (getCodeGenOpts().EmitDeclMetadata)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42217.130317.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180118/d4c8a637/attachment.bin>


More information about the cfe-commits mailing list