This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Should we combine PT_GNU_STACK from DSO?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 16 Apr 2004 17:23:22 +0200
- Subject: Re: Should we combine PT_GNU_STACK from DSO?
- References: <20040416165016.GA20038@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Apr 16, 2004 at 09:50:16AM -0700, H. J. Lu wrote:
> Currently, we have
>
> [hjl@gnu-psc stack-2]$ make
> gcc -g -c -o foo.o foo.c
> gcc -fPIC -shared -o libbar.so bar.c -Wl,-z,execstack
> readelf -l libbar.so | grep STACK | grep RWE
> STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
> gcc -o foo foo.o libbar.so -Wl,-rpath,.
> ./foo
> Hello
> readelf -l foo | grep STACK
> STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
> readelf -l foo | grep STACK | grep RWE
> make: *** [all] Error 1
>
> That is we don't combine PT_GNU_STACK from DSO. This executable may
> fail to run on kernel with non-executable stack. But we can also argue
> that the DSO used at run-time may not need an executable stack. Any
> comments?
We should not.
The fact that at linktime some shared library needs executable stack
doesn't mean the one used at runtime will need it as well.
The dynamic linker handles this at runtime.
Jakub