This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [testsuite] Fix multiple definitions of _init
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Dec 2014 12:09:48 +0100
- Subject: Re: [testsuite] Fix multiple definitions of _init
- Authentication-results: sourceware.org; auth=none
- References: <1417418467 dot 3387 dot 89 dot camel at yam-132-YW-E178-FTW>
On Mon, Dec 1, 2014 at 8:21 AM, Oleg Endo <oleg.endo@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.