From patchwork Wed Jul 24 17:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Kogut X-Patchwork-Id: 1136470 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EUuHCijr"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45v2Z43gMvz9s3l for ; Thu, 25 Jul 2019 03:35:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0854085F50; Wed, 24 Jul 2019 17:35:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qOljSK434imG; Wed, 24 Jul 2019 17:35:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 50B9D85F5D; Wed, 24 Jul 2019 17:35:53 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 0092E1BF83B for ; Wed, 24 Jul 2019 17:35:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id F1BAE204B8 for ; Wed, 24 Jul 2019 17:35:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o8iGWv5MMrnA for ; Wed, 24 Jul 2019 17:35:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by silver.osuosl.org (Postfix) with ESMTPS id 2E8701FD90 for ; Wed, 24 Jul 2019 17:35:48 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id y8so22277926plr.12 for ; Wed, 24 Jul 2019 10:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nPQADJ87Bfju+HoG4oj0rAZ1KT91HeeuNp9K7p286aY=; b=EUuHCijrrWW9t4DE44rfHFfAzzifAb1cNIilSBTNnJ/VEJ6AGbNeSAte+yJ5Vg2t77 uMfgR1m9RxLCwel4hGhDynLY3JXCyTbB3ZXe6k5/0fBc9eKXCXTb/t70p0nTBfuYqwMc 9pqmRjQZLpXeW1P/sL6pnR+ld6NUPyW+bgbiya0SVrmrpIq1pqPg+BEcugcvHrhmvNkV RfeWUG/ZO7BIvIOQ8HNiEixRUKXYKno6tMBgLyqksQybyAf6mB79kyTGaD7HXG4EBTLN 2fyZuqNfcacb72hXOnQA4UTF+THXXg77G8URfjfqzawrgw6VGm4/iDuuUEVyz94BA4W2 25JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nPQADJ87Bfju+HoG4oj0rAZ1KT91HeeuNp9K7p286aY=; b=WeXhCtLA7gDTRxbdGshGvXujt84ReIKXVGoDAQJ9IdqFNr+TtRP69rWumDoEbvKml5 46CjBZ2m71rFMrnyOmBTHqMlVdZXe3HXZmgZQdZXlnDdk41043VwWMRO1MRyT7wT7bbG +AjK3duFAi/LbbziiRIBy7ckk3vaeKuLIyda9O09tFNse3w98h3g33bWl5YbNam3Qzzu 5qVWExduRVEC4sVtPB+OVwl8KImgBar8Quba1JDjKWuittVOFlTvzwKOa621TuDWARRD i6ZtCdYw7iyjWBVa/w9bL5xqT8f2m1mGb0SJKBeP+706SDO7sXJe229R0tA6hhToXUUJ qHfQ== X-Gm-Message-State: APjAAAXOnTa0tGlqlJ4YjIDY/J67uF5tae6BNdEkbdJty/Xond/ZJYC4 bYOKYOrtwkXWhmGHXkt08nMcgIdd0c+8Aw== X-Google-Smtp-Source: APXvYqx7RTeWhuM8I39oDWF8MDetw7fFNmGG8cvd1aDLumTin1/Rpnp0Vou/X0bPwRkhGwodC/IYew== X-Received: by 2002:a17:902:28:: with SMTP id 37mr80535222pla.188.1563989747304; Wed, 24 Jul 2019 10:35:47 -0700 (PDT) Received: from localhost.localdomain ([162.251.69.147]) by smtp.gmail.com with ESMTPSA id b16sm75004187pfo.54.2019.07.24.10.35.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 10:35:46 -0700 (PDT) From: Joseph Kogut To: buildroot@buildroot.org Date: Wed, 24 Jul 2019 10:35:38 -0700 Message-Id: <20190724173538.22913-5-joseph.kogut@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724173538.22913-1-joseph.kogut@gmail.com> References: <20190724173538.22913-1-joseph.kogut@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [RFC PATCH 4/4] Add linker override to config options X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joseph Kogut , Thomas De Schampheleire , Thomas Petazzoni , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Joseph Kogut --- Config.in | 27 +++++++++++++++++++++++++++ package/gcc/gcc.mk | 3 ++- package/glibc/glibc.mk | 3 +++ toolchain/toolchain-wrapper.mk | 4 ++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Config.in b/Config.in index 757ad1ca40..576d95305d 100644 --- a/Config.in +++ b/Config.in @@ -318,6 +318,33 @@ config BR2_JLEVEL Number of jobs to run simultaneously. If 0, determine automatically according to number of CPUs on the host system. +choice + prompt "Default linker" + default BR2_LINKER_BFD + help + Choose the default linker + Individual packages may override this choice + +config BR2_LINKER_BFD + bool "GNU ld" + help + GNU GCC linker + +config BR2_LINKER_LLD + bool "LLVM LLD" + select BR2_PACKAGE_HOST_LLD + help + Clang/LLVM linker + + Offers a faster link times compared to GNU linkers such as ld.bfd and + ld.gold. + + NOTE: This option requires building LLVM, which is time consuming itself. + + https://lld.llvm.org/ + +endchoice + config BR2_CCACHE bool "Enable compiler cache" help diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index 46ad16df13..aef0038639 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -85,7 +85,8 @@ HOST_GCC_COMMON_DEPENDENCIES = \ host-gmp \ host-mpc \ host-mpfr \ - $(if $(BR2_BINFMT_FLAT),host-elf2flt) + $(if $(BR2_BINFMT_FLAT),host-elf2flt) \ + $(if $(BR2_LINKER_LLD),host-lld) HOST_GCC_COMMON_CONF_OPTS = \ --target=$(GNU_TARGET_NAME) \ diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk index f8d8c1bd87..1c06028241 100644 --- a/package/glibc/glibc.mk +++ b/package/glibc/glibc.mk @@ -32,6 +32,9 @@ GLIBC_LICENSE_FILES = COPYING COPYING.LIB LICENSES # glibc is part of the toolchain so disable the toolchain dependency GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO +# Glibc requires ld.bfd +GLIBC_MAKE_ENV += BR2_NO_LINKER_OVERRIDE=1 + # Before glibc is configured, we must have the first stage # cross-compiler and the kernel headers GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk \ diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index ca66fa7ba4..ff7a7ab448 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -16,6 +16,10 @@ endif TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' +ifeq ($(BR2_LINKER_LLD),y) +TOOLCHAIN_WRAPPER_ARGS += -DBR_LINKER='"lld"' +endif + TOOLCHAIN_WRAPPER_OPTS = \ $(call qstrip,$(BR2_SSP_OPTION)) \ $(call qstrip,$(BR2_TARGET_OPTIMIZATION))