[google gcc-4_8] fix profiledbootstrap

2014-02-04 Thread Rong Xu
Hi,

The attached patch fixes the duplicated definition error in
gcov-tool.c in profiledbootstrap.

Google branch only and tested with profiledbootstrap.

Ok for checking in?

-Rong
Index: gcov-tool.c
===
--- gcov-tool.c (revision 207435)
+++ gcov-tool.c (working copy)
@@ -50,16 +50,23 @@
 
 static int verbose;
 
-gcov_unsigned_t __gcov_lipo_grouping_algorithm;
-gcov_unsigned_t __gcov_lipo_merge_modu_edges;
-gcov_unsigned_t __gcov_lipo_weak_inclusion;
-gcov_unsigned_t __gcov_lipo_max_mem;
-gcov_unsigned_t __gcov_lipo_random_group_size;
-gcov_unsigned_t __gcov_lipo_cutoff;
-gcov_unsigned_t __gcov_lipo_random_seed;
-gcov_unsigned_t __gcov_lipo_dump_cgraph;
-gcov_unsigned_t __gcov_lipo_propagate_scale;
+/* The following defines are needed by dyn-ipa.c.
+   They will also be emitted by the compiler with -fprofile-generate,
+   which means this file cannot be compiled with -fprofile-generate
+   -- otherwise we get duplicated defintions.
+   Make the defines weak to link with other objects/libraries
+   that potentially compiled with -fprofile-generate.  */
 
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_grouping_algorithm;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_merge_modu_edges;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_weak_inclusion;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_max_mem;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_random_group_size;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_cutoff;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_random_seed;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_dump_cgraph;
+__attribute__ ((weak)) gcov_unsigned_t __gcov_lipo_propagate_scale;
+
 /* Remove file NAME if it has a gcda suffix. */
 
 static int
Index: Makefile.in
===
--- Makefile.in (revision 207435)
+++ Makefile.in (working copy)
@@ -4090,6 +4090,9 @@
 GCOV_TOOL_OBJS = gcov-tool.o libgcov-util.o dyn-ipa.o gcov-params.o
 gcov-tool.o: gcov-tool.c $(GCOV_IO_H) intl.h $(SYSTEM_H) coretypes.h $(TM_H) \
$(CONFIG_H) version.h $(DIAGNOSTIC_H)
+   +$(COMPILER) -c $(ALL_CPPFLAGS) \
+ $(filter-out -fprofile-generate -fprofile-use,$(ALL_COMPILERFLAGS)) \
+ $(INCLUDES) -o $@ $
 gcov-params.o: params.c $(PARAMS_H)
+$(COMPILER) -DIN_GCOV_TOOL -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
  $(INCLUDES) -o $@ $


Re: [google gcc-4_8] fix profiledbootstrap

2014-02-04 Thread Xinliang David Li
ok.

David

On Tue, Feb 4, 2014 at 11:28 AM, Rong Xu x...@google.com wrote:
 Hi,

 The attached patch fixes the duplicated definition error in
 gcov-tool.c in profiledbootstrap.

 Google branch only and tested with profiledbootstrap.

 Ok for checking in?

 -Rong