public inbox for
 help / color / mirror / Atom feed
From: "Robert J. Brown" <>
To: Chris Howard <>
Subject: gcc vs g++ and linking with as
Date: Fri, 26 Jun 1998 00:59:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

>>>>> "Chris" == Chris Howard <> writes:

    Chris> binutils 2.9 gcc/g++ 2.8.0

    Chris> Host Sun Sparc Solaris 2.5 Target Motorola Coldfire
    Chris> (-m5200) a.out object format

    Chris> ---

    Chris> Not using stdlib (-nostdlib)

    Chris> We have some code in assembler, and some in C.  Compiling
    Chris> with as,gcc and linking with ld works fine.  Compiling with
    Chris> as,g++ and linking with ld does not work, undefined symbols
    Chris> for those things written in assembler.

You will have to declare the asm routines "extern 'C'" because the
assembler does not perform C++ name mangling for you.

    Chris> The .o files output from g++ compilation have exported
    Chris> symbols that end in '__Fv' whereas the assembler output .o
    Chris> files don't have '__Fv' on the symbols.  Is that the
    Chris> problem?  Is there some way to make it work?  What is __Fv?

These  are C++ mangled names.  Use c++filt to de-mangle C++ mangled
names.  The mangling encodes type information into the names so that
the linker can resolve functions with the same name but different

    Chris> An alternative might be to put the assembly code in C/C++
    Chris> wrapper functions.  Any hints/comments that would be
    Chris> appreciated also.

This is not necessary -- just declare the asm functions extern 'C' and 
the compiler will know not to mangle those names, so the linker will
be able to resolve them.

    Chris> -- Chris Howard Fujitsu Computer Products of America
    Chris> Longmont, Colorado

--------  "And there came a writing to him from Elijah"  [2Ch 21:12]  --------
R. J. Brown III  voice 847 543-4060
Elijah Laboratories Inc. 457 Signal Lane, Grayslake IL 60030  fax 847 543-4061
-----  M o d e l i n g   t h e   M e t h o d s   o f   t h e   M i n d  ------

  parent reply	other threads:[~1998-06-26  0:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-25  8:32 Chris Howard
1998-06-25 20:20 ` C. M. Heard/VVNET, Inc.
1998-06-25 23:03 ` Stephen Williams
1998-06-26  0:59 ` Robert J. Brown [this message]
1998-06-25  9:21 Dave Hansen
     [not found] <>
1998-06-25 10:53 ` Chris Howard
1998-06-25 11:26 Gary Mussar
1998-06-25 11:36 Gary Mussar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).