From patchwork Mon Feb 11 19:30:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 158031 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2984111jaa; Mon, 11 Feb 2019 11:30:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IbDqBx/L1DS2iYNjdI7iyX8mQQFHB26NPpQguva+esAGCkN0L6Uh/SrOUJmSVuIhpdu46De X-Received: by 2002:a63:a80c:: with SMTP id o12mr17346480pgf.185.1549913452232; Mon, 11 Feb 2019 11:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549913452; cv=none; d=google.com; s=arc-20160816; b=K88bZ0xvwLa4qlSg9WV00aIWgEehNvvILeQ2VF2kOjD/ZkJdXzFYdpXC+NnDStzs5Y u8JCiyDO8grXPEGY5DQAA45/3d6U6ypjPFieFBhxCYNU1J8ouE3XzkHQbo1QLcI57ssk CzPgsZ95t1jDSDWVveyfjaz1yDk7mR1CI1r8k3D4zpdqVGmKYCfPPtR9MPwZ3c/RgIVu qFCtREAuNJtcqucSHT3MRjNMUPaNOmVYwbH7vNet1QeGVhyDyBPXdGrpmJk6aqNls9rl QOS7olneiW9FIMT64RjLvpDjJ5e85GsoZDh9pKqcvYQqlqGvOLKc0rqBA9skv8kfa7bZ jQ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=fgo15CY3NgYRpF97TzDUfVV2bSFDYAqgksNtaJxXuEA=; b=BSgia76kXQQn+uVt4OQnCRMeLORS2/R4sKDUn9RZr5IXV2pvC4kMm8EpzFSIdyJR2d QAPQQfO/+8VzCX2RpFxLlQ+inAU1rkFz2jL9G6cf6rtCX9Uw8flrtilhov86CSHYeq0o votXvWqX6jn+r+/4XfLxuPXu9lzRcVgcmXOTrnYJCqjfzB6q6N3TNG5PqA7ardN5Mq1q EZ0eI1xfpwHyKr/noigTu8gv94kWxEGBjiqoEqFlvNNbLutZoHw5Fe+tsbDbsciDMY4N zFd0xCGf/GRFR8wJ56YF7cbI8DfDMlt4FEYlxWqIV95d/2DVBx2cSMArTLKkihu2vFNC cnhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P33ZEVn9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22si9026562pll.284.2019.02.11.11.30.51; Mon, 11 Feb 2019 11:30:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P33ZEVn9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388318AbfBKTau (ORCPT + 31 others); Mon, 11 Feb 2019 14:30:50 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:42865 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388241AbfBKTat (ORCPT ); Mon, 11 Feb 2019 14:30:49 -0500 Received: by mail-qk1-f201.google.com with SMTP id 207so5175451qkf.9 for ; Mon, 11 Feb 2019 11:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=fgo15CY3NgYRpF97TzDUfVV2bSFDYAqgksNtaJxXuEA=; b=P33ZEVn9lWw4ExXF0pVb2kRhsMzsHIZnSCIoTjgHA67m1TBvJkvTccmmchHplJnzYi tK2h0WoALbgU2nZkZBJ2SxgLYpjlLfwsyM0qPDqW+WBGaVbVrCsDmIH6NfN+z6JfOa8G T+CWOFyTf+3H6TpEGTUvVR3EWZKAFrVXa/1HeoxRLcFre021WqnSEaB0okT2cdrUH/Zp j6/LfS6vWUOX8eAWpEshZ9EdhfKAPlTBxfbG9fyzxahFURQCfQqWoyJvynTy4bLNZmAd Fru81lvlu6FIits75GNMSWZETZYzfa/xtYGwkz6eLWKT5EO6vuFx7ZpACi8+YI0l12y3 10LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=fgo15CY3NgYRpF97TzDUfVV2bSFDYAqgksNtaJxXuEA=; b=U2F65+YXMKudz+1Yr7Ch+CT4ZLPc0aERcASVopTdV12tIoJAtmTuJ9UTqUQgizm5nt GALwQcM1HsR+mh864NlNVshll8rbExrWVxwi21/ijrPeqqz2/sPPp9wgYuS3Hflc2xKo vOd+zcFvdztsxNTr1RKy6YA4GzjsRAyv3K6l3jxD5G8/J97Z+F2hYEtdiML2a+tpKfE3 yg6tX5Udpotb2Rxy8vkXlry2agsPafqhuQibWEiyyOZTQSuqHfR28r9nx1Bqn1kswR7s BGvlIxSzvHeNfiYSY1iGJx0THWIsvzJN3oQhjFXcpKfjUCDhD0bxaw/1dIa5SW2auIaY h2ow== X-Gm-Message-State: AHQUAuYjSKd+59Vyq7/SGE3xdHFZZwGgbrcH0jn1SX85U7sDwOmxdTGy Q4qEE+lnz4AleW+09jQWXFIiMJNtinGiHrLPO2E= X-Received: by 2002:a0c:add8:: with SMTP id x24mr21936434qvc.16.1549913448304; Mon, 11 Feb 2019 11:30:48 -0800 (PST) Date: Mon, 11 Feb 2019 11:30:06 -0800 In-Reply-To: <20190211193008.24101-1-ndesaulniers@google.com> Message-Id: <20190211193008.24101-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190211193008.24101-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH v2 4/4] Makefile: lld: set -O2 linker flag when linking with LLD From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: natechancellor@gmail.com, sedat.dilek@gmail.com, keescook@chromium.org, samitolvanen@google.com, michal.lkml@markovi.net, akpm@linux-foundation.org, hannes@cmpxchg.org, peterz@infradead.org, linux@dominikbrodowski.net, npiggin@gmail.com, mathieu.desnoyers@efficios.com, gor@linux.ibm.com, adrian@lisas.de, rgb@redhat.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Desaulniers , Rui Ueyama Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For arm64: 0.34% size improvement with lld -O2 over lld for vmlinux. 3.3% size improvement with lld -O2 over lld for Image.lz4-dtb. Link: https://github.com/ClangBuiltLinux/linux/issues/343 Suggested-by: Rui Ueyama Suggested-by: Nathan Chancellor Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes V1->V2: * add tested and reviewed by tags. Makefile | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.1.791.gb4d0f1c61a-goog diff --git a/Makefile b/Makefile index 00e8e01d23fc..8011555745aa 100644 --- a/Makefile +++ b/Makefile @@ -718,6 +718,10 @@ else KBUILD_CFLAGS += -Wno-unused-but-set-variable endif +ifdef CONFIG_LD_IS_LLD +KBUILD_LDFLAGS += -O2 +endif + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls