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_ADSP_CUSTOM_MED,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 A6AF7C433DB for ; Wed, 10 Mar 2021 22:43:58 +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 396A364FC5 for ; Wed, 10 Mar 2021 22:43:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 396A364FC5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: 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=AMKeIzQfpeUbgUMmzJZ8XAUhjiA7DQWSJEup2bSB2m8=; b=YGj4NtPc1HsGBkMGrZrJ4tWwP r4XeqSVqX5jjTzsrCjNubX+dfn4ZsKNbhsR2Iyqsa3cw9JQKjZ8lpaOIdmQRIsUxWQHS3mGq/FG9T Vid7jRVMWHqcSKhnKSRy6MR0itgGm01KdX32GRc5NBv9v8XKkeA4944hLRNI/Sj2emKsykxi/bCQl tfnDTDip/hwzlRsgb3atCmi1roDs5cP5o/9NgsyM4GZ37CQu6pL+f07o85oE29rrC3ZN7cTLZVq4n az2zXdV0ql99NIpkpeh1Mf5aTPb9LDf4GmZ5X7i6HTulcgKbRRZxikTRC2LnhZjwmydJwHALm8Zjx 40nmJ6v4w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lK7X1-007vLg-6N; Wed, 10 Mar 2021 22:42:19 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lK7Wx-007vKq-9C for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 22:42:17 +0000 Received: by mail-pj1-x102f.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so2280973pjb.1 for ; Wed, 10 Mar 2021 14:42:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jiNIsn8dDvvgor6dAKRTzz8LRo1SUw/7m6o11+C+WCA=; b=GAUFbW76BrbQVqz2/ystvzhUmQg1abnUMOcKIMlY5Dkm5JhX8eh7gngQ2vQh4i6MEm 4sWhE4HSYPI0a3TR6iQrw46C9V87aEUY2AI/Dmnt08tbR0PZBFnb4bdy1MBKXGRe6h0w MD7eKsgWCPdaxh6bTPnXHynC/oNArw83IApM786O8nMZW/WmXHLxHGqA6V+thcHtCT18 6i04z28zh/HIzsyQhGxESjealKlzjFByCSRvc+kZm3m/UwjqMJ/FLDywy+gSo2zIz7li 2sUFCw6dmQV7A9aPpI66mSz8lKul3B6QwmWz+eDSHeLJKEDV9oNseLiiu5LGlgNCdTfg /bhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jiNIsn8dDvvgor6dAKRTzz8LRo1SUw/7m6o11+C+WCA=; b=BfqUxHNpdipABYJ0LGx0AGCTLBlHEZXH0XqdgoiWyYUmx2N1dyJf7NQ0kJQTozCyKr XpE9rsDvQbF4W1plgCZRqfsIcN1J6ORMOiGLeRvJbgoesIDLMcdBAu8xnPz8zBKKD1tw t735tR3jPVIuV9bcdtq1jAEV3X3pkBfopnuhOUgEYPKjYJxEqhpMf9IdUNAA4PIlHmqJ bIycaqjxAYF/poxp7qSmJoWXUNM+lGyYb7kF/f11FzfJkYOVZu2EFGLveq9pNx74qaPy lX5jMo0qPy78t8TMNMqvL/ODnwmWkHy/OtfAKYEyzjWovaU0m2KWDJKrRkw8cbI1nwLt Sr6w== X-Gm-Message-State: AOAM531CTncaqLQoFRVNU3lqM5e0yr/8409iecVCGkxLrttU2mHCkTsm 1pOiM6aaL/gnnZQKvWmXk1RArQ== X-Google-Smtp-Source: ABdhPJxnW49iZHHaYZqqEhgnp+6p5k49+dCkjnWrk3NWfDOT7zKcl/OMF3S5aiwi1TwhLofgVy/WiA== X-Received: by 2002:a17:902:dac2:b029:e6:30a6:4c06 with SMTP id q2-20020a170902dac2b02900e630a64c06mr5317671plx.65.1615416133733; Wed, 10 Mar 2021 14:42:13 -0800 (PST) Received: from google.com ([2620:15c:2ce:0:6ded:c9f:3996:6bc8]) by smtp.gmail.com with ESMTPSA id m6sm464741pff.197.2021.03.10.14.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 14:42:13 -0800 (PST) Date: Wed, 10 Mar 2021 14:42:09 -0800 From: Fangrui Song To: Nicolas Pitre Cc: Nicholas Piggin , Arnd Bergmann , Ard Biesheuvel , Arnd Bergmann , 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 Message-ID: <20210310224209.otjkhwng4hlislnj@google.com> References: <20210225112122.2198845-1-arnd@kernel.org> <20210226211323.arkvjnr4hifxapqu@google.com> <1614559739.p25z5x88wl.astroid@bobo.none> <3o63p7pp-50o9-2789-s3qo-99pp5nrnnoqp@syhkavp.arg> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3o63p7pp-50o9-2789-s3qo-99pp5nrnnoqp@syhkavp.arg> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_224215_490588_5951B8DE X-CRM114-Status: GOOD ( 21.79 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-03-10, Nicolas Pitre wrote: >On Mon, 1 Mar 2021, Nicholas Piggin wrote: > >> Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: >> > Unlike what Nick expected in his submission, I now think the annotations >> > will be needed for LTO just like they are for --gc-sections. >> >> Yeah I wasn't sure exactly what LTO looks like or how it would work. >> I thought perhaps LTO might be able to find dead code with circular / >> back references, we could put references from the code back to these >> tables or something so they would be kept without KEEP. I don't know, I >> was handwaving! >> >> I managed to get powerpc (and IIRC x86?) working with gc sections with >> those KEEP annotations, but effectiveness of course is far worse than >> what Nicolas was able to achieve with all his techniques and tricks. >> >> But yes unless there is some other mechanism to handle these tables, >> then KEEP probably has to stay. I suggest this wants a very explicit and >> systematic way to handle it (maybe with some toolchain support) rather >> than trying to just remove things case by case and see what breaks. >> >> I don't know if Nicolas is still been working on his shrinking patches >> recenty but he probably knows more than anyone about this stuff. > >Looks like not much has changed since last time I played with this stuff. > >There is a way to omit the KEEP() on tables, but something must create a >dependency from the code being pointed to by those tables to the table >entries themselves. I did write my findings in the following article >(just skip over the introductory blurb): > >https://lwn.net/Articles/741494/ Hey, this article taught me R_*_NONE which motivated me to add various R_*_NONE support to LLVM 9! In the weekend I noticed that with binutils>=2.26, one can use .reloc ., BFD_RELOC_NONE, target (https://sourceware.org/bugzilla/show_bug.cgi?id=27530 ). I implemented it for many targets in LLVM, but that will require 13.0.0. >Once that dependency is there, then the KEEP() may go and >garbage-collecting a function will also garbage-collect the table entry >automatically. > >OTOH this trickery is not needed with LTO as garbage collection happens >at the source code optimization level. The KEEP() may remain in that >case as unneeded table entries will simply not be created in the first >place. For Thin LTO, --gc-sections is still very useful. I have more notes in https://maskray.me/blog/2021-02-28-linker-garbage-collection#link-time-optimization . _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel