From owner-freebsd-toolchain@freebsd.org Fri Nov 25 21:31:39 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 7048EC55EC3 for ; Fri, 25 Nov 2016 21:31:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C6418E2 for ; Fri, 25 Nov 2016 21:31:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x232.google.com with SMTP id m5so4211222ioe.3 for ; Fri, 25 Nov 2016 13:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=D2xqM2f/+U6itgUWpcY1AW6xmG3Bil3/ZbFjATpMhx0=; b=xpnD7pOaHd1IB+ZRGnTEMIkhQ+1Hw13yvEUXf73AKZ+8RNBk1iDFrlvIB7QK9w4l35 FZVDvLsFp17ky0GTMEFUKtZDW3/BLtunixUYsAvzYGlGkpPbNR2q4poZDqy/cI7h7Uus j0XGso/56aitL/+iQ0v3XrUNUP0HIW+Sam3ixbZC9ws/i2nl2LzFZPNlkx1A+TzsKEXs OGXxxR8XzjIdmqQnG4/3MCahhTQ25Mtld+1emkTL1VDMHAFAJZnL6CMIpgxDkuhkqe0R YxiDB9pErZVY/5vF2T+VJmJUCfEDrGRigafa8O9KcwWx+N0qnA1EFqgjiaDCSiRnGXex Z2BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=D2xqM2f/+U6itgUWpcY1AW6xmG3Bil3/ZbFjATpMhx0=; b=cpWbeJtALyj04f1rS5dluF9UsfriYVyvX9l5ZhR91j1DN/tazTPWAhX9+muy6fElR9 D1bIcpuSbH1bzrDhqozXplbyAra87198NivGopyybHey7E8XKaOauXBfeiM94Raes38w mQC/Hzm+F/uhiehmr6fSbpNGkmilRWDkTNQCBhMwwjXpiU+E+rLksM2pTkrJS6VErNjt Yo5cisfgdcOD/Ia/glehJAezWCUq5oFVyTqMq7/z4t1GcpXfxN8Nu7+7rHjffC9AMkWa dBq8VxxRHfynBVauu3o71nGiH18w0SgNlVKKf/hsgos3G12tsHPTv7sVXqX392pyqUJ/ lRjw== X-Gm-Message-State: AKaTC03q2lte8a74aXh+VjxAN/E2EmMRrnkH/D411hjgC1+1wZUYGE7ySprlTqZ1+gUiEC+fe1yHcIa9WBcJHw== X-Received: by 10.36.33.151 with SMTP id e145mr8320402ita.14.1480109498417; Fri, 25 Nov 2016 13:31:38 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.27.212 with HTTP; Fri, 25 Nov 2016 13:31:17 -0800 (PST) From: Ed Maste Date: Fri, 25 Nov 2016 16:31:17 -0500 X-Google-Sender-Auth: SK8APcm4xr7vXePe6kY0z7GBq5s Message-ID: Subject: Update on using LLVM's lld linker in the FreeBSD base system To: "freebsd-toolchain@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2016 21:31:39 -0000 LLD developers have made much progress since my last update in August. Two options used by the FreeBSD build, -dc and -r, are now implemented. The issues with linker script expression support and symbol version maps have been addressed. At this point an LLD built from subversion can link a working FreeBSD-HEAD kernel and world except for the boot loaders. Here's an update on the plan I posted previously: > 1. Update lld along with the Clang/LLVM 3.9 update that dim@ is working on. > 2. Add the bmake build infrastructure, installing as /usr/bin/ld.lld > on the same architectures that use Clang (amd64, arm, arm64, i386). I > don't think there's a need for a WITH_LLD src.conf knob, but will add > one if desired. Now complete, with Dimitry's import of Clang 3.9.0 in r309124. There is a WITH_/WITHOUT_LLD knob, which defaults to on for amd64 and arm64, and off for all other architectures for now. > 3. Update lld again (most likely to a snapshot from upstream SVN) once > it is able to link an unmodified FreeBSD kernel. This is now possible, but I'm going to wait for 3.9.0 to settle and for the 3.9.1 update to happen first. > 4. Modify the boot loader and kernel builds to avoid using features > not implemented by lld. There are a few outstanding issues in LLD that prevent linking the boot loaders, but I'm hopeful that they will be addressed in the near future. > 5. Introduce a WITH_LLD_AS_LD knob to have /usr/bin/ld be a ld.lld > hardlink instead of /usr/bin/ld.bfd. I've added this already, to allow for testing and experimentation, and to provide some linker on arm64 image builds that can be used to bootstrap a later GNU ld or LLVM lld. It defaults to on for arm64 and off everywhere else. Note that the knob affects the installed linker (/usr/bin/ld), but does not change the linker actually used to build world and kernel, which remains GNU ld. > 6. Request ports exp-runs and issue a call for testing with 3rd party > software. Fix issues found during this process. This can start happening any time now for LLD 3.9.0, either by setting WITH_LLD_AS_LD with poudriere, or by using -fuse-ld=lld in LDFLAGS. For example, % cd /usr/src/bin/ls % LDFLAGS=-fuse-ld=lld make > 7. Switch /usr/bin/ld to ld.lld by default in head for the Clang-using > architectures. Add a WITHOUT_LLD_AS_LD knob to switch back to GNU ld. It's still too early to plan a switch by default.