r353917 - [MinGW] Add the profiling library when necessary

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 12 23:26:55 PST 2019


Author: mstorsjo
Date: Tue Feb 12 23:26:54 2019
New Revision: 353917

URL: http://llvm.org/viewvc/llvm-project?rev=353917&view=rev
Log:
[MinGW] Add the profiling library when necessary

Profiling still doesn't seem to work properly, but this at least
hooks up the library and eases completing whatever is missing.

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

Modified:
    cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
    cfe/trunk/test/Driver/instrprof-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=353917&r1=353916&r2=353917&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Feb 12 23:26:54 2019
@@ -264,6 +264,8 @@ void tools::MinGW::Linker::ConstructJob(
         CmdArgs.push_back(Args.MakeArgString("--no-whole-archive"));
       }
 
+      TC.addProfileRTLibs(Args, CmdArgs);
+
       if (!HasWindowsApp) {
         // Add system libraries. If linking to libwindowsapp.a, that import
         // library replaces all these and we shouldn't accidentally try to

Modified: cfe/trunk/test/Driver/instrprof-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353917&r1=353916&r2=353917&view=diff
==============================================================================
--- cfe/trunk/test/Driver/instrprof-ld.c (original)
+++ cfe/trunk/test/Driver/instrprof-ld.c Tue Feb 12 23:26:54 2019
@@ -121,3 +121,11 @@
 //
 // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fuse-ld=lld \
+// RUN:     -target x86_64-mingw32 -fprofile-instr-generate \
+// RUN:     -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s
+//
+// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
+// CHECK-MINGW-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}windows{{/|\\\\}}libclang_rt.profile-x86_64.a"




More information about the cfe-commits mailing list