From patchwork Mon Dec 13 22:49:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12674777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F267C433F5 for ; Mon, 13 Dec 2021 22:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243888AbhLMWtd (ORCPT ); Mon, 13 Dec 2021 17:49:33 -0500 Received: from aposti.net ([89.234.176.197]:34430 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243903AbhLMWtd (ORCPT ); Mon, 13 Dec 2021 17:49:33 -0500 From: Paul Cercueil To: Thomas Bogendoerfer , Nathan Chancellor , Nick Desaulniers Cc: list@opendingux.net, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Paul Cercueil Subject: [PATCH 1/3] MIPS: boot/compressed: Disable abicalls Date: Mon, 13 Dec 2021 22:49:12 +0000 Message-Id: <20211213224914.1501303-2-paul@crapouillou.net> In-Reply-To: <20211213224914.1501303-1-paul@crapouillou.net> References: <20211213224914.1501303-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Avoid complaints from Clang/LLVM by building the decompress program with -mno-abicalls. Signed-off-by: Paul Cercueil --- arch/mips/boot/compressed/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index f27cf31b4140..4c9ecfbb0ef4 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile @@ -27,10 +27,10 @@ ifdef CONFIG_CPU_LOONGSON64 KBUILD_CFLAGS := $(filter-out -march=loongson3a, $(KBUILD_CFLAGS)) -march=mips64r2 endif -KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ -D__DISABLE_EXPORTS \ +KBUILD_CFLAGS := $(KBUILD_CFLAGS) -mno-abicalls -D__KERNEL__ -D__DISABLE_EXPORTS \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" -KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ +KBUILD_AFLAGS := $(KBUILD_AFLAGS) -mno-abicalls -D__ASSEMBLY__ \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) From patchwork Mon Dec 13 22:49:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12674779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17004C433F5 for ; Mon, 13 Dec 2021 22:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243900AbhLMWtk (ORCPT ); Mon, 13 Dec 2021 17:49:40 -0500 Received: from aposti.net ([89.234.176.197]:34472 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243745AbhLMWtk (ORCPT ); Mon, 13 Dec 2021 17:49:40 -0500 From: Paul Cercueil To: Thomas Bogendoerfer , Nathan Chancellor , Nick Desaulniers Cc: list@opendingux.net, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Paul Cercueil Subject: [PATCH 2/3] MIPS: boot/compressed: Build without LTO Date: Mon, 13 Dec 2021 22:49:13 +0000 Message-Id: <20211213224914.1501303-3-paul@crapouillou.net> In-Reply-To: <20211213224914.1501303-1-paul@crapouillou.net> References: <20211213224914.1501303-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org We need a valid ELF object for dummy.o, so that objcopy can insert the vmlinuz payload. Therefore, we must build the decompresser program without LTO, otherwise dummy.o will be LLVM bytecode instead of a ELF object file. Building the decompresser with LTO wouldn't make much sense anyway, unlike building the vmlinuz itself with LTO. Signed-off-by: Paul Cercueil Reviewed-by: Nathan Chancellor --- arch/mips/boot/compressed/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index 4c9ecfbb0ef4..2d01c50fb0b1 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile @@ -27,6 +27,9 @@ ifdef CONFIG_CPU_LOONGSON64 KBUILD_CFLAGS := $(filter-out -march=loongson3a, $(KBUILD_CFLAGS)) -march=mips64r2 endif +# Disable LTO +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) + KBUILD_CFLAGS := $(KBUILD_CFLAGS) -mno-abicalls -D__KERNEL__ -D__DISABLE_EXPORTS \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" From patchwork Mon Dec 13 22:49:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12674781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D27C433EF for ; Mon, 13 Dec 2021 22:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243745AbhLMWtr (ORCPT ); Mon, 13 Dec 2021 17:49:47 -0500 Received: from aposti.net ([89.234.176.197]:34516 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243841AbhLMWtr (ORCPT ); Mon, 13 Dec 2021 17:49:47 -0500 From: Paul Cercueil To: Thomas Bogendoerfer , Nathan Chancellor , Nick Desaulniers Cc: list@opendingux.net, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Paul Cercueil Subject: [PATCH 3/3] MIPS: Add support for LTO Date: Mon, 13 Dec 2021 22:49:14 +0000 Message-Id: <20211213224914.1501303-4-paul@crapouillou.net> In-Reply-To: <20211213224914.1501303-1-paul@crapouillou.net> References: <20211213224914.1501303-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Allow CONFIG_LTO_CLANG to be enabled. The ThinLTO variant is not yet supported. While this option allows to build a LTO'd kernel, the result kernel file ends up being *bigger* than the non-LTO variant (about 3.6 MiB with LTO vs. 3.1 MiB without with a ZSTD-compressed kernel). Signed-off-by: Paul Cercueil Reviewed-by: Nathan Chancellor --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0215dc1529e9..6987db8d5f64 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -22,6 +22,7 @@ config MIPS select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_SPINLOCKS select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES + select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_LD_ORPHAN_WARN