This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR880088 Enable -Wtrampolines for no-exec-stack targets with -Wall.
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 27 Nov 2018 12:37:01 -0600
- Subject: Re: [PATCH] PR880088 Enable -Wtrampolines for no-exec-stack targets with -Wall.
- References: <1543223609-9550-1-git-send-email-mark@klomp.org>
Hi Mark,
On Mon, Nov 26, 2018 at 10:13:29AM +0100, Mark Wielaard wrote:
> With -Wtrampolines a warning is produced whenever gcc generates executable
> code on the stack at runtime to support taking a nested function address
> that is used to call the nested function indirectly when it needs to access
> any variables in its lexical scope.
>
> As a result the stack has to be marked as executable even for targets which
> have a non-executable stack as default.
>
> Define a new target macro TARGET_HAS_DEFAULT_NOEXEC_STACK for those targets
> that have a non-executable default stack based on when they call
> file_end_indicate_exec_stack.
As Paul says, that name isn't so good.
TARGET_NEEDS_MAKING_THE_STACK_EXECUTABLE_FOR_TRAMPOLINES, or similar?
> diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
> index 0c67634..9330acf 100644
> --- a/gcc/config/rs6000/sysv4.h
> +++ b/gcc/config/rs6000/sysv4.h
> @@ -972,6 +972,11 @@ ncrtn.o%s"
> /* Generate entries in .fixup for relocatable addresses. */
> #define RELOCATABLE_NEEDS_FIXUP 1
>
> +#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
> + #define TARGET_HAS_DEFAULT_NOEXEC_STACK (TARGET_32BIT \
> + || DEFAULT_ABI == ABI_ELFv2)
> +#endif
I don't think this belongs in sysv4.h .
Segher