diff options
| author | Nathan Slingerland <slingn@gmail.com> | 2016-01-05 18:27:06 +0000 |
|---|---|---|
| committer | Nathan Slingerland <slingn@gmail.com> | 2016-01-05 18:27:06 +0000 |
| commit | e8ddf9e9db2cb94aa617514e533fb5cd2502515d (patch) | |
| tree | ebe9e3b8420b9e3d284e3eacb8334f4c743e320d | |
| parent | 1e06636b3268bab5831f55ceaac7c57aef100331 (diff) | |
| download | bcm5719-llvm-e8ddf9e9db2cb94aa617514e533fb5cd2502515d.tar.gz bcm5719-llvm-e8ddf9e9db2cb94aa617514e533fb5cd2502515d.zip | |
[PGO] Enable clang to pass compiler-rt profile support library to linker on Windows
Summary: This change enables clang to automatically link binaries built with the -fprofile-instr-generate against the clang_rt.profile-i386.lib library.
Reviewers: davidxl, dnovillo
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15833
llvm-svn: 256855
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Driver/instrprof-ld.c | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index a8f4afaa149..7af1899b383 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -9473,6 +9473,8 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, A.renderAsInput(Args, CmdArgs); } + TC.addProfileRTLibs(Args, CmdArgs); + // We need to special case some linker paths. In the case of lld, we need to // translate 'lld' into 'lld-link', and in the case of the regular msvc // linker, we need to use a special search algorithm. diff --git a/clang/test/Driver/instrprof-ld.c b/clang/test/Driver/instrprof-ld.c index b3ba12ee434..05f65d61460 100644 --- a/clang/test/Driver/instrprof-ld.c +++ b/clang/test/Driver/instrprof-ld.c @@ -105,3 +105,19 @@ // // CHECK-WATCHOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-WATCHOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_watchos.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target i386-pc-win32 -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-WINDOWS-I386 %s +// +// CHECK-WINDOWS-I386: "{{.*}}link{{(.exe)?}}" +// CHECK-WINDOWS-I386: "{{.*}}clang_rt.profile-i386.lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-pc-win32 -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-WINDOWS-X86-64 %s +// +// CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}" +// CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib" |

