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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 CF492C433DB for ; Wed, 10 Mar 2021 21:49:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62CDE64FC4 for ; Wed, 10 Mar 2021 21:49:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62CDE64FC4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J7P1TDDhc0FZASY+ft3M8HlymVYDD5vpXIBB3DA6eiU=; b=YC7n7eXooaH0kS6HviCLnN3L0 Hm0idlMeaZcwezxoppZY5Kk1mkxACodmdqGUxtQOxF42r6Z2J+EvfvRddq3qPhDN5OzyYo7A7S1AX X3ZGDIB8MzqzV7y/O5LhM1fgQLyGziqs+ullaGMmNYlhhtufVijCOyGhMrAJWawJu7hoRakTKN+vG Z2IWKSR+XOylcWP/KPjguqfSJy+fD9DVqnVlksWxOv9zX6AQozo30SswXoD59u0dJT1PbFsukKAhl 7EpjpNJ6VlrOzZMaIeLu/PB9Hc4Ue7AauYCdqsPAP+hXA+wTdTdiTG+FDsruipLdY0a7xl2SW/yCT C/bFnCNUw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lK6gU-007qO9-S8; Wed, 10 Mar 2021 21:48:03 +0000 Received: from pb-sasl-trial20.pobox.com ([173.228.157.50]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lK6gO-007qMj-UZ for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 21:47:59 +0000 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 X-Pobox-Relay-ID: 43744EB4-81EA-11EB-9BB5-D609E328BF65-78420484!pb-smtp21.pobox.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_214757_393097_BF07217C X-CRM114-Status: GOOD ( 19.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel