This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Enable -zexecstack on Solaris
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: David Bartley <dtbartle at csclub dot uwaterloo dot ca>
- Cc: binutils at sourceware dot org
- Date: Sun, 3 May 2009 12:40:26 +0930
- Subject: Re: [PATCH] Enable -zexecstack on Solaris
- References: <e77a196d0905021611m6c2f19a5tde81bd1f15f1cca@mail.gmail.com>
On Sat, May 02, 2009 at 04:11:28PM -0700, David Bartley wrote:
> The attached patch enabled executable stacks on Solaris (via
> -zexecstack). On Solaris, this is achieved by setting the final
> PT_LOAD section to be executable.
[snip]
> + * bfd/elf.c: Enable -zexecstack on Solaris.
> + * bfd/configure.in: Likewise.
> + * bfd/configure: Regenerate.
> + * bfd/config.in: Likewise.
I think bfd is the wrong place to implement this feature. Instead,
you should arrange for ld to set SEC_CODE on .bss, which I think will
result in PF_X on the PT_LOAD header covering .bss. Do this in a new
.em file for solaris (grep for EXTRA_EM_FILE examples), probably best
done in ldemul_before_allocation so that you have the option of
turning off link_info.execstack and noexecstack to not emit
PT_GNU_STACK, which I imagine isn't much use to you.
--
Alan Modra
Australia Development Lab, IBM