On Mon, Dec 1, 2014 at 8:21 AM, Oleg Endo <oleg.e...@t-online.de> wrote: > 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?
The testcases are certainly valid C testcases and thus sh-elf is buggy here. As '_init' is a reserved identifier it shouldn't mangle 'init' as '_init'. Do you never run into "real" applications naming a function 'init'? Richard. > 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.