From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0043C433E6 for ; Wed, 10 Mar 2021 21:57:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 790F164FC4 for ; Wed, 10 Mar 2021 21:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbhCJV4u (ORCPT ); Wed, 10 Mar 2021 16:56:50 -0500 Received: from pb-sasl-trial20.pobox.com ([173.228.157.50]:60664 "EHLO pb-sasl-trial20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbhCJV4W (ORCPT ); Wed, 10 Mar 2021 16:56:22 -0500 X-Greylist: delayed 503 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Mar 2021 16:56:22 EST Received: from pb-sasl-trial20.pobox.com (localhost.local [127.0.0.1]) by pb-sasl-trial20.pobox.com (Postfix) with ESMTP id 2602A1D123; Wed, 10 Mar 2021 16:47:55 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=i+EEhpOIzYGRI0g4C4YHfxUGVbY=; b=kl2TCk L03XOSJ247uByISeVdnxUCsMBZHrMlGfmf+YXPvjJtpkNwLqgM+K70UqN5XpXAUF HZHlm4P9do1U7EKmixT3ot0yRPFAOar2HsIK7n39r5eK1375BjRnkhIyesOl/mV2 HbSHnhtZSV2YDpIbKMFYWYvuFbtL7z0HwlUL4= Received: from pb-smtp21.sea.icgroup.com (pb-smtp21.pobox.com [10.110.30.21]) by pb-sasl-trial20.pobox.com (Postfix) with ESMTP id 090D11D120; Wed, 10 Mar 2021 16:47:55 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=pOv0CrVAzO2rWPsLUvMZRUiGATfAGrQpGeNjU/+31FE=; b=MKKUhi2+FM2CTDzaG8bEkJdxKY/fSSHY5SweTBdCGkjXb/SeRVjGGnKjQP8t9r9wa7cblzkU9c4xgAvVe78f7OV0eJTkiXVNUWt2KcL2O/ny8ju6odBcwWf/ZBa7HkvXSF4hzNHSmOO024e663JoczkB6tpQtyEywZYyjFVpbGw= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id D55B612399B; Wed, 10 Mar 2021 16:47:51 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id ED20E2DA004F; Wed, 10 Mar 2021 16:47:49 -0500 (EST) Date: Wed, 10 Mar 2021 16:47:49 -0500 (EST) From: Nicolas Pitre To: Sedat Dilek cc: Arnd Bergmann , Masahiro Yamada , Nicholas Piggin , Fangrui Song , Ard Biesheuvel , Andrew Scull , Mark Brown , Catalin Marinas , clang-built-linux , David Brazdil , Geert Uytterhoeven , Ionela Voinescu , Kees Cook , Kristina Martsenko , Linux ARM , "linux-kernel@vger.kernel.org" , Mark Rutland , Marc Zyngier , Nathan Chancellor , Nick Desaulniers , Vincenzo Frascino , Will Deacon Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION In-Reply-To: Message-ID: References: <20210225112122.2198845-1-arnd@kernel.org> <20210226211323.arkvjnr4hifxapqu@google.com> <1614559739.p25z5x88wl.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 43744EB4-81EA-11EB-9BB5-D609E328BF65-78420484!pb-smtp21.pobox.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Mar 2021, Sedat Dilek wrote: > The best results on size-reduction of vmlinux I got with Clang-CFI on x86-64. > > Clang-LTO and Clang-CFI: > I was able to build with CONFIG_TRIM_UNUSED_KSYMS=y which needs to add > a whitelist file or add a whitelist to scripts/gen_autoksyms.sh. > And boot on bare metal. > Furthermore, I was able to compile > CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y with and without > CONFIG_TRIM_UNUSED_KSYMS=y. > Every kernel I had CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y does not boot. > Yes, there is a size reduction with both enabled but not that good as > with Clang-CFI. > All testings with several iterations of LLVM/Clang v13-git. > With CONFIG_TRIM_UNUSED_KSYMS=y I see a 3x-loops of building .version > and folowing steps - got no answer if this is intended. Yes it is intended. I explained it here: https://lkml.org/lkml/2021/3/9/1099 With CONFIG_TRIM_UNUSED_KSYMS some EXPORT_SYMBOL() are removed, which allows for optimizing away the corresponding code, which in turn opens the possibility for more EXPORT_SYMBOL() to be removed, etc. The process eventually converge to a stable build. Normally only 2 passes are needed to converge, but LTO opens the possibilities for extra passes. > Means longer build-time. Oh, absolutely. LTO (at least when I played with it) is slow. Add the multi-pass from CONFIG_TRIM_UNUSED_KSYMS on top of that and your kernel build becomes agonizingly slow. This is not something you want when doing kernel development. > I did not follow this anymore as both Kconfigs with Clang-LTO consume > more build-time and the resulting vmlinux is some MiB bigger than with > Clang-CFI. That's rather strange. At least with gcc LTO I always obtained smaller kernels. Nicolas