From owner-freebsd-ports@freebsd.org Mon Nov 27 20:39:28 2017 Return-Path: Delivered-To: freebsd-ports@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 3B344DE7649 for ; Mon, 27 Nov 2017 20:39:28 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (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 04A4B63308 for ; Mon, 27 Nov 2017 20:39:28 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x230.google.com with SMTP id i184so30399863ioa.0 for ; Mon, 27 Nov 2017 12:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=sYENJpEuRamPjFOPh2liOdvinZL9D5IiHCMkKJh3sCk=; b=VIwo0gJjoBcM3WHwnBlulEhV4Wib/A0fIkrN3TaojXubsn8FKsMu6OU2t+mEBNoDgq 0VDEguANM9P91TyZqil7yon3iMyDrfnl2FKrxjBijghV7Yja3sJa5w9nDFrLFXUMPbRe oiBgG7pVZkdgM0uF/gGSwGVMg3G7VBh9Spx3NIxTNQ7VfF7J/PBzrdJJ3fzJwUye23uq zLsT+kW0ExjTxM427FxDr9uCt16Mi90iPdLtbOxunzjQ+blT8zfa5qXCEdolBsDX7as7 Rj/KBpKDANup/8OLVOrN0+lOrN+XswCUauK1fqretzUCDzaeEXfIbDDGitVrb9goYqg5 xVlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=sYENJpEuRamPjFOPh2liOdvinZL9D5IiHCMkKJh3sCk=; b=rwBEc1JTbTnfz4KobQ5R7j2r0npyUXJ+3JKh6ZQFVaNZdipT0I+msa/aLLBL7eDuk3 L2LE3LKm4jAkAoaDZ+7YEv8LqBCNWP0Ze301EexSNuk9HSAdigBZcT7QK02pLQ8vT+uY ARNK7pKr3wHGRS7VcqkqxN3gJvpQ7E5DBXWpPovuAlePT6PB2+5meWovTtaFlKZKV+zt JFRijaGtjvaHKi/xZBdULvpfota65/YZJzPOq4zecFQvkVY/eXjd8UBDx8E8q8DL0itB VWeW3uxe6Xnh8TSZxoNTXyJvvtcEKBJ6eudE8wl78sPsIk2uhuJqbPvznesr8E+nHXyb KvGQ== X-Gm-Message-State: AJaThX4z93nBZ4xVDinT0MqmaaFecYxKH/3JZlQxcbHCbX3rucElt43q cmDyWbjD5N4BdYzNIRkI6fSc6D47P1y4GnhW1FLGyB/o X-Google-Smtp-Source: AGs4zMacuCkXKyIqDt7Eyg0ze3Nz1g9Ekk/EnRoAgP2GSt9QnfPPptoHnKbE6/mAu9iXCoAwZgpZJYGXaKvDJT4I4/8= X-Received: by 10.107.16.206 with SMTP id 75mr22153849ioq.83.1511815161271; Mon, 27 Nov 2017 12:39:21 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.85.6 with HTTP; Mon, 27 Nov 2017 12:39:00 -0800 (PST) From: Ed Maste Date: Mon, 27 Nov 2017 15:39:00 -0500 X-Google-Sender-Auth: Pm4xcclUksKf7lQfm5BwfdwPG3I Message-ID: Subject: Ports and LLVM's lld linker To: FreeBSD Ports Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 20:39:28 -0000 We're making good progress on using LLVM's lld linker as FreeBSD's /usr/bin/ld, so I'd like to raise awareness of the new linker within the ports community. Why do we need a new linker? Compared to GNU ld 2.17.50 currently in the FreeBSD base system, lld brings: * AArch64 (arm64) support * Link Time Optimization (LTO) * New ABI support * Other linker optimizations * Much faster link times * Maintained code base There are a pair of src.conf build knobs, WITH_LLD_BOOTSTRAP and WITH_LLD_IS_LD, which control whether lld is used to link during buildworld, and whether lld is installed as /usr/bin/ld. You can also switch the linker by making /usr/bin/ld a symlink to either ld.bfd or ld.lld. These build knobs are enabled by default on arm64 as of FreeBSD 11.1. I have been using lld as /usr/bin/ld on my amd64 laptop and desktop for over a year. (Note that there are a few outstanding issues on i386, and lld is not yet fully as the system linker there. I expect that both i386 and 32-bit arm will be fully working in time for FreeBSD 12.0.) For the ports tree we've been iterating on exp-runs using lld, in PR 214864. A number of issues have been identified during this process, and we've added a LLD_UNSAFE option that can be set in a port's Makefile to fall back to GNU ld (either /usr/bin/ld.bfd or by depending on the binutils port if /usr/bin/ld.bfd does not exist). Note that there's currently a bug in pkg (PR223776) which causes issues registering shared libraries linked by lld; once it's resolved I'd like to encourage port maintainers who are willing to experiment with FreeBSD-current test environment to enable WITH_LLD_IS_LD and ensure that their ports work as expected. I'm happy to help work through any issues that are found.