r325961 - Set Module Metadata "RtLibUseGOT" when fno-plt is used.

Sriraman Tallam via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 13:27:33 PST 2018


Author: tmsriram
Date: Fri Feb 23 13:27:33 2018
New Revision: 325961

URL: http://llvm.org/viewvc/llvm-project?rev=325961&view=rev
Log:
Set Module Metadata "RtLibUseGOT" when fno-plt is used.

Differential Revision: https://reviews.llvm.org/D42217

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

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=325961&r1=325960&r2=325961&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Feb 23 13:27:33 2018
@@ -555,6 +555,9 @@ void CodeGenModule::Release() {
       getModule().setPIELevel(static_cast<llvm::PIELevel::Level>(PLevel));
   }
 
+  if (CodeGenOpts.NoPLT)
+    getModule().setRtLibUseGOT();
+
   SimplifyPersonality();
 
   if (getCodeGenOpts().EmitDeclMetadata)

Modified: cfe/trunk/test/CodeGen/noplt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/noplt.c?rev=325961&r1=325960&r2=325961&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/noplt.c (original)
+++ cfe/trunk/test/CodeGen/noplt.c Fri Feb 23 13:27:33 2018
@@ -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() {




More information about the cfe-commits mailing list