From owner-freebsd-current@FreeBSD.ORG Sun Apr 6 16:12:35 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B12DAF4; Sun, 6 Apr 2014 16:12:35 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B420CA6; Sun, 6 Apr 2014 16:12:34 +0000 (UTC) Received: from [192.168.48.40] ([213.160.116.66]) (authenticated bits=0) by theravensnest.org (8.14.7/8.14.7) with ESMTP id s36GCOhf091055 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 6 Apr 2014 16:12:26 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: static linking, libc multiple definitions From: David Chisnall In-Reply-To: <1396799725.37365.4.camel@powernoodle.corp.yahoo.com> Date: Sun, 6 Apr 2014 17:12:17 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0650344F-FF86-4675-8724-0018AA00740B@FreeBSD.org> References: <1396799725.37365.4.camel@powernoodle.corp.yahoo.com> To: sbruno@freebsd.org X-Mailer: Apple Mail (2.1874) Cc: "freebsd-current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Apr 2014 16:12:35 -0000 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 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