<div class="gmail_quote">On 28 July 2011 01:46, Bill Wendling <span dir="ltr"><<a href="mailto:wendling@apple.com">wendling@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br>
<br>
Attached is a patch that I'm concerned may cause breakage for some people. Darwin needs the "402" version of GCOV. I made this change for the .gcno file, but I failed to make it for the .gcda file. Unfortunately, it's a bit more involved than one would think. I will need to change the llvm_gcda_start_file() function in runtime/libprofile/GCDAProfiling.c, since that library gets called when running the program. But if I change the function's arguments, it would break current files that were built were built the olde waye.<br>


<br>
So, is this a problem? If so, then would it be okay to create a new function (llvm_gcda_start_file_402format or something) and use that?<br></blockquote><div><br></div><div>I'm fine with requiring libprofile_rt to be version-locked with the llvm+clang that generated it. Everybody statically links it, right? We only build the .so version for utils/<a href="http://profile.pl">profile.pl</a> to lli -load it.</div>

<div><br></div><div>NIck</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Comments?<br>
<br>
-bw<br>
<br>
Index: runtime/libprofile/GCDAProfiling.c<br>
===================================================================<br>
--- runtime/libprofile/GCDAProfiling.c  (revision 136325)<br>
+++ runtime/libprofile/GCDAProfiling.c  (working copy)<br>
@@ -107,14 +107,17 @@<br>
  * profiling enabled will emit to a different file. Only one file may be<br>
  * started at a time.<br>
  */<br>
-void llvm_gcda_start_file(const char *orig_filename) {<br>
+void llvm_gcda_start_file(const char *orig_filename, int use_402_format) {<br>
   char *filename;<br>
   filename = mangle_filename(orig_filename);<br>
   recursive_mkdir(filename);<br>
   output_file = fopen(filename, "wb");<br>
<br>
   /* gcda file, version 404*, stamp LLVM. */<br>
-  fwrite("adcg*404MVLL", 12, 1, output_file);<br>
+  if (!use_402_format)<br>
+    fwrite("adcg*404MVLL", 12, 1, output_file);<br>
+  else<br>
+    fwrite("adcg*204MVLL", 12, 1, output_file);<br>
<br>
 #ifdef DEBUG_GCDAPROFILING<br>
   printf("llvmgcda: [%s]\n", orig_filename);<br>
Index: lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
===================================================================<br>
--- lib/Transforms/Instrumentation/GCOVProfiling.cpp    (revision 136325)<br>
+++ lib/Transforms/Instrumentation/GCOVProfiling.cpp    (working copy)<br>
@@ -571,8 +571,11 @@<br>
 }<br>
<br>
 Constant *GCOVProfiler::getStartFileFunc() {<br>
+  Type *Args[] = {<br>
+    Type::getInt8PtrTy(*Ctx), Type::getInt32Ty(*Ctx)<br>
+  };<br>
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx),<br>
-                                              Type::getInt8PtrTy(*Ctx), false);<br>
+                                        Args, false);<br>
   return M->getOrInsertFunction("llvm_gcda_start_file", FTy);<br>
 }<br>
<br>
@@ -645,8 +648,10 @@<br>
            CUE = DIF.compile_unit_end(); CUI != CUE; ++CUI) {<br>
     DICompileUnit compile_unit(*CUI);<br>
     std::string FilenameGcda = mangleName(compile_unit, "gcda");<br>
-    Builder.CreateCall(StartFile,<br>
-                       Builder.CreateGlobalStringPtr(FilenameGcda));<br>
+    Builder.CreateCall2(StartFile,<br>
+                        Builder.CreateGlobalStringPtr(FilenameGcda),<br>
+                        ConstantInt::get(Type::getInt32Ty(*Ctx), Use402Format));<br>
+<br>
     for (SmallVector<std::pair<GlobalVariable *, MDNode *>, 8>::iterator<br>
              I = CountersBySP.begin(), E = CountersBySP.end();<br>
          I != E; ++I) {<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br>