struct stat st;
int result;
struct file_hash *object_hash = NULL;
+ char *gcda_name;
+ char *base_name;
/* first the arguments */
for (i = 1; i < args->argc; i++) {
/* All other arguments are included in the hash. */
hash_delimiter(hash, "arg");
hash_string(hash, args->argv[i]);
+
+ if (str_eq(args->argv[i], "-fprofile-use")) {
+ // Calculate gcda name
+ base_name = remove_extension(output_obj);
+ gcda_name = format("%s.gcda", base_name);
+ free(base_name);
+ // Add the gcda to our hash
+ if (!hash_file(hash, gcda_name)) {
+ // If it doesn't exist, add some null data
+ hash_string(hash, "no data");
+ }
+ }
}
if (direct_mode) {
{"-fbranch-probabilities", TOO_HARD},
{"-fprofile-arcs", NEEDS_REALDIR},
{"-fprofile-generate", NEEDS_REALDIR},
- {"-fprofile-use", TOO_HARD},
+ {"-fprofile-use", NEEDS_REALDIR},
{"-frepo", TOO_HARD},
{"-ftest-coverage", TOO_HARD}, /* generates a .gcno file at the same time */
{"-idirafter", AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
testname="profile-use"
$CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
checkstat 'cache hit (preprocessed)' 2
- checkstat 'cache miss' 2
- checkstat 'files in cache' 2
+ checkstat 'cache miss' 3
+ checkstat 'files in cache' 4
$CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
- checkstat 'cache hit (preprocessed)' 2
- checkstat 'cache miss' 2
- checkstat 'files in cache' 2
+ checkstat 'cache hit (preprocessed)' 3
+ checkstat 'cache miss' 3
+ checkstat 'files in cache' 4
rm -f test1.c
}