[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <156d8beb-2644-8c2b-789b-104cf9268c8a@mailbox.org>
Date: Thu, 10 Jun 2021 20:16:38 +0000
From: Tor Vic <torvic9@...lbox.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nathan@...nel.org" <nathan@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"clang-built-linux@...glegroups.com"
<clang-built-linux@...glegroups.com>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH] x86/Makefile: make -stack-alignment conditional on LLD <
13.0.0
On 10.06.21 19:20, Nick Desaulniers wrote:
> On Thu, Jun 10, 2021 at 2:28 AM <torvic9@...lbox.org> wrote:
>>
>> Since LLVM commit 3787ee4, the '-stack-alignment' flag has been dropped [1],
>> leading to the following error message when building a LTO kernel with
>> Clang-13 and LLD-13:
>>
>> ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument
>> '-stack-alignment=8'. Try 'ld.lld --help'
>> ld.lld: Did you mean '--stackrealign=8'?
>>
>> It also appears that the '-code-model' flag is not necessary anymore starting
>> with LLVM-9 [2].
>>
>> Drop '-code-model' and make '-stack-alignment' conditional on LLD < 13.0.0.
>
> Please include this additional context in v2:
> ```
> These flags were necessary because these flags were not encoded in the
> IR properly, so the link would restart optimizations without them. Now
> there are properly encoded in the IR, and these flags exposing
> implementation details are no longer necessary.
> ```
> That way it doesn't sound like we're not using an 8B stack alignment
> on x86; we very much are so; AMDGPU GPFs without it!
>
Will do so.
Does this have to be a v2 (with a "changes from v1" info) or just a
resend? It is based on mainline now and the line numbers have changed.
> Cut the below paragraph out on v2. Thanks for the patch and keep up
> the good work!
>
>>
>> This is for linux-stable 5.12.
>> Another patch will be submitted for 5.13 shortly (unless there are objections).
>>
>> Discussion: https://github.com/ClangBuiltLinux/linux/issues/1377
>> [1]: https://reviews.llvm.org/D103048
>> [2]: https://reviews.llvm.org/D52322
>>
>> Signed-off-by: Tor Vic <torvic9@...lbox.org>
>> ---
>> arch/x86/Makefile | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>> index 1f2e5bf..2855a1a 100644
>> --- a/arch/x86/Makefile
>> +++ b/arch/x86/Makefile
>> @@ -192,8 +192,9 @@ endif
>> KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
>>
>> ifdef CONFIG_LTO_CLANG
>> -KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
>> - -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
>> +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
>> +KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
>> +endif
>> endif
>>
>> ifdef CONFIG_X86_NEED_RELOCS
>> --
>> 2.32.0
>
>
>
Powered by blists - more mailing lists