[patch] Hide some more libgcov functions

Michael Matz matz@suse.de
Fri Mar 14 17:45:00 GMT 2008


Hi,

this turned up in local testing (with Tcl).  The problem is when a shared 
lib and the main executable both are built with -fprofile-generate and 
both use the IOR counter.  As the merge_ior function currently is not 
hidden it will be exported from the shared lib and found for the reference 
in the executable.  But the executable and the shared lib have their own 
private copy of the gcov_var variable.  At one point it isn't yet 
initialized for the shared lib, but the executable already calls the 
merge_ior function (expecting it to access it's own data of course) --> 
abort.

The gcov_fork function would have the same problem (it itself calls 
gcov_flush, which is hidden).  Simply hiding both (like most other 
functions already are) solves this.

Regstrapping for trunk in progress.  Okay for trunk and 4.3.1?


Ciao,
Michael.
-- 
	* gcov-io.h (__gcov_merge_ior, __gcov_fork): Mark hidden.

Index: gcc/gcov-io.h
===================================================================
--- gcc/gcov-io.h	(revision 133208)
+++ gcc/gcov-io.h	(working copy)
@@ -467,6 +467,9 @@ extern void __gcov_merge_single (gcov_ty
    consecutive values.  */
 extern void __gcov_merge_delta (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
 
+/* The merge function that just ors the counters together.  */
+extern void __gcov_merge_ior (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
+
 /* The profiler functions.  */
 extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned); 
 extern void __gcov_pow2_profiler (gcov_type *, gcov_type);
@@ -474,11 +477,10 @@ extern void __gcov_one_value_profiler (g
 extern void __gcov_indirect_call_profiler (gcov_type *, gcov_type, void *, void *);
 extern void __gcov_average_profiler (gcov_type *, gcov_type);
 extern void __gcov_ior_profiler (gcov_type *, gcov_type);
-extern void __gcov_merge_ior (gcov_type *, unsigned);
 
 #ifndef inhibit_libc
 /* The wrappers around some library functions..  */
-extern pid_t __gcov_fork (void);
+extern pid_t __gcov_fork (void) ATTRIBUTE_HIDDEN;
 extern int __gcov_execl (const char *, const char *, ...) ATTRIBUTE_HIDDEN;
 extern int __gcov_execlp (const char *, const char *, ...) ATTRIBUTE_HIDDEN;
 extern int __gcov_execle (const char *,  const char *, ...) ATTRIBUTE_HIDDEN;



More information about the Gcc-patches mailing list