[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc3dad0c-d444-4ea0-8d6f-0a0d850d948d@huawei.com>
Date: Fri, 15 Mar 2024 20:51:58 +0800
From: "liuyuntao (F)" <liuyuntao12@...wei.com>
To: Ard Biesheuvel <ardb@...nel.org>
CC: Arnd Bergmann <arnd@...db.de>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, Geert Uytterhoeven <geert@...ux-m68k.org>,
Russell King <linux@...linux.org.uk>, Andrew Davis <afd@...com>, Andrew
Morton <akpm@...ux-foundation.org>, "Kirill A. Shutemov"
<kirill.shutemov@...ux.intel.com>, Geert Uytterhoeven
<geert+renesas@...der.be>, Jonathan Corbet <corbet@....net>, Mike Rapoport
<rppt@...nel.org>, Rob Herring <robh@...nel.org>, Thomas Gleixner
<tglx@...utronix.de>, Linus Walleij <linus.walleij@...aro.org>, Fangrui Song
<maskray@...gle.com>
Subject: Re: [PATCH-next v3] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
On 2024/3/15 20:46, Ard Biesheuvel wrote:
> On Fri, 15 Mar 2024 at 13:22, liuyuntao (F) <liuyuntao12@...wei.com> wrote:
>>
>>
>>
>> On 2024/3/15 20:13, Ard Biesheuvel wrote:
>>> On Fri, 15 Mar 2024 at 13:10, liuyuntao (F) <liuyuntao12@...wei.com> 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)
Powered by blists - more mailing lists