This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.1 patch] relocate profile data file
Nathan,
Thank you for the feedback. We'll update the patch with respect to your
notes.
> It's not safe to save getenv return values like this. If the
> program calls putenv, the storage can get reallocated or blown
> away. You'll need to refetch it for each call to gcov_exit.
In this case we also need to getenv in gcov_version, which deals with
relocated pathname as well.
> have the full pathname available in gcov_exit and you won't
> have to alter those error message calls.
gcov_exit operates on the list of registered object files in the loop,
so we shall reallocate placeholder for the full pathname on each step.
That is impossible for alloca allocated memory. Thus prefix and filename
are glueing in its calees - printf, gcov_open, create_file_directory.
> Have you thought about specifying the prefix and strip to
> the compiler and gcov itself, so you don't need to move the
> data files after they've been created?
Yes. We thought in this way and will possibly come up with the patch later.
---
- Grigory