C++ on ppc

David Korn dkorn@pixelpower.com
Tue Feb 12 05:29:00 GMT 2002

>-----Original Message-----
>From: Vermeulen Jan [mailto:Jan.Vermeulen@siemens.atea.be]
>Sent: 12 February 2002 13:03

>But when I try to do the same with the C++ program, it always complains
>about something depending on what commandline i use.
>For example: (2.95.3)
>[prompt]$ powerpc-eabi-g++ -nostdlib -nostartfiles -fno-builtin
>-Wl,-Tscript.ld,-N -o test test.cc
>in function 'LED::~LED(void)' :
>undefined reference to '__buildin_delete'
>in function 'main' :
>undefined reference to '__eabi'
>undefined reference to '__get_eh_context'
>collect2: ld returned 1 exit status
>I have a clue why this is so:
>The startfiles include code for setting up global 
>But we don't really need startup code, all the SPR's are already setup
>We just want our C++ program to be compiled to adress 0x2000 
>so we can run

  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".

  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
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'm not quite sure why there should be any reference to __builtin_delete
(*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.

Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

More information about the crossgcc mailing list