From patchwork Thu Feb 7 22:01:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 10802189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0848213A4 for ; Thu, 7 Feb 2019 22:03:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9FC32E719 for ; Thu, 7 Feb 2019 22:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80C02E733; Thu, 7 Feb 2019 22:03:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766C12E719 for ; Thu, 7 Feb 2019 22:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbfBGWCy (ORCPT ); Thu, 7 Feb 2019 17:02:54 -0500 Received: from mail-qk1-f202.google.com ([209.85.222.202]:40569 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfBGWCx (ORCPT ); Thu, 7 Feb 2019 17:02:53 -0500 Received: by mail-qk1-f202.google.com with SMTP id y83so1387489qka.7 for ; Thu, 07 Feb 2019 14:02:53 -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=o+AJ8QXrg2DBnZGy5ZK6HlHEP2OPjBoRWVCrnuFEEho=; b=hT0sOTj7b3PLD8UwlhjluEWCgaUqFcwBupSFo+rIsarXYKEEWRH8u5FdyH7Xyl9LMI BzEnQsTHoKZJRQxb6hXGp7lQh0jmZm3p0FYgvxRFytFo6ty1cwfFm3I+I4L4j+PNQH3a gz33UvMVgKqYwpyW7oeYb8bcxcbe+sOBeFgWf5nnPwdONZq/izCL3HqA4tP4mhgnqGAq se5QlTXVg+Jfy5sonuqLJR4zqRK768Pt6ayAIESLzTLDpKkHDCxl1BGzCjwCOHsVcQfN RR8BQfIeBGdlTq30stNQ0Oi8PfTYdErpUaW/zDoFT+nFtJGLGkHwP73oPrd4SRZzqhLI dKWg== 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=o+AJ8QXrg2DBnZGy5ZK6HlHEP2OPjBoRWVCrnuFEEho=; b=jbV41O5bcJ9m+MxLR15jUILKbhrh/nV/sKNjBXMRfBg7RHDAldEQ9PJUtscO03bLDQ Bo1Slowtq2KvyWwbei9iLKs/j8mYbt7xzL9+CfXqkTLxod+z2XkGCu2DxIbpwwuB3ATE S5PsRYTPc466QntPVagGqK4Pzo1IeFVRPACUuLmFzzI9o8l+Q+0hd1LX9pzTivcUZn15 OhU7opNGcjR+VcJjdZG/y+l+367z0mVvxmzLxRDGCq4MaDRKHP11vjuIsE/VBjR1f42o tThxsjSPTk9uJ1naoJpgbJBukis5c0+xYG70i0CKLrnFvNCjsaBCIgKTk4TzqD5vroL4 HWkg== X-Gm-Message-State: AHQUAuZbcjhOfe3SUf5yaXaEVxIFLAKnBBNbWS3zOE5MXxAtoQx3w4zk cLNE3oSPnKB3ohb8M6NA8y+94PYa3nTYubMINy8= X-Google-Smtp-Source: AHgI3IZpSTvveps4gw9Ymi9LhC8L0aj58ECu2QXXZgpry+dP6rog7BE3nXSvtl0Om6ewMCVDLY3yy1gx+yqMFm/NSvc= X-Received: by 2002:a0c:b0b6:: with SMTP id o51mr10787701qvc.40.1549576972858; Thu, 07 Feb 2019 14:02:52 -0800 (PST) Date: Thu, 7 Feb 2019 14:01:52 -0800 In-Reply-To: <20190207220155.81351-1-ndesaulniers@google.com> Message-Id: <20190207220155.81351-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190207220155.81351-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.20.1.791.gb4d0f1c61a-goog Subject: [PATCH 4/4] Makefile: lld: set -O2 linker flag when linking with LLD From: ndesaulniers@google.com To: yamada.masahiro@socionext.com Cc: Nick Desaulniers , Rui Ueyama , Nathan Chancellor , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP -O2 enables tail merging of string table strings. For arm64: 0.34% size improvement with lld -O2 over lld for vmlinux. 3.30% 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 Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 6307c17259ea..c07208ec49d4 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