[llvm-commits] [Patch] GCDA Files for Coverage
Bill Wendling
wendling at apple.com
Thu Jul 28 10:51:54 PDT 2011
On Jul 28, 2011, at 9:01 AM, Bob Wilson wrote:
> On Jul 28, 2011, at 1:46 AM, Bill Wendling wrote:
>
>> Hi,
>>
>> 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.
>>
>> 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?
>>
>> Comments?
>
> Since we're currently setting the Use402Format option for the .gcno files based on whether the target is MacOSX, how about the following much simpler patch:
>
> --- a/runtime/libprofile/GCDAProfiling.c
> +++ b/runtime/libprofile/GCDAProfiling.c
> @@ -114,7 +114,11 @@ void llvm_gcda_start_file(const char *orig_filename) {
> output_file = fopen(filename, "wb");
>
> /* gcda file, version 404*, stamp LLVM. */
> +#ifdef __APPLE__
> + fwrite("adcg*204MVLL", 12, 1, output_file);
> +#else
> fwrite("adcg*404MVLL", 12, 1, output_file);
> +#endif
>
> #ifdef DEBUG_GCDAPROFILING
> printf("llvmgcda: [%s]\n", orig_filename);
>
I'm fine with that, though we tend to avoid using target-specific #ifdefs in the sources. :-)
-bw
More information about the llvm-commits
mailing list