Hi, When running the testsuite on a sh-elf configuration, some test cases fail due to multiple definitions of the function '_init'. This is because on sh-elf every function is automatically prefixed with a '_' char. When defining a C function 'init' in some code, the actual name becomes '_init' and this conflicts with the _init function in libgcc (crti.S). While the behavior of adding the '_' prefix is debatable, the testsuite failures can be easily fixed by the attached patch. Is this OK for trunk?
Cheers, Oleg gcc/testsuite/ChangeLog: * gcc.c-torture/execute/20120919-1.c (init): Rename to initt. * gcc.c-torture/execute/pr42248.c: Likewise. * gcc.c-torture/execute/pr53688.c: Likewise. * gcc.c-torture/execute/pr42614.c: Likewise.
Index: gcc/testsuite/gcc.c-torture/execute/20120919-1.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/20120919-1.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/20120919-1.c (working copy) @@ -9,9 +9,9 @@ extern void abort(void); -void init (int *n, int *dummy) __attribute__ ((noinline,noclone)); +void initt (int *n, int *dummy) __attribute__ ((noinline,noclone)); -void init (int *n, int *dummy) +void initt (int *n, int *dummy) { if(0 == n) dummy[0] = 0; } @@ -20,7 +20,7 @@ { int dummy[1532]; int i = -1, n = 1, s = 0; - init (&n, dummy); + initt (&n, dummy); while (i < n) { if (i == 0) { if (pd[i] > 0) { Index: gcc/testsuite/gcc.c-torture/execute/pr42248.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr42248.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr42248.c (working copy) @@ -12,7 +12,7 @@ } void -init (Scf10 *p, _Complex double y) +initt (Scf10 *p, _Complex double y) { p->a = y; } @@ -20,7 +20,7 @@ int main () { - init (&g1s, (_Complex double)1); + initt (&g1s, (_Complex double)1); check (g1s, (_Complex double)1); return 0; Index: gcc/testsuite/gcc.c-torture/execute/pr53688.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr53688.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr53688.c (working copy) @@ -5,7 +5,7 @@ } p; void __attribute__((noinline,noclone)) -init() +initt() { __builtin_memcpy (p.part1, "FOOBARFOO", sizeof (p.part1)); __builtin_memcpy (p.part2, "SPEC CPU", sizeof (p.part2)); @@ -15,7 +15,7 @@ { char *x; int c; - init(); + initt(); __builtin_memcpy (&headline[0], p.part1, 9); c = 9; x = &headline[0]; Index: gcc/testsuite/gcc.c-torture/execute/pr42614.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr42614.c (revision 218199) +++ gcc/testsuite/gcc.c-torture/execute/pr42614.c (working copy) @@ -12,7 +12,7 @@ TEntry data[2]; } TTable; -TTable *init () +TTable *initt () { return malloc(sizeof(TTable)); } @@ -54,7 +54,7 @@ main () { unsigned char index = 0; - TTable *table_p = init(); + TTable *table_p = initt(); TEntry work; inlined_wrong (&(table_p->data[1]), 1);