* [RS6000] libffi ppc64 assembly
@ 2012-10-25 0:32 Alan Modra
2012-10-30 12:13 ` Anthony Green
0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2012-10-25 0:32 UTC (permalink / raw)
To: libffi-discuss
This is a repost of http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02108.html
now to the correct list for libffi patches. The gcc part has been
approved. Compiling libffi for powerpc64 with an older gcc that
doesn't define _CALL_LINUX should continue to be fine if using BFD
ld.
==================
Gold on powerpc64 doesn't support old ABI objects, but libffi contains
old ABI assembly. This patch modifies those files to support both old
and new ABI, and adds a builtin define to powerpc64 gcc that can be
used to select between the ABIs in assembly. I figure a define is
generally useful, and more robust than trying to duplicate gcc
configury in libffi (which could be overridden by CFLAGS anyway).
Bootstrapped and regression tested powerpc64-linux. OK to apply
mainline?
gcc/
* config/rs6000/linux64.h (TARGET_OS_CPP_BUILTINS): Define _CALL_LINUX.
libffi/
* src/powerpc/linux64_closure.S: Add new ABI support.
* src/powerpc/linux64.S: Likewise.
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h (revision 192660)
+++ gcc/config/rs6000/linux64.h (working copy)
@@ -318,6 +318,8 @@
builtin_define ("__PPC64__"); \
builtin_define ("__powerpc__"); \
builtin_define ("__powerpc64__"); \
+ if (!DOT_SYMBOLS) \
+ builtin_define ("_CALL_LINUX"); \
builtin_assert ("cpu=powerpc64"); \
builtin_assert ("machine=powerpc64"); \
} \
Index: libffi/src/powerpc/linux64_closure.S
===================================================================
--- libffi/src/powerpc/linux64_closure.S (revision 192660)
+++ libffi/src/powerpc/linux64_closure.S (working copy)
@@ -32,16 +32,24 @@
#ifdef __powerpc64__
FFI_HIDDEN (ffi_closure_LINUX64)
- FFI_HIDDEN (.ffi_closure_LINUX64)
- .globl ffi_closure_LINUX64, .ffi_closure_LINUX64
+ .globl ffi_closure_LINUX64
.section ".opd","aw"
.align 3
ffi_closure_LINUX64:
+#ifdef _CALL_LINUX
+ .quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0
+ .type ffi_closure_LINUX64,@function
+ .text
+.L.ffi_closure_LINUX64:
+#else
+ FFI_HIDDEN (.ffi_closure_LINUX64)
+ .globl .ffi_closure_LINUX64
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0
.size ffi_closure_LINUX64,24
.type .ffi_closure_LINUX64,@function
.text
.ffi_closure_LINUX64:
+#endif
.LFB1:
# save general regs into parm save area
std %r3, 48(%r1)
@@ -91,7 +99,11 @@
addi %r6, %r1, 128
# make the call
+#ifdef _CALL_LINUX
+ bl ffi_closure_helper_LINUX64
+#else
bl .ffi_closure_helper_LINUX64
+#endif
.Lret:
# now r3 contains the return type
@@ -194,7 +206,11 @@
.LFE1:
.long 0
.byte 0,12,0,1,128,0,0,0
+#ifdef _CALL_LINUX
+ .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
+#else
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
+#endif
.section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
Index: libffi/src/powerpc/linux64.S
===================================================================
--- libffi/src/powerpc/linux64.S (revision 192660)
+++ libffi/src/powerpc/linux64.S (working copy)
@@ -30,16 +30,25 @@
#include <ffi.h>
#ifdef __powerpc64__
- .hidden ffi_call_LINUX64, .ffi_call_LINUX64
- .globl ffi_call_LINUX64, .ffi_call_LINUX64
+ .hidden ffi_call_LINUX64
+ .globl ffi_call_LINUX64
.section ".opd","aw"
.align 3
ffi_call_LINUX64:
+#ifdef _CALL_LINUX
+ .quad .L.ffi_call_LINUX64,.TOC.@tocbase,0
+ .type ffi_call_LINUX64,@function
+ .text
+.L.ffi_call_LINUX64:
+#else
+ .hidden .ffi_call_LINUX64
+ .globl .ffi_call_LINUX64
.quad .ffi_call_LINUX64,.TOC.@tocbase,0
.size ffi_call_LINUX64,24
.type .ffi_call_LINUX64,@function
.text
.ffi_call_LINUX64:
+#endif
.LFB1:
mflr %r0
std %r28, -32(%r1)
@@ -58,7 +67,11 @@
/* Call ffi_prep_args64. */
mr %r4, %r1
+#ifdef _CALL_LINUX
+ bl ffi_prep_args64
+#else
bl .ffi_prep_args64
+#endif
ld %r0, 0(%r29)
ld %r2, 8(%r29)
@@ -137,7 +150,11 @@
.LFE1:
.long 0
.byte 0,12,0,1,128,4,0,0
+#ifdef _CALL_LINUX
+ .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64
+#else
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64
+#endif
.section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RS6000] libffi ppc64 assembly
2012-10-25 0:32 [RS6000] libffi ppc64 assembly Alan Modra
@ 2012-10-30 12:13 ` Anthony Green
2012-10-31 3:48 ` Alan Modra
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Green @ 2012-10-30 12:13 UTC (permalink / raw)
To: Alan Modra; +Cc: libffi-discuss
Thanks Alan. I'll pull it into the libffi git tree once you commit it
to the GCC tree.
Thanks,
Anthony Green
On Wed, Oct 24, 2012 at 8:32 PM, Alan Modra <amodra@gmail.com> wrote:
> This is a repost of http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02108.html
> now to the correct list for libffi patches. The gcc part has been
> approved. Compiling libffi for powerpc64 with an older gcc that
> doesn't define _CALL_LINUX should continue to be fine if using BFD
> ld.
>
> ==================
> Gold on powerpc64 doesn't support old ABI objects, but libffi contains
> old ABI assembly. This patch modifies those files to support both old
> and new ABI, and adds a builtin define to powerpc64 gcc that can be
> used to select between the ABIs in assembly. I figure a define is
> generally useful, and more robust than trying to duplicate gcc
> configury in libffi (which could be overridden by CFLAGS anyway).
> Bootstrapped and regression tested powerpc64-linux. OK to apply
> mainline?
>
> gcc/
> * config/rs6000/linux64.h (TARGET_OS_CPP_BUILTINS): Define _CALL_LINUX.
> libffi/
> * src/powerpc/linux64_closure.S: Add new ABI support.
> * src/powerpc/linux64.S: Likewise.
>
> Index: gcc/config/rs6000/linux64.h
> ===================================================================
> --- gcc/config/rs6000/linux64.h (revision 192660)
> +++ gcc/config/rs6000/linux64.h (working copy)
> @@ -318,6 +318,8 @@
> builtin_define ("__PPC64__"); \
> builtin_define ("__powerpc__"); \
> builtin_define ("__powerpc64__"); \
> + if (!DOT_SYMBOLS) \
> + builtin_define ("_CALL_LINUX"); \
> builtin_assert ("cpu=powerpc64"); \
> builtin_assert ("machine=powerpc64"); \
> } \
> Index: libffi/src/powerpc/linux64_closure.S
> ===================================================================
> --- libffi/src/powerpc/linux64_closure.S (revision 192660)
> +++ libffi/src/powerpc/linux64_closure.S (working copy)
> @@ -32,16 +32,24 @@
>
> #ifdef __powerpc64__
> FFI_HIDDEN (ffi_closure_LINUX64)
> - FFI_HIDDEN (.ffi_closure_LINUX64)
> - .globl ffi_closure_LINUX64, .ffi_closure_LINUX64
> + .globl ffi_closure_LINUX64
> .section ".opd","aw"
> .align 3
> ffi_closure_LINUX64:
> +#ifdef _CALL_LINUX
> + .quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0
> + .type ffi_closure_LINUX64,@function
> + .text
> +.L.ffi_closure_LINUX64:
> +#else
> + FFI_HIDDEN (.ffi_closure_LINUX64)
> + .globl .ffi_closure_LINUX64
> .quad .ffi_closure_LINUX64,.TOC.@tocbase,0
> .size ffi_closure_LINUX64,24
> .type .ffi_closure_LINUX64,@function
> .text
> .ffi_closure_LINUX64:
> +#endif
> .LFB1:
> # save general regs into parm save area
> std %r3, 48(%r1)
> @@ -91,7 +99,11 @@
> addi %r6, %r1, 128
>
> # make the call
> +#ifdef _CALL_LINUX
> + bl ffi_closure_helper_LINUX64
> +#else
> bl .ffi_closure_helper_LINUX64
> +#endif
> .Lret:
>
> # now r3 contains the return type
> @@ -194,7 +206,11 @@
> .LFE1:
> .long 0
> .byte 0,12,0,1,128,0,0,0
> +#ifdef _CALL_LINUX
> + .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
> +#else
> .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
> +#endif
>
> .section .eh_frame,EH_FRAME_FLAGS,@progbits
> .Lframe1:
> Index: libffi/src/powerpc/linux64.S
> ===================================================================
> --- libffi/src/powerpc/linux64.S (revision 192660)
> +++ libffi/src/powerpc/linux64.S (working copy)
> @@ -30,16 +30,25 @@
> #include <ffi.h>
>
> #ifdef __powerpc64__
> - .hidden ffi_call_LINUX64, .ffi_call_LINUX64
> - .globl ffi_call_LINUX64, .ffi_call_LINUX64
> + .hidden ffi_call_LINUX64
> + .globl ffi_call_LINUX64
> .section ".opd","aw"
> .align 3
> ffi_call_LINUX64:
> +#ifdef _CALL_LINUX
> + .quad .L.ffi_call_LINUX64,.TOC.@tocbase,0
> + .type ffi_call_LINUX64,@function
> + .text
> +.L.ffi_call_LINUX64:
> +#else
> + .hidden .ffi_call_LINUX64
> + .globl .ffi_call_LINUX64
> .quad .ffi_call_LINUX64,.TOC.@tocbase,0
> .size ffi_call_LINUX64,24
> .type .ffi_call_LINUX64,@function
> .text
> .ffi_call_LINUX64:
> +#endif
> .LFB1:
> mflr %r0
> std %r28, -32(%r1)
> @@ -58,7 +67,11 @@
>
> /* Call ffi_prep_args64. */
> mr %r4, %r1
> +#ifdef _CALL_LINUX
> + bl ffi_prep_args64
> +#else
> bl .ffi_prep_args64
> +#endif
>
> ld %r0, 0(%r29)
> ld %r2, 8(%r29)
> @@ -137,7 +150,11 @@
> .LFE1:
> .long 0
> .byte 0,12,0,1,128,4,0,0
> +#ifdef _CALL_LINUX
> + .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64
> +#else
> .size .ffi_call_LINUX64,.-.ffi_call_LINUX64
> +#endif
>
> .section .eh_frame,EH_FRAME_FLAGS,@progbits
> .Lframe1:
>
> --
> Alan Modra
> Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RS6000] libffi ppc64 assembly
2012-10-30 12:13 ` Anthony Green
@ 2012-10-31 3:48 ` Alan Modra
0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2012-10-31 3:48 UTC (permalink / raw)
To: Anthony Green; +Cc: libffi-discuss
On Tue, Oct 30, 2012 at 08:13:11AM -0400, Anthony Green wrote:
> Thanks Alan. I'll pull it into the libffi git tree once you commit it
> to the GCC tree.
Thanks. Committed to mainline gcc, revision 193015.
> > libffi/
> > * src/powerpc/linux64_closure.S: Add new ABI support.
> > * src/powerpc/linux64.S: Likewise.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-31 3:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-25 0:32 [RS6000] libffi ppc64 assembly Alan Modra
2012-10-30 12:13 ` Anthony Green
2012-10-31 3:48 ` Alan Modra
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).