[compiler-rt] r255684 - [PGO] Open file with explict binary mode

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 14:18:11 PST 2015


Author: davidxl
Date: Tue Dec 15 16:18:11 2015
New Revision: 255684

URL: http://llvm.org/viewvc/llvm-project?rev=255684&view=rev
Log:
[PGO] Open file with explict binary mode

Patch by: Johan Engelen

On windows, opening in text mode will result in
line ending chars to be appended leading to
profile corruption.


Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=255684&r1=255683&r2=255684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Tue Dec 15 16:18:11 2015
@@ -46,7 +46,7 @@ static int writeFileWithName(const char
     return -1;
 
   /* Append to the file to support profiling multiple shared objects. */
-  OutputFile = fopen(OutputName, "a");
+  OutputFile = fopen(OutputName, "ab");
   if (!OutputFile)
     return -1;
 




More information about the llvm-commits mailing list