public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Alan Modra <amodra@gmail.com>,
	libffi-discuss@sourceware.org,        gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix up libffi linux64*.S for ppc32-linux
Date: Wed, 10 Sep 2014 14:48:00 -0000	[thread overview]
Message-ID: <20140910144833.GJ17454@tucnak.redhat.com> (raw)

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  <jakub@redhat.com>

	* 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

             reply	other threads:[~2014-09-10 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 14:48 Jakub Jelinek [this message]
2014-09-11  0:12 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140910144833.GJ17454@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=amodra@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libffi-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).