Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 204810 - dev-util/ccache-2.4-r7: Patch to allow usage of -fprofile-generate and -fprofile-use
Summary: dev-util/ccache-2.4-r7: Patch to allow usage of -fprofile-generate and -fprof...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-07 20:22 UTC by Clemens Rabe
Modified: 2008-09-30 06:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to prevent ccache from caching when -fprofile-* options are used. (ccache-2.4-profile.patch,1.04 KB, patch)
2008-01-07 20:24 UTC, Clemens Rabe
Details | Diff
Modified ebuild to apply the patch (ccache-2.4-r7.ebuild,2.47 KB, text/plain)
2008-01-07 20:24 UTC, Clemens Rabe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clemens Rabe 2008-01-07 20:22:01 UTC
GCC support profile based optimization using the -fprofile-generate and -fprofile-use options. The first instructs gcc to include hooks for the profile data file generation, the latter uses them in the optimization step. The profile data file is stored in the same directory as the source file, with the suffix .gcda.
When using ccache, the input file names of gcc are replaced by temporary (preprocessed) file names. As the file names differ between the first and the second compilation step, gcc is unable to identify the profile data file and can't use it.
The patch solves this problem by searching for the flags '-fprofile-generate', '-fprofile-use' and '-fprofile-arcs'. If found, the caching is disabled and the original gcc call (with the original input files) is performed.

Clemens

Reproducible: Always

Steps to Reproduce:
1. echo "int main(int a, char** b){}" > test.c
2. gcc -fprofile-generate -c test.c
3. gcc -fprofile-generate -o test test.o
4. ./test
5. gcc -fprofile-use -c test.c
6. gcc -o test test.o

Actual Results:  
With unpatched ccache:
5) Gives warning about $CCACHE_DIR/tmp.hash.*.gcda file not found, execution counts assumed to be zero


Expected Results:  
With ccache:
2) Generated test.gcno in current directory
4) Generated test.gcda in current directory
5) No error.
Comment 1 Clemens Rabe 2008-01-07 20:24:08 UTC
Created attachment 140402 [details, diff]
Patch to prevent ccache from caching when -fprofile-* options are used.

Patch used in attached ebuild to fix the bug.
Comment 2 Clemens Rabe 2008-01-07 20:24:52 UTC
Created attachment 140403 [details]
Modified ebuild to apply the patch
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-09-30 06:39:48 UTC
incvs.