extern "C" for libstdc++ building

Dan Schatzberg dschatz@bu.edu
Wed Sep 12 13:50:00 GMT 2012


Hi,

I am building a gcc toolchain targeted to my custom kernel. I've added
a thread model for my system to the build and provided a header for
the threading in libgcc/config
In this header I define the minimal necessary gthread functions. Most
of them call out to extern functions which I will then link in when
building a binary.

For example:
#ifdef __cplusplus
extern "C" {
#endif
extern int ebbos_gthread_active_p(void);

static inline int
__gthread_active_p(void)
{
  return ebbos_gthread_active_p();
}

#ifdef __cplusplus
}
#endif

This builds fine, but libstdc++ has mangled symbol names for
ebbos_gthread_active_p while libgcc does not. What can I do to make it
so all the libraries are built with non mangled symbol names? I would
have thought the #ifdef __cplusplus would work, but I seem to be
mistaken.

---
Dan Schatzberg



More information about the Gcc-help mailing list