/* Routines required for instrumenting a program. */
/* Compile this one with gcc. */
-/* Copyright (C) 1989-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2015 Free Software Foundation, Inc.
This file is part of GCC.
#else
+/* Some functions we want to bind in this dynamic object, but have an
+ 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_fn(src,dst) \
+ void dst (void) \
+ { src (); }
+
extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
init_mx_once ();
__gthread_mutex_lock (&__gcov_flush_mx);
- __gcov_dump_one (&__gcov_root);
- __gcov_reset ();
+ __gcov_dump_int ();
+ __gcov_reset_int ();
__gthread_mutex_unlock (&__gcov_flush_mx);
}
in order to collect profile in region of interest. */
void
-__gcov_reset (void)
+__gcov_reset_int (void)
{
- gcov_clear (__gcov_root.list);
- __gcov_root.dumped = 0;
+ struct gcov_root *root;
+
+ /* If we're compatible with the master, iterate over everything,
+ otherise just do us. */
+ for (root = __gcov_master.version == GCOV_VERSION
+ ? __gcov_master.root : &__gcov_root; root; root = root->next)
+ {
+ gcov_clear (root->list);
+ root->dumped = 0;
+ }
}
+ALIAS_void_fn (__gcov_reset_int, __gcov_reset);
+
#endif /* L_gcov_reset */
#ifdef L_gcov_dump
so far, in order to collect profile in region of interest. */
void
-__gcov_dump (void)
+__gcov_dump_int (void)
{
- __gcov_dump_one (&__gcov_root);
+ struct gcov_root *root;
+
+ /* If we're compatible with the master, iterate over everything,
+ otherise just do us. */
+ for (root = __gcov_master.version == GCOV_VERSION
+ ? __gcov_master.root : &__gcov_root; root; root = root->next)
+ __gcov_dump_one (root);
}
+ALIAS_void_fn (__gcov_dump_int, __gcov_dump);
+
#endif /* L_gcov_dump */
#ifdef L_gcov_fork
#endif
#ifdef L_gcov_execl
-/* A wrapper for the execl function. Flushes the accumulated profiling data, so
- that they are not lost. */
+/* A wrapper for the execl function. Flushes the accumulated
+ profiling data, so that they are not lost. */
int
__gcov_execl (const char *path, char *arg, ...)