This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] PT_GNU_STACK
- From: Ian Lance Taylor <ian at airs dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 24 May 2003 17:14:33 -0700
- Subject: Re: [PATCH] PT_GNU_STACK
- References: <20030524103021.GL16629@sunsite.ms.mff.cuni.cz>
Jakub Jelinek <jakub@redhat.com> writes:
> This patch introduces PT_GNU_STACK segment header, which tells the kernel or
> dynamic linker whether the binary or library needs executable stack or not.
It seems to me that it would be better to indicate this using a DT_
flag rather than a PT_ segment.
Your patch doesn't seem to check shared objects. I suppose they could
be checked by the dynamic linker, though.
Even using a DT_ flag, you could still use a special section in an
input object file to indicate a required setting. However, if the
default is to make the stack executable, then the special section is
only meaningful if every single input object includes it. That
doesn't seem useful going forward.
I would suggest a linker option which means ``make the stack
non-executable unless some input file requires an executable stack.''
Then change gcc to emit a special section for any file which requires
an executable stack. Then change gcc to use the new linker option by
default. That way we can get a non-executable stack in the normal
case. You would of course still need linker options to force the
stack to be executable or not.
Ian