This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libffi failure on ppc linux 32-bit
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Andreas Tobler <toa at pop dot agri dot ch>
- Cc: Matthias Klose <doko at cs dot tu-berlin dot de>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 08 Mar 2007 08:06:03 -0300
- Subject: Re: libffi failure on ppc linux 32-bit
- References: <45EF41DC.3070803@pop.agri.ch>
On Mar 7, 2007, Andreas Tobler <toa@pop.agri.ch> wrote:
> I guess you have had a test run missing:
> Index: src/powerpc/ffi.c
> - addr = addr1 + i;
> There is another warning:
> flush_icache (tramp, codeloc, FFI_TRAMPOLINE_SIZE);
Thanks, sorry about that.
Here's a patch that should fix both. I'm checking it in as obvious,
but will you please let me know if it doesn't fix it completely?
for libffi/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* src/powerpc/ffi.c (flush_icache): Fix left-over from previous
patch.
(ffi_prep_closure_loc): Remove unneeded casts. Add needed ones.
Index: libffi/src/powerpc/ffi.c
===================================================================
--- libffi/src/powerpc/ffi.c.orig 2007-03-08 07:26:18.000000000 -0300
+++ libffi/src/powerpc/ffi.c 2007-03-08 07:39:34.000000000 -0300
@@ -839,11 +839,8 @@ flush_icache (char *wraddr, char *xaddr,
{
int i;
for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE)
- {
- addr = addr1 + i;
- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
- : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
- }
+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
+ : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
__asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;"
: : "r"(xaddr + size - 1), "r"(wraddr + size - 1)
: "memory");
@@ -863,7 +860,7 @@ ffi_prep_closure_loc (ffi_closure *closu
FFI_ASSERT (cif->abi == FFI_LINUX64);
/* Copy function address and TOC from ffi_closure_LINUX64. */
memcpy (tramp, (char *) ffi_closure_LINUX64, 16);
- tramp[2] = (void *) codeloc;
+ tramp[2] = codeloc;
#else
unsigned int *tramp;
@@ -879,10 +876,10 @@ ffi_prep_closure_loc (ffi_closure *closu
tramp[8] = 0x7c0903a6; /* mtctr r0 */
tramp[9] = 0x4e800420; /* bctr */
*(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */
- *(void **) &tramp[3] = (void *) codeloc; /* context */
+ *(void **) &tramp[3] = codeloc; /* context */
/* Flush the icache. */
- flush_icache (tramp, codeloc, FFI_TRAMPOLINE_SIZE);
+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE);
#endif
closure->cif = cif;
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}