This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [testsuite] Fix multiple definitions of _init


On Nov 30, 2014, at 11:21 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> 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?

No.  It is reasonable for the test suite to fail when the implementation of gcc is wrong (unclean) or newlib startup code is wrong (unclean).  Since that is what happened, the fix is to fix the cleanliness problem.

I’ve read through the thread…  I think the sh newlib port has a trivial bug and should be fixed.  Either, add an underscore or remove one, just like _all_ the other ports.  There is no complexity here, just a typo (or someone copied the wrong port).

When newlib/libc/sys/sh/crt0.S is fixed, and libgcc/config/sh/crt1.S is fixed, then these test cases will pass.

USER_LABEL_PREFIX  is not the issue.  Let me quote from the code:

        .long   _atexit
        .long   _init

This is wrong.

Also, _fini needs to be fixed as well.  It is unfortunate that the fix involves two packages, but, such is life.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]