[InstrProf] Merge COFF .lprof* and .lcovmap sections into .data/.rdata
There is no reason for these sections to remain separate in the final
DLL or EXE.
I have not yet added a InstrProfilingPlatformWindows.c for these, since
avoiding dynamic profile data registration is a larger project for
later.
@@ -91,4 +91,13 @@ ValueProfNode *__llvm_profile_end_vnodes(void) { return 0; }
COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = 0;
COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = 0;
+#if defined(_WIN32)
+// Put read-write sections in .data.
+#pragma comment(linker, "/MERGE:.lprfc=.data")
+#pragma comment(linker, "/MERGE:.lprfd=.data")
+// Put read-write sections in .rdata.
+#pragma comment(linker, "/MERGE:.lcovmap=.rdata")
+#pragma comment(linker, "/MERGE:.lprfn=.rdata")
+#endif
+
#endif
