lkml.org 
[lkml]   [2022]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: assemble with -Wa,--noexecstack to avoid BFD 2.39 warning
On 2022-08-08, Linus Torvalds wrote:
>On Mon, Aug 8, 2022 at 1:32 PM Nick Desaulniers <ndesaulniers@google.com> wrote:
>>
>> Thanks for the link; I recall Ard mentioning the ELF segments are
>> ignored by the kernels loader in another thread.
>
>Yeah, the kernel loader is not some generic ELF loader thing.
>
>> Perhaps we should be adding
>> --no-warn-execstack
>> wrapped in an ld-option check to KBUILD_LDFLAGS at the top level?
>
>I think both the linker flag and the assembler flag are the "correct"
>thing to do.
>
>And yes, I don't think there is anything architecture-specific about
>it, and the top-level Makefile is likely the right thing to modify.
>
>I'm a tiny bit worried about "what versions of as/ld accept those
>flags", though.
>
> Linus
>

If most ports don't need executable stacks, I think using `-z
noexecstack` is better than the binutils 2.39 specific
--no-warn-execstack (not recognized by lld and older GNU ld, so a
configure check will be needed).

Then -Wa,--noexecstack is not necessary: if the built relocatable files
are destined to be used with ld with -z noexecstack, the input
.note.GNU-stack sections are really redundant. It would be a difficult
story if the relocatable files can "leak" to the outside world where a
GNU ld without -z noexecstack may be used. But IMO this is not the case
for the kernel.

\
 
 \ /
  Last update: 2022-08-09 03:37    [W:0.193 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site