Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp754363lqb; Fri, 15 Mar 2024 05:52:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8cpQBu1H1gsnPFXCwjjNMo4/1IHDFG9sWiv4Ym4A2Qloqg5rACz4F7ba+8C6QtD7itQG40gFB9L7nYKhpnONdWUhQpdwNtCz+/+Allw== X-Google-Smtp-Source: AGHT+IFAI9vRo93u1Ucem3bSdrOdbFIWzJxUxtTpgb9xPqOGJMiFmSeED5XivpFtIoWDx2L7rhi5 X-Received: by 2002:a05:622a:506:b0:42e:7ea3:46ce with SMTP id l6-20020a05622a050600b0042e7ea346cemr4834878qtx.43.1710507135276; Fri, 15 Mar 2024 05:52:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710507135; cv=pass; d=google.com; s=arc-20160816; b=ulLARnbEbzT+MTiz7nXFjaCmsaivLLQwb+ipB0zhN7F+tHHMhDYNe5ySPHAGw36fm0 Tw/W3xaudkfNpj0MNS/rfomRTBQSNQzw9buCrvIkkYSmR/mCNuDklvM0R/zCmyuckTaE vlApVBWKFTxjmyVzZ7GHi7kr1cgA5AVp9TYyBhweylZPMagYx4NWAuBPBB4Q35sFlocj tQevcdcpzVm310VchV6Z1FqsXUEGWg/01nM68pJvsxjOYYLK9lpnxp44ax80GEKevSTx fp0FjxGCe54U/qJ2jT0BC019iTC5IMpk0Mw9Umax/I8xc8tN6ivqCKUK45yW3eclNAyz HLwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=0rSwPy9C3VazUgnX/NYh1G3y7KU3iNxlDZ/ZhN/JDd0=; fh=tuhea4ill+61fE2GUtJBxSJxfWWC6IUGMa+pQff/HKI=; b=fK8n84J5703uutoBYjyGTIzAtigjDRhztQyx2fzJBd5pn81j2QEb9HDTWT8aIFkHdn Q7rW7tIEXgHM2Wtmd4xWzdc/6P5DDnkyVAG6MouEHqtVzdysxE94ZEYczWsMYd/c9sqe X8Iv34rCKPDyqj/cxcWfWkyXGXmHiWRnkrSqvLLjzv4UlsVpj0Ur9aJ3qCj0DI/6Juc4 a5c2AlcLgNjV6toQWQ6LQzYOWU/h2Y3nfmLAf4kH8By7u4Bq8zmazKEBBIM0TCztpc/x 0rQVZpr6SmfqVl8Zp+cQC1AgyjEN2+6phz01mj6shMWWsci72CDeJ0MW4zJV0QlPTTOH x3+Q==; 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-104413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t18-20020a05622a181200b00430a06c9a32si2865614qtc.250.2024.03.15.05.52.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 05:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-104413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104413-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DE4811C222F0 for ; Fri, 15 Mar 2024 12:52:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5589824B59; Fri, 15 Mar 2024 12:52:09 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 D1F8324A1F for ; Fri, 15 Mar 2024 12:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710507128; cv=none; b=r8MCKSQEGDQYRq/g8pzdPRAGBU/1UlHeGbSUYqZjQg5gDaMENANV8Nng7E/P/dsatF09kxe8mNSllPVxwAzm1DXHsqSOARlEvwmMqLxFPiJU7bFSho70WZ4zg7q5Wrl1fVXTX9lp1lb88m45wH53DnnCDSF+0mQcGsYwTjosiks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710507128; c=relaxed/simple; bh=5hRpu+BSHB2aXC7FAAHOgQkNNSuLw3DUTtsD/VhVvPM=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=B/XvG1iu5P0s3Kn8vNXPXYsmChgA7QkGTmt4Gg05gdlDxMk+fnGcJBvfIYpQ51QRnILjn8T1v14ivqHw4KddPR2DL8RAh7VlV2PAqrRq5U/cygGmFJtiUtOeMR9LqJHn7KHTT4Z3kJnbombqFPZqKge5tPeiuvM20j8d8pSu0cc= 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.190 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.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tx3wn3M8jz2BgQ1; Fri, 15 Mar 2024 20:49:29 +0800 (CST) Received: from dggpemd100004.china.huawei.com (unknown [7.185.36.20]) by mail.maildlp.com (Postfix) with ESMTPS id 91EE51A0172; Fri, 15 Mar 2024 20:51:58 +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; Fri, 15 Mar 2024 20:51:58 +0800 Message-ID: Date: Fri, 15 Mar 2024 20:51:58 +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 v3] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Content-Language: en-US To: Ard Biesheuvel CC: Arnd Bergmann , , , Geert Uytterhoeven , Russell King , Andrew Davis , Andrew Morton , "Kirill A. Shutemov" , Geert Uytterhoeven , Jonathan Corbet , Mike Rapoport , Rob Herring , Thomas Gleixner , Linus Walleij , Fangrui Song References: <20240315063154.696633-1-liuyuntao12@huawei.com> <31f3a3fe-b16f-47a9-8c41-80fc0a236d52@huawei.com> From: "liuyuntao (F)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemd100004.china.huawei.com (7.185.36.20) On 2024/3/15 20:46, Ard Biesheuvel wrote: > On Fri, 15 Mar 2024 at 13:22, liuyuntao (F) wrote: >> >> >> >> On 2024/3/15 20:13, Ard Biesheuvel wrote: >>> On Fri, 15 Mar 2024 at 13:10, liuyuntao (F) wrote: >>>> >>>> >>>> >>>> On 2024/3/15 19:51, Arnd Bergmann wrote: >>>>> On Fri, Mar 15, 2024, at 12:48, liuyuntao (F) wrote: >>>>>> On 2024/3/15 18:46, Ard Biesheuvel wrote: >>>>>>> @@ -28,6 +28,7 @@ >>>>>>> -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \ >>>>>>> -DEFI_HAVE_STRCMP -fno-builtin -fpic \ >>>>>>> $(call cc-option,-mno-single-pic-base) >>>>>>> +cflags-$(CONFIG_ARM) := $(filter-out -fdata-sections, $(CFLAGS-y)) >>>>>>> cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax >>>>>>> cflags-$(CONFIG_LOONGARCH) += -fpie >>>>>> >>>>>> Another error: >>>>>> cannot initialize array of ‘short unsigned int’ from a string literal >>>>>> with type array of ‘unsigned int’ >>>>>> 17 | static const efi_char16_t shim_MokSBState_name[] = L"MokSBStateRT"; >>>>> >>>>> The line sets cflags-y to an empty string. >>>>> >>>>> It probably should have been >>>>> >>>>> cflags-$(CONFIG_ARM) := $(filter-out -fdata-sections, $(cflags-y)) >>>>> >>>>> (small cflags instead of CFLAGS). >>>>> >>> >>> Oops indeed. >>> >>>> Oh, my mistake, after fixed this bug, still this error: >>>>> arm-linux-gnueabi-ld: warning: orphan section `.data.efi_loglevel' from `drivers/firmware/efi/libstub/printk.stub.o' being placed in section `.data.efi_loglevel' >>>>> arm-linux-gnueabi-ld: warning: orphan section `.data.screen_info_guid' from `drivers/firmware/efi/libstub/screen_info.stub.o' being placed in section `.data.screen_info_guid' >>>>> arm-linux-gnueabi-ld: warning: orphan section `.data.cpu_state_guid' from `drivers/firmware/efi/libstub/arm32-stub.stub.o' being placed in section `.data.cpu_state_guid' >>>>> arm-linux-gnueabi-ld: warning: orphan section `.data.efi_nokaslr' from `drivers/firmware/efi/libstub/efi-stub-helper.stub.o' being placed in section `.data.efi_nokaslr' >>>> >>>> The -fdata-sections option is present in the KBUILD_CFLAGS_KERNEL >>>> variable; altering cflags-y only affect the KBUILD_CFLAGS variable. >>>> It seems that the -fdata-sections option needs to be removed from the >>>> KBUILD_CFLAGS_KERNEL variable. >>> >>> Indeed. >>> >>> So >>> >>> KBUILD_CFLAGS_KERNEL := $(filter-out -fdata-sections,$(KBUILD_CFLAGS_KERNEL)) >>> >>> (assuming I got it right this time without build testing) >> >> Um, it not worked,too, same error. > > Aren't you missing a 'L' ? > >>> --- a/drivers/firmware/efi/libstub/Makefile >>> +++ b/drivers/firmware/efi/libstub/Makefile >>> @@ -28,6 +28,7 @@ cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \ >>> -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \ >>> > >>> ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION >>> KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections >>> KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y >>> LDFLAGS_vmlinux += --gc-sections >>> endif >> >> -DEFI_HAVE_STRCMP -fno-builtin -fpic \ >>> $(call cc-option,-mno-single-pic-base) >>> +KBUILD_CFLAGS_KERNE := $(filter-out -fdata-sections, $(KBUILD_CFLAGS_KERNE)) >>> cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax >>> cflags-$(CONFIG_LOONGARCH) += -fpie >> >> Sorry, I was too careless. How about reset KBUILD_CFLAGS_KERNEL? > +# KBUILD_CFLAGS_KERNEL is is set by CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, > +# not need here, just reset it. > +KBUILD_CFLAGS_KERNEL := > + > # non-x86 reuses KBUILD_CFLAGS, x86 does not > cflags-y := $(KBUILD_CFLAGS)