]> granicus.if.org Git - clang/commitdiff
[MinGW] Add the profiling library when necessary
authorMartin Storsjo <martin@martin.st>
Wed, 13 Feb 2019 07:26:54 +0000 (07:26 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 13 Feb 2019 07:26:54 +0000 (07:26 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353917 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/MinGW.cpp
test/Driver/instrprof-ld.c

index e8eca7325de86781e34ee9db0065dfe19e88f3f8..7b2af0cbe3880cf0e114d8e533d5dc975e7de7d1 100644 (file)
@@ -264,6 +264,8 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
         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
index ea201056997585a087403f1ae1119a0552eaca9e..e0729e23fc8299aa67478d4af0b12b38bfea6a7d 100644 (file)
 //
 // 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"