Hi, On Tue, 2018-11-27 at 12:37 -0600, Segher Boessenkool wrote: > > 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?
Would the slightly shorter TARGET_NEEDS_EXEC_STACK_MARKER_FOR_TRAMPOLINES be descriptive enough? > > 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 . I might have gotten lost in the tree of defines/macros. There are two sysv4.h files gcc/config/rs6000/sysv4.h and gcc/config/powerpcspe/sysv4.h Both define the TARGET_ASM_FILE_END hook to rs6000_elf_file_end. Which are defined in config/rs6000/rs6000.c and config/powerpcspe/powerpcspe.c. Both have: #if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2) file_end_indicate_exec_stack (); #endif And file_end_indicate_exec_stack () is what you call to flip the stack to be executable (if an executable stack marker is needed for generating the trampoline). That is why both sysv4.h files have the new target macro defined the same way. But maybe only one of them really needs it? Thanks, Mark