From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16542 invoked by alias); 10 Sep 2014 14:48:52 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 16417 invoked by uid 89); 10 Sep 2014 14:48:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=unavailable version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 10 Sep 2014 14:48:50 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8AEme8w010087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Sep 2014 10:48:40 -0400 Received: from tucnak.zalov.cz (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8AEmctZ021271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 10 Sep 2014 10:48:39 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.8/8.14.7) with ESMTP id s8AEmZ5e017419; Wed, 10 Sep 2014 16:48:35 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.8/8.14.8/Submit) id s8AEmXvU017418; Wed, 10 Sep 2014 16:48:33 +0200 Date: Wed, 10 Sep 2014 14:48:00 -0000 From: Jakub Jelinek To: Alan Modra , libffi-discuss@sourceware.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Fix up libffi linux64*.S for ppc32-linux Message-ID: <20140910144833.GJ17454@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014/txt/msg00082.txt.bz2 Hi! I've noticed that on 4.8 branch libgo recently (in the last few months) started being linked with GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x10 i.e. requiring executable stack on powerpc-linux (32-bit). The problem is that we link into libffi linux64.o and linux64_closure.o unconditionally, both for 32-bit and 64-bit compilations, just for 32-bit ones all the assembly is ifdefed out, so they have just empty sections. The .note.GNU-stack section isn't emitted in that case either, which means that the linker conservatively treats those as possibly needing executable stack. The following patch should fix that, ok for trunk/4.9/4.8? BTW, I wonder if e.g. libffi/src/arm/trampoline.S or libffi/src/aarch64/sysv.S shouldn't have those notes too (note, both of those were added after 2008 when most of the *.S files were marked that way). 2014-09-10 Jakub Jelinek * src/powerpc/linux64.S: Emit .note.GNU-stack even when POWERPC64 is not defined. * src/powerpc/linux64_closure.S: Likewise. Also test _CALL_ELF == 2. --- libffi/src/powerpc/linux64.S.jj 2013-12-10 08:52:16.000000000 +0100 +++ libffi/src/powerpc/linux64.S 2014-09-10 16:36:23.881137722 +0200 @@ -254,7 +254,8 @@ ffi_call_LINUX64: .align 3 .LEFDE1: -# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 +#endif + +#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 .section .note.GNU-stack,"",@progbits -# endif #endif --- libffi/src/powerpc/linux64_closure.S.jj 2013-12-10 08:52:16.000000000 +0100 +++ libffi/src/powerpc/linux64_closure.S 2014-09-10 16:37:38.104747027 +0200 @@ -381,7 +381,8 @@ ffi_closure_LINUX64: .align 3 .LEFDE1: -# if defined __ELF__ && defined __linux__ +#endif + +#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 .section .note.GNU-stack,"",@progbits -# endif #endif Jakub