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]

RE: C++ on ppc


__builtin_delete gets called in the generated destructor, i think. you'll need
to define a stub (or implement _builtin_new and _buildin_delete)
see
http://www.mega-tokyo.com/os/os-faq-cpp.html#start


Rob Taylor


> -----Original Message-----
> From: crossgcc-owner@sources.redhat.com
> [mailto:crossgcc-owner@sources.redhat.com]On Behalf Of Vermeulen Jan
> Sent: Tuesday, February 12, 2002 2:15 PM
> To: CrossGCC (E-mail)
> Subject: RE: C++ on ppc
>
>
> David,
>
> >   You should be able to use -fno-exceptions to fix the _eh_context
> > references, but remember your C++ code cannot then use "try"
> > and "throw".
>
> With your help, I've come quite a bit further.
> Exceptions are, at the moment, not necessary, so that's ok.
>
> >   You should also be able to use -mno-eabi to prevent the
> > call to __eabi;
> > but that option was broken in at least some gcc versions, so
> > if it doesn't
>
> The -mno-eabi has no effect on GCC 3.0.x (there was a topic
> about this on the list some while ago), so i'll stick to
> 2.95.3 for now.
>
> I tried and it doesn't complain about __eabi anymore.
>
> > work, just rename 'main' to something else, and change the
> > name in your
> > linker script vector0 to match.  The call to __eabi is inserted by the
> > compiler in any function called 'main', just using a name match.
>
> I tried to replace 'main' with the name 'myprog' and adjusted the
> linker script accordingly; replacing 'main' with 'myprog'.
>
> The linker spit out this (copy&paste):
> [prompt]$ powerpc-eabi-g++ -nostdlib -nostartfiles -mno-eabi -fno-exceptions
> -fno-builtin -Wl,-Tiad.ld,-N -o cpp cpp.cc
> iad.ld:24: undefined symbol `myprog' referenced in expression
> collect2: ld returned 1 exit status
> [prompt]$
>
> > (*please* folks, copy and paste your error messages, don't
> > retype them,
> > because I've never even once seen anyone do that and not make
> > a mistake that
> > could be misleading) if you aren't actually calling new and
> > delete, but I
> > suspect that what you might want is to *remove* the
> > -fno-builtin; that way
> > you will get the builtin inline versions of the function
> > actually placed
> > into your code, rather than being left with references to be filled by
> > external (i.e. non-builtin) functions.  I'm not quite sure
> > about this bit -
> > try it and see.
>
> Ok, sorry 'bt that.
> Here is a full copy/paste of the error.
>
> Whether i put "-fno-builtin" on the commandline or not, does not matter.
> The output is exactly the same.
>
> [(15:00:01)jan ~/cpp]$ powerpc-eabi-g++ -v -nostdlib -nostartfiles -mno-eabi
> -fno-exceptions -fno-builtin -Wl,-Tscript.ld,-N -o ledtest ledtest.cc
> Reading specs from /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/specs
> gcc version 2.95.3 20010315 (release)
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/cpp0 -lang-c++ -v -D__GNUC__=2
> -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -DPPC -D__embedded__
> -D__PPC__ -D__embedded__ -D__PPC -Asystem(embedded) -Acpu(powerpc)
> -Amachine(powerpc) -D__CHAR_UNSIGNED__ -D_CALL_SYSV -D_BIG_ENDIAN
> -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC cpp.cc
> /home/jan/tmp/ccigvRag.ii
> GNU CPP version 2.95.3 20010315 (release) (PowerPC Embedded)
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/../../../../include/g++-3
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/include
>
> /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/../../../../powerpc-eabi/sys-incl
> ude
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/../../../../powerpc-eabi/include
> End of search list.
> The following default directories have been omitted from the search path:
> End of omitted list.
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/cc1plus
> /home/jan/tmp/ccigvRag.ii -quiet -dumpbase cpp.cc -mno-eabi -version
> -fno-exceptions -fno-builtin -o /home/jan/tmp/cciEpHPn.s
> GNU C++ version 2.95.3 20010315 (release) (powerpc-eabi) compiled by GNU C
> version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk).
>  /usr/local/powerpc-eabi/bin/as -mppc -V -Qy -o /home/jan/tmp/cc4eixnA.o
> /home/jan/tmp/cciEpHPn.s
> GNU assembler version 2.11.2 (powerpc-eabi) using BFD version 2.11.2
>  /usr/local/lib/gcc-lib/powerpc-eabi/2.95.3/collect2 -V -Qy -dn -Bstatic -o
> ledtest -L/usr/local/lib/gcc-lib/powerpc-eabi/2.95.3
> -L/usr/local/powerpc-eabi/lib -Tscript.ld -N /home/jan/tmp/cc4eixnA.o
> /home/jan/tmp/cc4eixnA.o: In function `LED::~LED(void)':
> /home/jan/tmp/cc4eixnA.o(.text+0xac): undefined reference to
> `__builtin_delete'
> GNU ld version 2.11.2 (with BFD 2.11.2)
>   Supported emulations:
>    elf32ppc
>    elf32ppclinux
>    elf32ppcsim
> collect2: ld returned 1 exit status
> [(15:01:12)jan ~/cpp]$
>
> Still, the __builtin_delete persists...
>
> I'm not using 'new' or 'delete' in any of my code AFAIK.
> There is only one class, called LED:
>
> class LED
> {
> private:
> 	unsigned char ledcode;
> public:
> 	LED();
> 	LED(unsigned char initcode);
> 	void set(unsigned char code);
> 	unsigned char get();
> };
>
> And then the implementations that simply update the private member ledcode.
> There is also a 'main' (or 'myprog') which does :
>
> int main(void)
> {
>  LED myled;
>
>  myled.set(0xfe);
>
>  return 0;
> }
>
>
> I hope this can help,
> Jan
>
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>



------
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]