diff mbox

Work around Firefox -fprofile-generate crash

Message ID 20150204232814.GC31160@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Feb. 4, 2015, 11:28 p.m. UTC
Hi,
this patch avoids ICE in programs that uses multiple copies of libgcov at once.
It is just a temporary workaround as discussed in the PR log.

Tested on Firefox and comitted.

Honza

2015-02-04  Jan Hubicka  <hubicka@ucw.cz>                                       
                                                                                
        PR gcov/64123                                                           
        * gcov-io.c (gcov_var): Export.

Comments

Richard Biener Feb. 5, 2015, 7:20 a.m. UTC | #1
On February 5, 2015 12:28:14 AM CET, Jan Hubicka <hubicka@ucw.cz> wrote:
>Hi,
>this patch avoids ICE in programs that uses multiple copies of libgcov
>at once.
>It is just a temporary workaround as discussed in the PR log.
>
>Tested on Firefox and comitted.

I expect this will break on platforms with default -fno-common?

Richard.

>Honza
>
>2015-02-04  Jan Hubicka  <hubicka@ucw.cz>                              
>        
>                                                                       
>PR gcov/64123                                                          
>
>* gcov-io.c (gcov_var): Export.                                        
>
>                                                                       
>Index: gcov-io.c
>===================================================================
>--- gcov-io.c	(revision 220411)
>+++ gcov-io.c	(working copy)
>@@ -39,7 +39,7 @@ static void gcov_allocate (unsigned);
>/* Optimum number of gcov_unsigned_t's read from or written to disk. 
>*/
> #define GCOV_BLOCK_SIZE (1 << 10)
> 
>-GCOV_LINKAGE ATTRIBUTE_HIDDEN struct gcov_var
>+struct gcov_var
> {
>   FILE *file;
>   gcov_position_t start;	/* Position of first byte of block */
Jakub Jelinek Feb. 5, 2015, 9:34 a.m. UTC | #2
On Thu, Feb 05, 2015 at 08:20:20AM +0100, Richard Biener wrote:
> On February 5, 2015 12:28:14 AM CET, Jan Hubicka <hubicka@ucw.cz> wrote:
> >Hi,
> >this patch avoids ICE in programs that uses multiple copies of libgcov
> >at once.
> >It is just a temporary workaround as discussed in the PR log.
> >
> >Tested on Firefox and comitted.
> 
> I expect this will break on platforms with default -fno-common?

Well, that can be handled by adding
__attribute__((common)) if IN_LIBGCOV, the library is always built with gcc,
isn't it?  That said, it still won't help if version script makes it
private, and the size of the structure becomes ABI matter.

	Jakub
diff mbox

Patch

Index: gcov-io.c
===================================================================
--- gcov-io.c	(revision 220411)
+++ gcov-io.c	(working copy)
@@ -39,7 +39,7 @@  static void gcov_allocate (unsigned);
 /* Optimum number of gcov_unsigned_t's read from or written to disk.  */
 #define GCOV_BLOCK_SIZE (1 << 10)
 
-GCOV_LINKAGE ATTRIBUTE_HIDDEN struct gcov_var
+struct gcov_var
 {
   FILE *file;
   gcov_position_t start;	/* Position of first byte of block */