From owner-freebsd-current@FreeBSD.ORG Fri Nov 9 12:00:24 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB301B63 for ; Fri, 9 Nov 2012 12:00:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 1111C8FC1D for ; Fri, 9 Nov 2012 12:00:23 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qA9C0CfF024497; Fri, 9 Nov 2012 14:00:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-DKIM: OpenDKIM Filter v2.5.2 kib.kiev.ua qA9C0CfF024497 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qA9C0COl024486; Fri, 9 Nov 2012 14:00:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 9 Nov 2012 14:00:12 +0200 From: Konstantin Belousov To: Steve Kargl Subject: Re: clang and static linking? Message-ID: <20121109120012.GB73505@kib.kiev.ua> References: <20121108231349.GA79485@troutmask.apl.washington.edu> <20121108234932.GA56820@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="P4FumoV6cQve47oF" Content-Disposition: inline In-Reply-To: <20121108234932.GA56820@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 09 Nov 2012 12:00:24 -0000 --P4FumoV6cQve47oF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 08, 2012 at 03:49:32PM -0800, Steve Kargl wrote: > On Thu, Nov 08, 2012 at 03:13:49PM -0800, Steve Kargl wrote: > > Upgraded my amd64 system, yesterday. Needed to rebuild one > > of my projects, and hit > >=20 > > /usr/local/openmpi-1.6.3/bin/mpif90 -static -O2 -pipe -march=3Dnative -= mtune=3Dnative -funroll-loops -ftree-vectorize -Wall -rpath /usr/local/lib/= gcc46 -I/home/kargl/modules -o sasmp sasmp.f90 -L/home/kargl/lib -L. -L/usr= /local/lib -L. -loa -lm90 -llapack -lblas > > //usr/lib/libc.a(isnan.o): In function `isnanf': > > /usr/src/lib/libc/gen/isnan.c:(.text+0x40): multiple definition of `__i= snanf' > > //usr/lib/libm.a(s_isnan.o):/usr/src/lib/msun/src/s_isnan.c:(.text+0x0): > > first defined here > > collect2: ld returned 1 exit status > > *** [sasmp] Error code 1 > >=20 > > Stop in /usr/home/kargl/trunk/oa. > >=20 > > Can't rebuild gcc46 due to clang issue. > > Rebuilding openmpi does not help as openmpi uses gfortran46. > > Maybe there's a library problem. > >=20 > > Error clang base/gcc > > yes libc,libm > > yes libm libc > > no libc libm > > no libc,libm > >=20 > > libm.a compiled with clang > > % nm /usr/lib/libm.a | grep isnan > > U __isnanl > > U __isnanf > > U __isnanl > > U isnan > > U __isnanf > > U isnan > > U isnanf > > s_isnan.o: > > 0000000000000000 T __isnanf > > 0000000000000030 T __isnanl > > 0000000000000000 W isnanf > > U isnan > >=20 > > libm.a compiled with /usr/lib/gcc > > troutmask:fvwm:kargl[232] nm /usr/lib/libm.a | grep isnan > > U __isnanl > > U __isnanf > > U __isnanl > > U __isnanf > > s_isnan.o: > > 0000000000000000 T __isnanf > > 0000000000000030 T __isnanl > > 0000000000000000 W isnanf > >=20 >=20 > This appears to fix the problem. Don't know if this is > th right way to handle it. >=20 > Index: src/s_isnan.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 > --- src/s_isnan.c (revision 242701) > +++ src/s_isnan.c (working copy) > @@ -40,7 +40,6 @@ > u.d =3D d; > return (u.bits.exp =3D=3D 2047 && (u.bits.manl !=3D 0 || u.bits.manh != =3D 0)); > } > -#endif > =20 > int > __isnanf(float f) > @@ -51,6 +50,9 @@ > return (u.bits.exp =3D=3D 255 && u.bits.man !=3D 0); > } > =20 > +__weak_reference(__isnanf, isnanf); > +#endif > + > int > __isnanl(long double e) > { > @@ -60,5 +62,3 @@ > mask_nbit_l(u); > return (u.bits.exp =3D=3D 32767 && (u.bits.manl !=3D 0 || u.bits.manh != =3D 0)); > } > - > -__weak_reference(__isnanf, isnanf); Is this patch against src/msun ? This is only a workaround, which break ABI and older binaries. The bug is apparently in clang, which inserts the undef reference into the resulting object file, when weak alias references undefined symbol. Gnu as does not have the bug. There is some magic switch to reduce amount of clang bugs, like -fno-integrated-as. Please try to compile the problematic .o with the switch. --P4FumoV6cQve47oF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCc8EwACgkQC3+MBN1Mb4iVzwCfQZDGDhJsOqK8KFBIzWwtrctQ bX8AoM8JOIa5Z10knnle7TL1DNv+6h+9 =zqLo -----END PGP SIGNATURE----- --P4FumoV6cQve47oF--