Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp308347lqi; Wed, 6 Mar 2024 19:10:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVCrwjwkblxp3nuL4tdh7jUCCo7SJYWZ3FYa1cpyevBa6vkzlXd0jwYnM+PoyJhdF0j2bHeYmQZa+aFVaU3JzDTPltaQYZ5rkBlFENnoQ== X-Google-Smtp-Source: AGHT+IEk/xnFw/3EqeiohC86QpqK3QQuS4y/tCqcmYE4UxQBd9H+D3DLDKO2J9SIbUah5ss3Zn9Q X-Received: by 2002:a17:906:7198:b0:a45:cfed:8f60 with SMTP id h24-20020a170906719800b00a45cfed8f60mr208231ejk.13.1709781005413; Wed, 06 Mar 2024 19:10:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709781005; cv=pass; d=google.com; s=arc-20160816; b=jRLiqyhuOGlMnWOPco7J+P+zzFS9s6wFd9RcPxPmuMt6hejqeOAG2tS0+pwKCh3Fub DuxHpa+yJxYT/l3jWcUMYjJjPhQmb40chUEG489wcTCqGF1tV5FOvlA8EImsaTvPLfe3 R6vg7lbMtBX/47duu62IdtpGi19xDKsl5fRViXKztn8qE0lH4I5EmsSVxU1F3zAYc5RV GKScGgI2MIZx1HgnKdujQ59xf8ePdX0kynjvz6zVNSSO7JFEBdZZEaIPsyZK70Xjdlj6 8WJvztkcaIXEdhN9MABMHpFXr0BrzBjPXP+DnsJFY67TfwB5a655Z6XZAAy2bz7dW3z+ ceVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=aZIGBKG20Z0spJfRjWrt9YPC4Q/azSWTaIUv1wHFRs4=; fh=rEfNk0AgPanvFygXCgvLJCfLAceaNRGsezUDAejAUzU=; b=em182N0C4hUvGJsBkkAc82zFZy4h9CrLvedkvgdj/JlAy1xCG4PvXSE8U6xGKRvbcn O24qtzRw79Yg9wCY0cCcXT37WfTOvUJ/e8Jae9Dq6DfVa+RHa2VgHZ79411SeH7rCB7D 2drGPGQ+FuduerzgZ7YOsdD7x7gJ7xe4/7g50ZWT6+KmeaySZGh6A5V9+4EhN7BeJPdz DLUadDblr9gq+b7QtbineXWEQ2gRSWLtFvFZoXfAMt4uxj1GpUxYlXhdKRct6xlvRnMm t8BAxfrio+d2Ej+v4l9qvSu6qdA4itRXJ5E0kGFjH7oeaZ0t7ehUnyhrFj5naa7HCaTV gJgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-94909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o23-20020a1709064f9700b00a434654f73esi6471307eju.509.2024.03.06.19.10.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 19:10:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-94909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 292EE1F2454D for ; Thu, 7 Mar 2024 03:10:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E598DDB8; Thu, 7 Mar 2024 03:09:59 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FA9A63C7 for ; Thu, 7 Mar 2024 03:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709780998; cv=none; b=RRr/mSn3yRXWd0lRgIBjuFYoFOPHpDwXpQ0TmbHSBwpo76S8Be92Kj72aTTnOYczgip905x6w4XJpt8HpJxZvyvlUSFKQFo4GXh6SfKJTvef3eYY+Jlqy6AhQVnLtgHRbrxlkimg6UCHkNrvs1Dlw+InewLjXbnVB6d8PPwYwMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709780998; c=relaxed/simple; bh=3xrolTwPIE/Z1Jhq2oxb8I7qqfZb26/VHY/X4xLSSQI=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=RR4c8qpmMYU9UrZW3DVSZK2BGi1/TQytYLVbJv2gh7PDehZpEjmxnSWH2gxBjG8eOqYin/xuXNAfRk6G/EvGOU2wJgH8lT5B4Vg2MlAJM/6QZwDnmYGqzjd5Z5U3lWw0c4DzhUwHh03pwCmbR9jvG/I+ixwOqCG6W38ewyMiNV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TqvP53rsMzXhtb; Thu, 7 Mar 2024 11:07:37 +0800 (CST) Received: from dggpemd100004.china.huawei.com (unknown [7.185.36.20]) by mail.maildlp.com (Postfix) with ESMTPS id 12B9A1402D0; Thu, 7 Mar 2024 11:09:54 +0800 (CST) Received: from [10.67.109.211] (10.67.109.211) by dggpemd100004.china.huawei.com (7.185.36.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 7 Mar 2024 11:09:53 +0800 Message-ID: <0255a8e9-d973-497c-9011-5651e0002a9c@huawei.com> Date: Thu, 7 Mar 2024 11:09:53 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -next] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Content-Language: en-US From: "liuyuntao (F)" To: Arnd Bergmann , , CC: Russell King , Andrew Davis , Andrew Morton , "Kirill A. Shutemov" , Geert Uytterhoeven , Jonathan Corbet , Mike Rapoport , Rob Herring , Thomas Gleixner , Linus Walleij References: <20240220081527.23408-1-liuyuntao12@huawei.com> <1342759e-b967-4ec4-98d5-48146f81f695@app.fastmail.com> <38c09a4b-69cc-4dc5-8a68-e5f5597613ac@huawei.com> <30b01c65-12f2-4ee0-81d5-c7a2da2c36b4@app.fastmail.com> <4e9396ca-460b-49ca-818e-73f0a8997b15@huawei.com> <58297ee9-4f33-4b3b-bd00-b44e86965892@app.fastmail.com> <2397d8dd-8053-4167-9aac-f5d7c05a98da@huawei.com> In-Reply-To: <2397d8dd-8053-4167-9aac-f5d7c05a98da@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemd100004.china.huawei.com (7.185.36.20) On 2024/2/27 16:06, liuyuntao (F) wrote: > > > On 2024/2/23 0:04, Arnd Bergmann wrote: >> On Thu, Feb 22, 2024, at 12:24, liuyuntao (F) wrote: >>> >>> The position of the caret has been moved below the right brace >>> of { KEEP(*(.vectors.bhb.loop8)) }, indicating that lld is treating >>> the entire `KEEP(*(.vectors))` as a file name. This could potentially be >>> a bug in lld. Perhaps we can temporarily >>> enable the DCE option only when option LD_IS_LLD is disabled, >>> like risc-v: >>> >>> `select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD`. >> >> I would really like to see this working with lld if at all >> possible, as it allows the combination of gc-sections with >> lto and CONFIG_TRIM_UNUSED_KSYMS. > Another way to preserve .vector sections without using KEEP annotation. It boots well. How do you feel about this approach? and, could I submit a v2 patch? 1: Define ARM_VECTORS_TEXT to explicitly preserve .vectors section. > --- a/arch/arm/include/asm/vmlinux.lds.h > +++ b/arch/arm/include/asm/vmlinux.lds.h > @@ -87,6 +87,13 @@ > *(.vfp11_veneer) \ > *(.v4_bx) > > +#define ARM_VECTORS_TEXT \ > + .vectors.text : { \ > + KEEP(*(.vectors)) \ > + KEEP(*(.vectors.bhb.loop8)) \ > + KEEP(*(.vectors.bhb.bpiall)) \ > + } > + > #define ARM_TEXT \ > IDMAP_TEXT \ > __entry_text_start = .; \ 2: Ref ARM_VECTORS_TEXT if config HAVE_LD_DEAD_CODE_DATA_ELIMINATION is enabled, and the same to arch/arm/kernel/vmlinux.lds.S > --- a/arch/arm/kernel/vmlinux-xip.lds.S > +++ b/arch/arm/kernel/vmlinux-xip.lds.S > @@ -135,6 +135,10 @@ SECTIONS > ARM_TCM > #endif > > +#ifdef HAVE_LD_DEAD_CODE_DATA_ELIMINATION > + ARM_VECTORS_TEXT > +#endif > + > /* > * End of copied data. We need a dummy section to get its LMA. > * Also located before final ALIGN() as trailing padding is > not stored