On Wed, 25 Jul 2012, Andrew Pinski wrote:
> Hi,
>   The Linux kernel already supports non-executable stack since around
> February 2010.  This patch has GCC emit the notes that are associated
> with non-executable stack.

What does the kernel do when the note isn't present?

> OK?  Bootstrapped and tested on mips64-linux-gnu with kernel already
> supporting the non-executable stack with no regressions.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * config/mips/linux-common.h (TARGET_ASM_FILE_END): Define.
>

I can't quote your non-inline patch so I'll copy-paste it.

+
+/* For MIPS, the default is to assume *no* executable stack, so output
+    an executable-stack-note only when needed.  */
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack

The comment is wrong, your patch is always emitting the note.
Besides IIRC, *glibc* defaults to an executable stack for MIPS,
so you need to emit it if (!trampolines_created) or something
like that.  See the CRIS cris_file_end from which the comment
seems copy-pasted, but the opposite condition. :)

If the kernel and glibc are in contradiction regarding the
default, you do need to use a slightly different expression,
checking too whether you're creating an executable, if you
really mean to emit the note only when needed.

brgds, H-P

Reply via email to