diff mbox

fix gfcov regression

Message ID 540C9FFA.1080807@acm.org
State New
Headers show

Commit Message

Nathan Sidwell Sept. 7, 2014, 6:12 p.m. UTC
On 09/05/14 03:06, roger@nextmovesoftware.com wrote:

> ../../../../gcc/libgcc/libgcov-interface.c:137:1: warning: alias definitions not
> supported in Mach-O; ignored
>   ALIAS (__gcov_reset_int, __gcov_reset);

That doesn't sound like it's going to work then.  I've gone with the attached 
patch.  If someone wants to invest time using an alias on targets that support 
it, that'd be great!

nathan
2014-09-05  Nathan sidwell  <nathan@acm.org>

	* libgcov-interface.c (STRONG_ALIAS): Rename to ...
	(ALIAS_weak): ... here. Use forwarding function.  Adjust uses.
diff mbox

Patch

Index: libgcc/libgcov-interface.c
===================================================================
--- libgcc/libgcov-interface.c	(revision 214972)
+++ libgcc/libgcov-interface.c	(working copy)
@@ -42,11 +42,14 @@  void __gcov_dump (void) {}
 
 #else
 
-
 /* Some functions we want to bind in this dynamic object, but have an
-   overridable global alias.  */
-#define STRONG_ALIAS(src,dst) \
-  extern __typeof (src) dst __attribute__((alias (#src)))
+   overridable global alias.  Unfortunately not all targets support
+   aliases, so we just have a forwarding function.  That'll be tail
+   called, so the cost is a single jump instruction.*/
+
+#define ALIAS_void(src,dst) \
+  void dst (void)	    \
+  { src (); }
 
 extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
 extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
@@ -133,7 +136,7 @@  __gcov_reset_int (void)
   __gcov_root.dumped = 0;
 }
 
-STRONG_ALIAS (__gcov_reset_int, __gcov_reset);
+ALIAS_void (__gcov_reset_int, __gcov_reset);
 
 #endif /* L_gcov_reset */