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

Sriraman Tallam via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 13:30:48 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325961: Set Module Metadata "RtLibUseGOT" when fno-plt is used. (authored by tmsriram, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42217?vs=135144&id=135689#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42217

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


Index: cfe/trunk/test/CodeGen/noplt.c
===================================================================
--- cfe/trunk/test/CodeGen/noplt.c
+++ cfe/trunk/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: !"RtLibUseGOT"
 int foo();
 
 int bar() {
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -555,6 +555,9 @@
       getModule().setPIELevel(static_cast<llvm::PIELevel::Level>(PLevel));
   }
 
+  if (CodeGenOpts.NoPLT)
+    getModule().setRtLibUseGOT();
+
   SimplifyPersonality();
 
   if (getCodeGenOpts().EmitDeclMetadata)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42217.135689.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180223/94af2088/attachment.bin>


More information about the cfe-commits mailing list