From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33771 invoked by alias); 27 Nov 2018 19:54:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 33751 invoked by uid 89); 27 Nov 2018 19:54:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=gotten X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Nov 2018 19:54:11 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id B2652302BB40; Tue, 27 Nov 2018 20:54:08 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 3694D4001289; Tue, 27 Nov 2018 20:54:08 +0100 (CET) Message-ID: <29189158fb235f03c0ff4ac918f93eadbf923ca1.camel@klomp.org> Subject: Re: [PATCH] PR880088 Enable -Wtrampolines for no-exec-stack targets with -Wall. From: Mark Wielaard To: Segher Boessenkool Cc: gcc-patches@gcc.gnu.org Date: Tue, 27 Nov 2018 19:54:00 -0000 In-Reply-To: <20181127183700.GY23873@gate.crashing.org> References: <1543223609-9550-1-git-send-email-mark@klomp.org> <20181127183700.GY23873@gate.crashing.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 X-SW-Source: 2018-11/txt/msg02229.txt.bz2 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. >=20 > As Paul says, that name isn't so good. >=20 > 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 > >=20=20 > > +#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) > > + #define TARGET_HAS_DEFAULT_NOEXEC_STACK (TARGET_32BIT \ > > + || DEFAULT_ABI =3D=3D ABI_ELFv2) > > +#endif >=20 > 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 =3D=3D 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