This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

RE: gcc vs g++ and linking with as


The gcc shell will examine the suffix of the source file to determine if the
language is C or C++. The g++ shell assumes the language is C++ no matter
what the source file extension is. As a result, your file has been compiled
as a C++ file rather than a C file and C++ name mangling has been applied. 

Dave Hansen suggested using extern "C" around the appropriate sections of
code where you don't want C++ name mangling to occur. 

You can tell g++ that the source file is really C rather than C++ with the
-x c option.

You can modify you assembler routines to specify mangled names (which is not
really recommended because the name mangling scheme can change from release
to release).

> -----Original Message-----
> binutils 2.9
> gcc/g++ 2.8.0
> 
> Host Sun Sparc Solaris 2.5
> Target Motorola Coldfire (-m5200)  a.out object format
> 
> ---
> 
> Not using stdlib  (-nostdlib)
> 
> We have some code in assembler, and some in C.
> Compiling with as,gcc and linking with ld works fine.
> Compiling with as,g++ and linking with ld does not work,
>   undefined symbols for those things written in assembler.
> 
> The .o files output from g++ compilation have exported symbols that
> end in '__Fv' whereas the assembler output .o files don't have
> '__Fv' on the symbols.  Is that the problem?  Is there
> some way to make it work?  What is __Fv?
> 
> 
> An alternative might be to put the assembly code in
> C/C++ wrapper functions.  Any hints/comments that
> would be appreciated also.  
> 
> 
> -- 
> Chris Howard            Fujitsu Computer Products of America
>                                           Longmont, Colorado