aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-08 14:27:31 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-08 14:27:31 +0100
commit9e66e106ab1018782aba2630f01a059cb3c839d1 (patch)
tree555df8dabc4c9d0caf61c53fd5283f58d15974f5
parentbd73623c908777daae42b70ee841e9c84fa7b9b4 (diff)
downloadgcc-9e66e106ab1018782aba2630f01a059cb3c839d1.zip
gcc-9e66e106ab1018782aba2630f01a059cb3c839d1.tar.gz
gcc-9e66e106ab1018782aba2630f01a059cb3c839d1.tar.bz2
re PR gcov-profile/52150 (junk at end of line in Firefox PGO build)
PR gcov-profile/52150 * coverage.c: Include target.h. (build_var): Call targetm.strip_name_encoding on the assembler name. Change one _ into . or $ if the target allows it. * Makefile.in (coverage.o): Depend on $(TARGET_H). * gcc.dg/tree-prof/pr52150.c: New test. From-SVN: r184006
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/coverage.c23
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr52150.c16
5 files changed, 44 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5398c68..fcea3cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2012-02-08 Jakub Jelinek <jakub@redhat.com>
+ PR gcov-profile/52150
+ * coverage.c: Include target.h.
+ (build_var): Call targetm.strip_name_encoding on the assembler name.
+ Change one _ into . or $ if the target allows it.
+ * Makefile.in (coverage.o): Depend on $(TARGET_H).
+
PR rtl-optimization/52139
* cfgrtl.c (cfg_layout_merge_blocks): If BB_END
is a BARRIER after emit_insn_after_noloc, move BB_END
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c9ecc4b..770925f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3002,7 +3002,7 @@ coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
$(FUNCTION_H) $(BASIC_BLOCK_H) toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) langhooks.h $(COVERAGE_H) \
$(HASHTAB_H) tree-iterator.h $(CGRAPH_H) $(TREE_PASS_H) gcov-io.c $(TM_P_H) \
- $(DIAGNOSTIC_CORE_H) intl.h gt-coverage.h
+ $(DIAGNOSTIC_CORE_H) intl.h gt-coverage.h $(TARGET_H)
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) \
$(EMIT_RTL_H) $(DIAGNOSTIC_CORE_H) output.h $(FUNCTION_H) $(TREE_PASS_H) \
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 091e7e3..ce8b175 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1,6 +1,6 @@
/* Read and write coverage files, and associated functionality.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
- 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
+ 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
based on some ideas from Dain Samples of UC Berkeley.
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "intl.h"
#include "filenames.h"
+#include "target.h"
#include "gcov-io.h"
#include "gcov-io.c"
@@ -656,13 +657,25 @@ static tree
build_var (tree fn_decl, tree type, int counter)
{
tree var = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL_TREE, type);
- tree fn_name = DECL_ASSEMBLER_NAME (fn_decl);
- char *buf = (char *)alloca (IDENTIFIER_LENGTH (fn_name) + 10);
+ const char *fn_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fn_decl));
+ char *buf;
+ size_t fn_name_len, len;
+
+ fn_name = targetm.strip_name_encoding (fn_name);
+ fn_name_len = strlen (fn_name);
+ buf = XALLOCAVEC (char, fn_name_len + 8 + sizeof (int) * 3);
if (counter < 0)
- sprintf (buf, "__gcov__%s", IDENTIFIER_POINTER (fn_name));
+ strcpy (buf, "__gcov__");
else
- sprintf (buf, "__gcov%u_%s", counter, IDENTIFIER_POINTER (fn_name));
+ sprintf (buf, "__gcov%u_", counter);
+ len = strlen (buf);
+#ifndef NO_DOT_IN_LABEL
+ buf[len - 1] = '.';
+#elif !defined NO_DOLLAR_IN_LABEL
+ buf[len - 1] = '$';
+#endif
+ memcpy (buf + len, fn_name, fn_name_len + 1);
DECL_NAME (var) = get_identifier (buf);
TREE_STATIC (var) = 1;
TREE_ADDRESSABLE (var) = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 366103e..6cedc9e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-02-08 Jakub Jelinek <jakub@redhat.com>
+ PR gcov-profile/52150
+ * gcc.dg/tree-prof/pr52150.c: New test.
+
PR rtl-optimization/52139
* gcc.dg/pr52139.c: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr52150.c b/gcc/testsuite/gcc.dg/tree-prof/pr52150.c
new file mode 100644
index 0000000..accdb4a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr52150.c
@@ -0,0 +1,16 @@
+/* PR gcov-profile/52150 */
+/* { dg-options "-O0" } */
+
+void foo () __asm__ ("bar");
+
+void
+foo ()
+{
+}
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}