This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
David Korn wrote: > > >-----Original Message----- > >From: Antti-Pekka Virjonen [mailto:Antti-Pekka.Virjonen@computec.fi] > >Sent: 11 January 2002 15:07 > > >At 14:39 11.1.2002 +0000, David Korn wrote: > >>> If I compile with -S and look at the assembler sources, the only > >>>difference between the gcc generated code between -meabi and -mno-eabi > >>> -options is the different alignment of the stack. With both options, > >>>the call to __eabi is there. > >>> > >>>Is there something wrong with the Gcc 3.0.3 or is it just me ? > >> > >> If you use both options I don't know which one wins the conflict, so > >>there's nothing necessarily wrong with it adding the call in that case. > >>But it definitely shouldn't add the call if you've used -mno-eabi! > > >I guess I will have to look at the specs file. It unfortunately has nothing to do with this issue... > >The older compiler version on the Linux box works differently > >than this (=correcly) with the -mno-eabi. The gcc-2.95.x branch had all kind of stuff for this in the file 'gcc/config/rs6000/rs6000.c', which has been removed or strongly changed in gcc-3.0.x, and putting it back can be more than tough... > >When I use the -mno-eabi, there is a different stack alignment but the > >call to __eabi still insists being there. Probably these stack-things work ok, but putting the call to '__eabi()' or not, following the '-meabi / -mno-eabi' switches, now doesn't... I looked at this and saw the call to '__eabi()' being used instead of the call to '__main()', which is the way to go with non-ELF targets, to run the code for global constructors and destructors for C++, and C in the GCC case. The ELF-targets normally use the 'crtbegin.o' and 'crtend.o', and the 'powerpc-eabi' has now started to use them (gcc-2.95.x didn't yet). So the name '__main' was just replaced with '__eabi' and the call to it being included to the beginning of every 'main()'. This is wrong of course... Unfortunately the "how to output the function prologue"-code in the 'gcc/config/rs6000/rs6000.c' is so complicated that it isn't easy to find a suitable place where to put the : if (TARGET_EABI) <output the call to __eabi> or something. The TARGET_EABI is a macro controlled by the MASK_EABI bit in the TARGET_OPTIONS, and the '-meabi' / '-mno-eabi' control this bit. Please see about these things from the ''gcc/config/rs6000/sysv4.h'... Basically the '__eabi' issue should be taken care in the PPC/RS6000 stuff, but more simple way is to hack the outputting of the '__main' or its replacement... Perhaps this is the big problem now, there isn't a standard mechanism for conditional outputting of the '__main' and the FSF-bureaucrats probably are now thinking about this... Whether to output the replacement for '__main()' or not, is now not decided in the 'gcc/function.c' and the normal '__main()' is in 'gcc/libgcc2.c'. So here are my hacks to this issue : ---------------------- clip ----------------------------------------------- *** function.bak Mon Oct 29 23:51:15 2001 --- function.c Sat Jan 12 16:01:06 2002 *************** *** 6277,6282 **** --- 6277,6285 ---- #endif #ifndef HAS_INIT_SECTION + #ifdef TARGET_EABI + if (TARGET_EABI) + #endif emit_library_call (gen_rtx_SYMBOL_REF (Pmode, NAME__MAIN), 0, VOIDmode, 0); #endif ---------------------- clip ----------------------------------------------- *** libgcc2.bak Sun Dec 16 15:00:18 2001 --- libgcc2.c Sat Jan 12 16:19:07 2002 *************** *** 2778,2784 **** } #endif /* no HAS_INIT_SECTION */ ! #if !defined (HAS_INIT_SECTION) || defined (INVOKE__main) /* Subroutine called automatically by `main'. Compiling a global function named `main' produces an automatic call to this function at the beginning. --- 2778,2784 ---- } #endif /* no HAS_INIT_SECTION */ ! #if !defined (HAS_INIT_SECTION) || (defined (INVOKE__main) && !defined (TARGET_EABI)) /* Subroutine called automatically by `main'. Compiling a global function named `main' produces an automatic call to this function at the beginning. ---------------------- clip ----------------------------------------------- Basically there could be a generic switch instead of the TARGET_EABI, but probably this could serve as an temporary hack... I don't remember other targets having this kind of extra initialization function. If you will get any kind of 'official' fix into this by reporting this bug, please share it with us... Cheers / Pohjanmaan kautta / Laatokka ympäri, Kai ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |