Date: Wed, 28 Dec 2011 00:12:43 +0100 From: Ed Schouten <ed@80386.nl> To: mips@FreeBSD.org, sparc64@FreeBSD.org Subject: (Finally) migrate MIPS and SPARC64 to libcompiler_rt Message-ID: <20111227231243.GB1895@hoeg.nl>
next in thread | raw e-mail | index | archive | help
--lCAWRPmW1mITcIfM Content-Type: multipart/mixed; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline --tjCHc7DPkfUGtrlw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, Quite some time ago, we switched from libgcc to libcompiler_rt on all architectures except MIPS and SPARC64. At the time I was also quite busy with other FreeBSD and LLVM related things, so I decided to leave MIPS and SPARC64 the way they were. The reason why we haven't switched these two architectures yet, is due to a minor bug in __ctzdi2() calling __builtin_ctz(). On these two architectures, this ends up calling __ctzdi2() again, causing a hang. I have filed a bug for this at the LLVM folks, but until that time I want to ask if there are people that are willing to test the attached patch on their MIPS and SPARC64 systems. The only thing you need to do: rebuild world two iterations to see whether everything works properly. I do advise you to test this patch in a jail first. If this patch fixes the problem, I will commit the change to SVN. As of then, every architecture will use libcompiler_rt. This also makes <stdatomic.h> work on MIPS properly. Thanks, --=20 Ed Schouten <ed@80386.nl> WWW: http://80386.nl/ --tjCHc7DPkfUGtrlw Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ctzdi2.diff" Content-Transfer-Encoding: quoted-printable Index: gnu/lib/libgcc/Makefile =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 --- gnu/lib/libgcc/Makefile (revision 228913) +++ gnu/lib/libgcc/Makefile (working copy) @@ -15,10 +15,6 @@ =20 .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" =20 -.if ${TARGET_CPUARCH} =3D=3D "sparc64" || ${TARGET_CPUARCH} =3D=3D "mips" -LIB=3D gcc -.endif - .PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR} =20 CFLAGS+=3D -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ Index: lib/libcompiler_rt/Makefile =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 --- lib/libcompiler_rt/Makefile (revision 228919) +++ lib/libcompiler_rt/Makefile (working copy) @@ -172,13 +172,11 @@ . endif .endfor =20 -.if ${MACHINE_CPUARCH} !=3D "sparc64" && ${MACHINE_CPUARCH} !=3D "mips" -. if ${MK_INSTALLLIB} !=3D "no" +.if ${MK_INSTALLLIB} !=3D "no" SYMLINKS+=3Dlibcompiler_rt.a ${LIBDIR}/libgcc.a -. endif -. if ${MK_PROFILE} !=3D "no" +.endif +.if ${MK_PROFILE} !=3D "no" SYMLINKS+=3Dlibcompiler_rt_p.a ${LIBDIR}/libgcc_p.a -. endif .endif =20 .if ${MACHINE_CPUARCH} =3D=3D "amd64" || ${MACHINE_CPUARCH} =3D=3D "i386" = || \ Index: contrib/compiler-rt/lib/ctzdi2.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 --- contrib/compiler-rt/lib/ctzdi2.c (revision 228913) +++ contrib/compiler-rt/lib/ctzdi2.c (working copy) @@ -15,6 +15,12 @@ =20 #include "int_lib.h" =20 +/* Workaround for LLVM bug 11663. */ +#if defined(__sparc64__) || defined(__mips_n64) +si_int __ctzsi2(si_int); +#define __builtin_ctz __ctzsi2 +#endif + /* Returns: the number of trailing 0-bits */ =20 /* Precondition: a !=3D 0 */ --tjCHc7DPkfUGtrlw-- --lCAWRPmW1mITcIfM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO+lDrAAoJEG5e2P40kaK72LgQAKsyLAEeDaC/EwLnAkVKD3rw 4oKpcRJtuEPEQwZNHZtnF3EZFKQXcE9nSl0KbMdMrbA/g4DhVkU6XyCG7Lipwzzp IcAmgm/gLPdBhuYzq2Rdo+SRfPmO3gqMau91HeGkpegrCPy4g/vjc6GW3hHrTJO0 nJmoGRUOvWjUDifkuvU9fxbALzfNu8rZ8j1xXeR2EB+3XMCJ0AyAO1wumLo+nn6j 8oLVyiwfZzUVSvoHeZqy7ioi9GVXW0Mnu9v6nkU9cvKolew3v6d4moFX9qRC3H+h +epMAZM00z7QgODApIswoNtX9ZxU7+w7AkGq1vMNCMsI07dt+acObCEc7d4PoLFz EVRdUC+oZNLllqjLOKiKr2Eki4thb0Tf8IMufboZ0tY9fLUpKxzc0wEoJ4PSFnj6 XyawiqAXcibtE9vg5bZ/l3JuT/PFPphwKU6UKA+55ZdAGxtBFC0ao6nw2+Ck+kUJ IYLJukvu0Yi7zWHkO8386t1lTrybpA9bTg2Y4XPAXGKhb6L9MUZ3x5GrjnsAhMP3 3bGTDO4x133axwD6E5qykpD53qr3tjOkGNLY8ig6n6X/lzi0r2dgV0lh6Wz8UZ4M WjHZFKnwfTLy4R97+yhJc02D3jKwnBSqNXyuijz7sWWrsnvY/Ar92iNxlIa/RfpI kAufMnLjzuZSlEGo7JfC =MBOq -----END PGP SIGNATURE----- --lCAWRPmW1mITcIfM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111227231243.GB1895>