User account creation filtered due to spam.

Bug 5372

Summary: [powerpc-*-eabi] -mno-eabi not working
Product: gcc Reporter: antti-pekka.virjonen
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: gcc-bugs, msebor, segher, vsh
Priority: P3 Keywords: documentation
Version: 3.0.3   
Target Milestone: ---   
Host: i686-pc-cygwin Target: powerpc-*-eabi
Build: i686-pc-cygwin Known to work:
Known to fail: 3.0.3, 4.8.3, 4.9.3, 5.3.0, 6.0 Last reconfirmed: 2016-01-27 00:00:00

Description antti-pekka.virjonen 2002-01-14 02:06:01 UTC
GCC-3.0.3 cross compiler for powerpc-*-eabi running under
Cygwin slightly illbehaves. When used with the -mno-eabi
option, the compiler still generates a call to the __eabi
function. According to the Gcc man-page, this should not
happen. Otherwise the -mno-eabi -option seems to work ok 
(stack alignment changes like it should).

The older compiler (Gcc egcs-2.91.66 under Linux (Redhat 7.1))
works ok in this respect (though it seems to handle these
things differently).

Pretty easy to get around this is to add a void __eabi()
function in the application code... but it would be
nice if it worked correctly out of box.



Cygwin (current) under Win2K
Comment 1 Wolfgang Bangerth 2002-12-21 09:34:51 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: gcc3.0 is slightly out of date by now. Do you know whether
    the same problem still happens with gcc3.2.1?
Comment 2 Dara Hazeghi 2003-05-07 18:32:17 UTC
From: Dara Hazeghi <>
Subject: Re: target/5372: [powerpc-*-eabi] -mno-eabi not working
Date: Wed, 7 May 2003 18:32:17 -0700 
 could the submitter of this report please include a testcase which  
 fails, and if possible, determine if the bug still exists in a more  
 current version of gcc (ie 3.2.3).
Comment 3 Dara Hazeghi 2003-06-02 02:04:04 UTC
*** Bug 5138 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2003-06-28 19:52:04 UTC
In the bug that was marked as dup of this one, the reporter says that there was a 
reference to an undefined function and that it was that way in 3.2.
Comment 5 Andrew Pinski 2004-01-02 06:15:07 UTC
Reconfirmed, the problem is that the header file eabi.h contains this:
/* Invoke an initializer function to set up the GOT.  */
#define NAME__MAIN "__eabi"
#define INVOKE__main
So it is defined always and HAS_INIT_SECTION is not defined so __eabi is aways called 
which goes against the documentation but I think the documentation is wrong and this is 
the correct behavior.
Comment 6 Segher Boessenkool 2013-01-09 16:14:11 UTC
Still happens with current mainline.
Comment 7 Martin Sebor 2016-01-27 18:06:21 UTC
Reconfirmed with 6.0.  The manual says:

Selecting -mno-eabi means that the stack is aligned to a 16-byte boundary, no EABI initialization function is called from main, and the -msdata option only uses r13 to point to a single small data area. 

The following test case shows that a call to __eabi is emitted despite the -mno-eabi option:

$ echo "int main (void) { return 0; }" | /build/sysroot/powerpc-eabispe/bin/powerpc-eabispe-gcc -c -mno-eabi -nostdlib -o a.o -xc - && objdump -t a.o | grep '*UND\*'
00000000         *UND*	00000000 __eabi

I don't know enough about the EABI to tell for sure whether the problem is in the manual or if GCC is wrong for calling __eabi even with the option.
Comment 8 Segher Boessenkool 2016-01-27 22:45:04 UTC
The PowerPC EABI document itself does not say anything about __eabi
or process startup (it even says there are no requirements).