Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp638008pxf; Wed, 10 Mar 2021 13:58:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6JfK9p5dK0ReLcWhRi53NSi6TpEp6njFhjDO9rgPpU1dO9cI6/qc9zXx7H3UlX5KLUGJ7 X-Received: by 2002:a50:8a90:: with SMTP id j16mr5412320edj.334.1615413504171; Wed, 10 Mar 2021 13:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615413504; cv=none; d=google.com; s=arc-20160816; b=nneJLu+1UakxqTS1fE3wAE5DzUt6iurSiexQKW7wxWNwVzh38dQL4REim3L6BAlIAg fH1pdOtIcgtG2gBIH9lgNn2Wl88amkYXWn2QtzMg6X7HfvQfZCgXxMGwM2lTMuZYPOeW skrZjRvzOT8CuMGoQuiVQQzFWXNg/BlatA3C6ecRoeXfk0NxKq4vAhSbRxf33Ox2ZPpQ DxFYwEtG/Ww8BPW3Z0ox1WqPubOemMf6Xyi7JjCmkfGi39lvHfqBskH9TJIv/0OTZGA3 D1JjP6J+qE1jwP6acRQFd2iGigHgfqMnd9fb3zvC6+O+BQpImVN4RUl0+Pt6jL8pU4GL X0WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=8m5BGMCUQy6bolYUYGEi4O9GWntkIbNhEX3ye5kE/NA=; b=a9eZZ+c2kE9Ave/sphnuM0BMTncg7BIqp/PX8Xwyzwa2rEDqsujQqgE8jsYgCsPCWh 295ACPZRD1A8/oApRSi2vsvubg2cySPPDxTJ9QmehH83VCQiIZD0iHUSof1JHgHzeABt QAtpXrK9Ke8viJp6bG/PEa0Bep39RbCdmzIqoVKjCSQNe+tR5JtvqZwvzHIFnfh3xQBd 4gHwcg76JQwx0wOz4BTJtsl/YRBgkQqiYMLr7y3F9GdGmueDScMxgKOhGC6vLeqFSPRm UC3wLG+y0Y89Yf+qNDwuotEtOpEWaAWy8x9bLHKEdtdBEO59PdXPIsI8UUUA7QbPSeQC EJ2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=kl2TCkL0; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=MKKUhi2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si489757edj.174.2021.03.10.13.58.01; Wed, 10 Mar 2021 13:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=kl2TCkL0; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=MKKUhi2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231760AbhCJV4t (ORCPT + 99 others); Wed, 10 Mar 2021 16:56:49 -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