[PATCH] LoongArch: Set defaults to exec stack 0.

Xi Ruoyao xry111@xry111.site
Mon Jul 25 08:14:26 GMT 2022


On Mon, 2022-07-25 at 10:08 +0200, Andreas Schwab via Binutils wrote:
> On Jul 25 2022, liuzhensong wrote:
> 
> > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
> > index 4efe3d9370c..43182ead8cd 100644
> > --- a/bfd/elfnn-loongarch.c
> > +++ b/bfd/elfnn-loongarch.c
> > @@ -132,6 +132,7 @@ struct loongarch_elf_link_hash_table
> >  
> >  #define elf_backend_want_dynrelro 1
> >  #define elf_backend_rela_normal 1
> > +#define elf_backend_default_execstack 0
> 
> AFAICS, the loongarch kernel defaults to executable stack:
> 
> arch/loongarch/include/asm/elf.h:#define elf_read_implies_exec(ex,
> exec_stk) (exec_stk == EXSTACK_DEFAULT)

+ Huacai.

> Which means this change is wrong.

The doc of elf_backend_default_execstack says:

  /* True if an object file lacking a .note.GNU-stack section
     should be assumed to be requesting exec stack.  At least one
     other file in the link needs to have a .note.GNU-stack section
     for a PT_GNU_STACK segment to be created.  */

So I think it only controls the default behavior of bfd library and is
not related to the kernel?
-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list