This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Building with -fPIC on ARM uclibc


Hello,

Recently, I had to build Python and Ctypes for an ARM device with
uclibc. Loading the ctypes module (and libffi) triggers this error:
"RARM_PC24: compile shared libraries with -fPIC". The error was caused
by a symbol used in src/arm/sysv.S

Here is the diff of my fix for this issue:

--- a/src/arm/sysv.S 2009-12-29 16:22:26.000000000 +0100
+++ b/src/arm/sysv.S      2010-04-28 12:31:55.000000000 +0200
@@ -243,11 +243,11 @@
        stmfd   sp!, {ip, lr}
        UNWIND .save    {r0, lr}
        add     r2, sp, #8
-       .pad #16
+       UNWIND .pad #16
        sub     sp, sp, #16
        str     sp, [sp, #8]
        add     r1, sp, #8
-       bl      ffi_closure_SYSV_inner
+       bl      ffi_closure_SYSV_inner(PLT)
        cmp     r0, #FFI_TYPE_INT
        beq     .Lretint

The UNWIND line fixed compilation, and the bl line fixed the relocation problem.

I don't know if this fix is correct for you (I'm not really confident
in my ARM skills), but it works well!

Best regards,

Geoffroy Couprie


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]