Date: Fri, 28 Feb 2014 20:22:06 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: freebsd-current@freebsd.org, freebsd-sparc64@freebsd.org Subject: HEADS UP: sparc64 backend for llvm/clang imported Message-ID: <F7AC069B-32B9-4F4E-BF19-EA2E6714F9C3@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
--Apple-Mail=_F386D9EE-AB3F-4620-8745-B4972287C8C5 Content-Type: multipart/mixed; boundary="Apple-Mail=_547EA8F2-71C9-493D-A8EB-8173DA893B0F" --Apple-Mail=_547EA8F2-71C9-493D-A8EB-8173DA893B0F Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Hi, In r262613 I have merged the clang-sparc64 branch back to head. This imports an updated sparc64 backend for llvm and clang, allowing clang to bootstrap itself on sparc64, and to completely build world. To be able to build the GENERIC kernel, there is still one patch to be finalized, see below. If you have any sparc64 hardware, and are not afraid to encounter rough edges, please try out building and running your system with clang. To do so, update to at least r262613, and enable the following options in e.g. src.conf, or in your build environment: WITH_CLANG=y WITH_CLANG_IS_CC=y WITH_LIBCPLUSPLUS=y (optional) Alternatively, if you would rather keep gcc as /usr/bin/cc for the moment, build world using just WITH_CLANG, enabling clang to be built (by gcc) and installed. After installworld, you can then set CC=clang, CXX=clang++ and CPP=clang-cpp for building another world. For building the sparc64 kernel, there is one open issue left, which is that sys/sparc64/include/pcpu.h uses global register variables, and this is not supported by clang. A preliminary patch for this is attached, but it may or may not blow up your system, please beware! The patch changes the pcpu and curpcb global register variables into inline functions, similar to what is done on other architectures. However, the current approach is not optimal, and the emitted code is slightly different from what gcc outputs. Any improvements to this patch are greatly appreciated! Last but not least, thanks go out to Roman Divacky for his work with llvm/clang upstream in getting the sparc64 backend into shape. -Dimitry --Apple-Mail=_547EA8F2-71C9-493D-A8EB-8173DA893B0F Content-Disposition: attachment; filename=clang-sparc64-pcpu-1.diff Content-Type: application/octet-stream; name="clang-sparc64-pcpu-1.diff" Content-Transfer-Encoding: 7bit Index: sys/sparc64/include/pcpu.h =================================================================== --- sys/sparc64/include/pcpu.h (revision 262582) +++ sys/sparc64/include/pcpu.h (working copy) @@ -70,9 +70,28 @@ extern void *dpcpu0; struct pcb; struct pcpu; -register struct pcb *curpcb __asm__(__XSTRING(PCB_REG)); -register struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG)); +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + __asm("mov %" __XSTRING(PCB_REG) ", %0" : "=r" (pcb)); + + return (pcb); +} +#define curpcb (__curpcb()) + +static __inline __pure2 struct pcpu * +__pcpu(void) +{ + struct pcpu *pcpu; + + __asm("mov %" __XSTRING(PCPU_REG) ", %0" : "=r" (pcpu)); + + return (pcpu); +} +#define pcpup (__pcpu()) + #define PCPU_GET(member) (pcpup->pc_ ## member) static __inline __pure2 struct thread * --Apple-Mail=_547EA8F2-71C9-493D-A8EB-8173DA893B0F Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_547EA8F2-71C9-493D-A8EB-8173DA893B0F-- --Apple-Mail=_F386D9EE-AB3F-4620-8745-B4972287C8C5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iEYEARECAAYFAlMQ4eQACgkQsF6jCi4glqMpTwCg2qYgAjHFjrQbvlneghJoomgC kBsAoO+K+goj1WKqOYSD/s5m59wXg45q =XryE -----END PGP SIGNATURE----- --Apple-Mail=_F386D9EE-AB3F-4620-8745-B4972287C8C5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F7AC069B-32B9-4F4E-BF19-EA2E6714F9C3>