This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Weak symbols and inline
- From: Paul Smith <paul at mad-scientist dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 27 Feb 2014 14:31:27 -0500
- Subject: Re: Weak symbols and inline
- Authentication-results: sourceware.org; auth=none
- References: <1393527190 dot 2823 dot 515 dot camel at pdsdesk> <alpine dot DEB dot 2 dot 10 dot 1402272019340 dot 3594 at laptop-mg dot saclay dot inria dot fr>
- Reply-to: paul at mad-scientist dot net
On Thu, 2014-02-27 at 20:21 +0100, Marc Glisse wrote:
> > When I create a global function marked "inline" I see, using nm, that a
> > weak symbol ("W") is added to the object file for that function.
> >
> > For link-order reasons, I would prefer that the inlined function not
> > generate any (external) symbol; in particular I do NOT want this object
> > to be pulled in from a static library just because it happens to appear
> > first in the archive order. I have another object in the archive which
> > declares a global symbol ("T" in nm) and I want that one linked instead.
>
> Did you try "static" or an anonymous namespace?
The function I'm inlining is actually global operator new. It's not
legal to declare it static or in a namespace.