This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[PATCH] Fix up libffi linux64*.S for ppc32-linux
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>, libffi-discuss at sourceware dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Sep 2014 16:48:33 +0200
- Subject: [PATCH] Fix up libffi linux64*.S for ppc32-linux
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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