[compiler-rt] r354840 - [llvm-cov] Fix llvm-cov on Windows and un-XFAIL test

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 25 18:30:00 PST 2019


Author: rnk
Date: Mon Feb 25 18:30:00 2019
New Revision: 354840

URL: http://llvm.org/viewvc/llvm-project?rev=354840&view=rev
Log:
[llvm-cov] Fix llvm-cov on Windows and un-XFAIL test

Summary:
The llvm-cov tool needs to be able to find coverage names in the
executable, so the .lprfn and .lcovmap sections cannot be merged into
.rdata.

Also, the linker merges .lprfn$M into .lprfn, so llvm-cov needs to
handle that when looking up sections. It has to support running on both
relocatable object files and linked PE files.

Lastly, when loading .lprfn from a PE file, llvm-cov needs to skip the
leading zero byte added by the profile runtime.

Reviewers: vsk

Subscribers: hiraditya, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingPlatformWindows.c
    compiler-rt/trunk/test/profile/instrprof-merging.cpp

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPlatformWindows.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPlatformWindows.c?rev=354840&r1=354839&r2=354840&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPlatformWindows.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPlatformWindows.c Mon Feb 25 18:30:00 2019
@@ -16,9 +16,9 @@
 #pragma comment(linker, "/MERGE:.lprfd=.data")
 #pragma comment(linker, "/MERGE:.lprfv=.data")
 #pragma comment(linker, "/MERGE:.lprfnd=.data")
-/* Merge read-only sections into .rdata. */
-#pragma comment(linker, "/MERGE:.lprfn=.rdata")
-#pragma comment(linker, "/MERGE:.lcovmap=.rdata")
+/* Do *NOT* merge .lprfn and .lcovmap into .rdata. llvm-cov must be able to find
+ * after the fact.
+ */
 
 /* Allocate read-only section bounds. */
 #pragma section(".lprfn$A", read)

Modified: compiler-rt/trunk/test/profile/instrprof-merging.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-merging.cpp?rev=354840&r1=354839&r2=354840&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-merging.cpp (original)
+++ compiler-rt/trunk/test/profile/instrprof-merging.cpp Mon Feb 25 18:30:00 2019
@@ -21,9 +21,6 @@
 //    and prefer it over others.) When only limited coverage information is
 //    available (just from one binary), don't try to guess any region counts.
 
-// FIXME: Fails with: "Failed to load coverage: No coverage data found"
-// XFAIL: windows
-
 struct A {
   A() {}    // V1: [[@LINE]]{{ *}}|{{ *}}1
             // V1-ONLY: [[@LINE+1]]{{ *}}|{{ *}}|




More information about the llvm-commits mailing list