Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2014 17:12:17 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        sbruno@freebsd.org
Cc:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: static linking, libc multiple definitions
Message-ID:  <0650344F-FF86-4675-8724-0018AA00740B@FreeBSD.org>
In-Reply-To: <1396799725.37365.4.camel@powernoodle.corp.yahoo.com>
References:  <1396799725.37365.4.camel@powernoodle.corp.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It looks like these two are defined in rpc_com.h, so they are declared =
and defined in multiple compilation units.  That's not actually wrong =
(they'll have common linkage and be merged), but it's discouraged =
because it can mask other errors.  Can you see if this patch fixes it =
for you?

David


Index: rpc/rpc_com.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- rpc/rpc_com.h       (revision 264068)
+++ rpc/rpc_com.h       (working copy)
@@ -86,8 +86,8 @@
 bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
 void __xprt_unregister_unlocked(SVCXPRT *);
=20
-SVCXPRT **__svc_xports;
-int __svc_maxrec;
+extern SVCXPRT **__svc_xports;
+extern int __svc_maxrec;
=20
 __END_DECLS
=20
Index: rpc/svc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- rpc/svc.c   (revision 264068)
+++ rpc/svc.c   (working copy)
@@ -84,6 +84,9 @@
        void                (*sc_dispatch)(struct svc_req *, SVCXPRT *);
 } *svc_head;
=20
+SVCXPRT **__svc_xports;
+int __svc_maxrec;
+
 static struct svc_callout *svc_find(rpcprog_t, rpcvers_t,
     struct svc_callout **, char *);
 static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);


On 6 Apr 2014, at 16:55, Sean Bruno <sbruno@ignoranthack.me> wrote:

> Doing static linking of qemu bsd user applications and I seem to get a
> lot of warnings about multiple symbols in libc.  What's going on here?
>=20
>=20
> /usr/lib/libc.a(svc_simple.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_simple.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_generic.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_generic.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_dg.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_dg.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_bcast.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_bcast.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_vc.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc_vc.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(svc.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(pmap_clnt.o): warning: multiple common of =
`__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(pmap_clnt.o): warning: multiple common of =
`__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_generic.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_generic.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_dg.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_dg.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_vc.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(clnt_vc.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(xdr_rec.o): warning: multiple common of `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(xdr_rec.o): warning: multiple common of `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(rpc_generic.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(rpc_generic.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(getnetconfig.o): warning: multiple common of
> `__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(getnetconfig.o): warning: multiple common of
> `__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(rpcb_clnt.o): warning: multiple common of =
`__svc_maxrec'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
> /usr/lib/libc.a(rpcb_clnt.o): warning: multiple common of =
`__svc_xports'
> /usr/lib/libc.a(rpc_soc.o): warning: previous common is here
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0650344F-FF86-4675-8724-0018AA00740B>