From owner-freebsd-toolchain@freebsd.org Tue Aug 2 00:07:09 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44992BA204B for ; Tue, 2 Aug 2016 00:07:09 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-170.reflexion.net [208.70.211.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAD601BA0 for ; Tue, 2 Aug 2016 00:07:08 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 9273 invoked from network); 2 Aug 2016 00:06:08 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 2 Aug 2016 00:06:08 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.90.6) with SMTP; Mon, 01 Aug 2016 20:06:12 -0400 (EDT) Received: (qmail 11069 invoked from network); 2 Aug 2016 00:06:12 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 2 Aug 2016 00:06:12 -0000 X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 07D7E1C407B for ; Mon, 1 Aug 2016 17:05:54 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: Update on using LLVM's lld linker in the FreeBSD base system Message-Id: <2854CBD7-0DA7-4363-967B-6A1566156D4C@dsl-only.net> Date: Mon, 1 Aug 2016 17:06:05 -0700 To: FreeBSD Toolchain Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 00:07:09 -0000 Warner Losh imp at bsdimp.com wrote on Aug 1 22:27:19 UTC 2016 : > On Mon, Aug 1, 2016 at 3:40 PM, Ed Maste = wrote: >=20 > > There is (some) support for mips and powerpc in lld, but I'm not = sure > > how well tested it is. RISC-V is not yet supported but there is a > > desire to have a full LLVM-based RISC-V toolchain. I'm not aware of > > any plan with respect to sparc64 in lld. In any case, I do not plan = to > > address these architectures in the initial lld work. In the near = term > > they will continue to use GNU ld 2.17.50. >=20 > OK. How does this square up against the gcc 4.2 removal timelines and > plans? Once gcc is gone, we'll have to use an external toolchain = anyway > to build mips at least (though clang is close, it isn't there yet = despite Sean > Bruno's wonderful work). This note is about the status for TARGET_ARCH=3Dpowerpc and = TARGET_ARCH=3Dpowerpc64. clang 3.8.0 is not ready for TARGET_ARCH=3Dpowerpc or = TARGET_ARCH=3Dpowerpc64 yet. (I do not know about clang/clang++ 3.9 or later.) So this is another = external tool chain family (so far). clang/clang++ for TARET_ARCH=3Dpowerpc does not even generate code for = the FreeBSD specified ABI's stack handling properties: It requires a so-called = red-zone for signal handling because of when the stack pointer is adjusted for both = directions. clang also does not handle some of the assembler notation that is used = in the kernel. Neither TARGET_ARCH variant handles C++ exceptions correctly for things = built via clang++ 3.8.0. TARGET_ARCH=3Dpowerpc64 is missing soft-float support, blocking building = libstand as I remember. There is more wrong. See https://llvm.org/bugs/show_bug.cgi?id=3D25780 : [META] Using Clang as the FreeBSD/ppc system compiler And its "Depends on" list. There are about 6 reports pending. Additional clang related notes: TARGET_ARCH=3Dpowerpc notes: with a kernel modified to have signal = handling provide a red-zone I've been able to use clang for buildworld and run a system = that is a mix of a gcc 4.2.1 based kernel and a clang 3.8.0 based world. But I = have to avoid using things that would use C++ exception handling if built via the = system clang++ 3.8.0. TARGET_ARCH=3Dpowerpc64 note: I've never got that far with clang 3.8.0. xtoolchain related notes: There is no external toolchain in place for TARGET_ARCH=3Dpowerpc that I = know of. I do build TARGET_ARCH=3Dpowerpc64 via devel/powerpc64-gcc and devel/powerpc64-xtoolchain-gcc . But I've never gotten lib32 to work when built from that toolchain so I normally do not build lib32: crtbeginS code problem(s) from not matching the register usage. Where my mostly TARGET_ARCH=3Dpowerpc and TARGET_ARCH=3Dpowerpc64 source = changes are: # svnlite status /usr/src/ M = /usr/src/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp M /usr/src/lib/csu/powerpc64/Makefile ? /usr/src/sys/amd64/conf/GENERIC-NODBG ? /usr/src/sys/amd64/include/include ? /usr/src/sys/arm/conf/RPI2-NODBG ? /usr/src/sys/arm/include/include M /usr/src/sys/boot/ofw/Makefile.inc M /usr/src/sys/boot/powerpc/Makefile.inc M /usr/src/sys/boot/powerpc/kboot/Makefile M /usr/src/sys/boot/uboot/Makefile.inc M /usr/src/sys/conf/Makefile.powerpc M /usr/src/sys/conf/kern.mk M /usr/src/sys/conf/kmod.mk ? /usr/src/sys/powerpc/conf/GENERIC64-NODBG ? /usr/src/sys/powerpc/conf/GENERIC64vtsc ? /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODEBUG ? /usr/src/sys/powerpc/conf/GENERICvtsc ? /usr/src/sys/powerpc/conf/GENERICvtsc-NODEBUG ? /usr/src/sys/powerpc/include/include M /usr/src/sys/powerpc/ofw/ofw_machdep.c M /usr/src/sys/powerpc/powerpc/exec_machdep.c ? /usr/src/sys/x86/include/include (Something along the way made the include/include's, with the nested one pointing to its parent one. I did not explicitly do this.) Some of the .c source changes are tied to my making PowerMac G5's boot reliably when they have lots of RAM. (Just experimentally derived and observed on the G5 examples that I sometimes have access to.) I build with both vt and sc enabled and PS3 disabled. =3D=3D=3D Mark Millard markmi at dsl-only.net