* [PATCH] Workaround ARM VFP issue
@ 2012-03-06 12:38 Chung-Lin Tang
2012-03-06 14:20 ` Kyle Tinker
2012-06-08 21:20 ` Kyle Tinker
0 siblings, 2 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2012-03-06 12:38 UTC (permalink / raw)
To: libffi-discuss; +Cc: green, ktinker
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
This is patch to workaround the issue mentioned in this thread:
http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
The issue is not really that soft-float is broken, but rather the
toolchain used is simply too old, not really because it is old-ABI, but
too old a version of binutils; the .fpu directive, nor VFP instructions
are supported in the assembler, hence even building of the VFP
call/closure shims fail.
This patch is sort of a least attempt to shield away the VFP stuff when
__ARM_EABI__ is not defined. I apologize for such a token workaround, as
it can probably be optimized a bit more, but I just feel it's not
worthwhile; even GCC (recent versions) assumes such assembler features.
Kyle, can you please see if the patch can work for you? If in case it
doesn't, I might also suggest that you try to rebuild your toolchain
with a newer binutils version (at least post circa 2005), which should
at least not fail to build the library.
Thanks,
Chung-Lin
2012-03-06 Chung-Lin Tang <cltang@codesourcery.com>
* src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
to ffi_call_VFP().
(ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
ffi_closure_VFP.
* src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
[-- Attachment #2: ffi.diff --]
[-- Type: text/plain, Size: 1311 bytes --]
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 1f8597d..3ccceb9 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -251,8 +251,10 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case FFI_VFP:
+#ifdef __ARM_EABI__
ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
break;
+#endif
default:
FFI_ASSERT(0);
@@ -609,8 +611,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
if (cif->abi == FFI_SYSV)
closure_func = &ffi_closure_SYSV;
+#ifdef __ARM_EABI__
else if (cif->abi == FFI_VFP)
closure_func = &ffi_closure_VFP;
+#endif
else
return FFI_BAD_ABI;
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index 60e2ae3..2505305 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -334,7 +334,8 @@ ARM_FUNC_START ffi_closure_SYSV
/* Below are VFP hard-float ABI call and closure implementations.
- Add VFP FPU directive here. */
+ Add VFP FPU directive here. This is only compiled into the library under EABI. */
+#ifdef __ARM_EABI__
.fpu vfp
@ r0: fn
@@ -491,6 +492,7 @@ ARM_FUNC_START ffi_closure_VFP
.ffi_closure_VFP_end:
UNWIND .fnend
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
ENTRY(ffi_arm_trampoline)
stmfd sp!, {r0-r3}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Workaround ARM VFP issue
2012-03-06 12:38 [PATCH] Workaround ARM VFP issue Chung-Lin Tang
@ 2012-03-06 14:20 ` Kyle Tinker
2012-06-08 21:20 ` Kyle Tinker
1 sibling, 0 replies; 6+ messages in thread
From: Kyle Tinker @ 2012-03-06 14:20 UTC (permalink / raw)
To: Chung-Lin Tang; +Cc: libffi-discuss, green
Chung-Lin,
First of all, THANK you for even looking at this. I know the toolchain
is pretty^H^H^H^H^H^H *really* old.
I will definitely try to compile this and let you know the results.
Unfortunately, I don't have a lot of control over the toolchain, as it's
not mine--I'm using one provided by a vendor. I'll see what I can do to
update or get binutils updated. I know that I've hit a number of
compiler issues (in both this project and others) due to the toolchain
being ancient. :(
Give me a few hours/days and I'll get the results back to you.
Thanks,
*Kyle Tinker* *|* *Software Developer* *|* *WorkForce Software*
*|* P: (734) 742-2616 *|* F: (734) 542-0635
*|* ktinker@workforcesoftware.com <mailto:ktinker@workforcesoftware.com>
WorkForce Software — Mitigating Complexity — Ensuring Compliance
— Enabling Strategic HR
WorkForce Software
From: Chung-Lin Tang <cltang@codesourcery.com>
Sent: Tue, Mar 06, 2012 7:37 AM
To: libffi-discuss@sourceware.org <libffi-discuss@sourceware.org>
CC: "green@moxielogic.com" <green@moxielogic.com>, Kyle Tinker
<ktinker@workforcesoftware.com>
Subject: [PATCH] Workaround ARM VFP issue
> This is patch to workaround the issue mentioned in this thread:
> http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
>
> The issue is not really that soft-float is broken, but rather the
> toolchain used is simply too old, not really because it is old-ABI, but
> too old a version of binutils; the .fpu directive, nor VFP instructions
> are supported in the assembler, hence even building of the VFP
> call/closure shims fail.
>
> This patch is sort of a least attempt to shield away the VFP stuff when
> __ARM_EABI__ is not defined. I apologize for such a token workaround, as
> it can probably be optimized a bit more, but I just feel it's not
> worthwhile; even GCC (recent versions) assumes such assembler features.
>
> Kyle, can you please see if the patch can work for you? If in case it
> doesn't, I might also suggest that you try to rebuild your toolchain
> with a newer binutils version (at least post circa 2005), which should
> at least not fail to build the library.
>
> Thanks,
> Chung-Lin
>
> 2012-03-06 Chung-Lin Tang<cltang@codesourcery.com>
>
> * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
> to ffi_call_VFP().
> (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
> ffi_closure_VFP.
> * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Workaround ARM VFP issue
2012-03-06 12:38 [PATCH] Workaround ARM VFP issue Chung-Lin Tang
2012-03-06 14:20 ` Kyle Tinker
@ 2012-06-08 21:20 ` Kyle Tinker
1 sibling, 0 replies; 6+ messages in thread
From: Kyle Tinker @ 2012-06-08 21:20 UTC (permalink / raw)
To: Chung-Lin Tang; +Cc: libffi-discuss, green
Chung-Lin:
First, sorry for the large (3 month) delay.
I've applied the patch and gotten it to compile on our system! THANK YOU!
We had to define the __SOFTFP__ cflag to get it to compile correctly,
but the patch worked great once we did that.
Sorry our toolchain is so old... performance is always a consideration,
but we shouldn't be making THAT many libffi calls for the changes you
made to matter. I certainly wouldn't optimize your code for the sake of
a toolchain that predates 2005.
Thanks,
*Kyle Tinker* *|* *Software Development Manager* *|* *WorkForce Software*
WorkForce Software — Mitigating Complexity — Ensuring Compliance
— Enabling Strategic HR
From: Chung-Lin Tang <cltang@codesourcery.com>
Sent: Tue, Mar 06, 2012 7:37 AM
To: libffi-discuss@sourceware.org <libffi-discuss@sourceware.org>
CC: "green@moxielogic.com" <green@moxielogic.com>, Kyle Tinker
<ktinker@workforcesoftware.com>
Subject: [PATCH] Workaround ARM VFP issue
> This is patch to workaround the issue mentioned in this thread:
> http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
>
> The issue is not really that soft-float is broken, but rather the
> toolchain used is simply too old, not really because it is old-ABI, but
> too old a version of binutils; the .fpu directive, nor VFP instructions
> are supported in the assembler, hence even building of the VFP
> call/closure shims fail.
>
> This patch is sort of a least attempt to shield away the VFP stuff when
> __ARM_EABI__ is not defined. I apologize for such a token workaround, as
> it can probably be optimized a bit more, but I just feel it's not
> worthwhile; even GCC (recent versions) assumes such assembler features.
>
> Kyle, can you please see if the patch can work for you? If in case it
> doesn't, I might also suggest that you try to rebuild your toolchain
> with a newer binutils version (at least post circa 2005), which should
> at least not fail to build the library.
>
> Thanks,
> Chung-Lin
>
> 2012-03-06 Chung-Lin Tang<cltang@codesourcery.com>
>
> * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
> to ffi_call_VFP().
> (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
> ffi_closure_VFP.
> * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Workaround ARM VFP issue
@ 2012-03-06 9:58 Chung-Lin Tang
0 siblings, 0 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2012-03-06 9:58 UTC (permalink / raw)
To: libffi-discuss; +Cc: green
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
This is patch to workaround the issue mentioned in this thread:
http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
The issue is not really that soft-float is broken, but rather the
toolchain used is simply too old, not really because it is old-ABI, but
too old a version of binutils; the .fpu directive, nor VFP instructions
are supported in the assembler, hence even building of the VFP
call/closure shims fail.
This patch is sort of a least attempt to shield away the VFP stuff when
__ARM_EABI__ is not defined. I apologize for such a token workaround, as
it can probably be optimized a bit more, but I just feel it's not
worthwhile; even GCC (recent versions) assumes such assembler features.
Kyle, can you please see if the patch can work for you? If in case it
doesn't, I might also suggest that you try to rebuild your toolchain
with a newer binutils version (at least post circa 2005), which should
at least not fail to build the library.
Thanks,
Chung-Lin
2012-03-06 Chung-Lin Tang <cltang@codesourcery.com>
* src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
to ffi_call_VFP().
(ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
ffi_closure_VFP.
* src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
[-- Attachment #2.1: Type: application/applefile, Size: 430 bytes --]
[-- Attachment #2.2: ffi.diff --]
[-- Type: application/octet-stream, Size: 1311 bytes --]
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 1f8597d..3ccceb9 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -251,8 +251,10 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case FFI_VFP:
+#ifdef __ARM_EABI__
ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
break;
+#endif
default:
FFI_ASSERT(0);
@@ -609,8 +611,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
if (cif->abi == FFI_SYSV)
closure_func = &ffi_closure_SYSV;
+#ifdef __ARM_EABI__
else if (cif->abi == FFI_VFP)
closure_func = &ffi_closure_VFP;
+#endif
else
return FFI_BAD_ABI;
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index 60e2ae3..2505305 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -334,7 +334,8 @@ ARM_FUNC_START ffi_closure_SYSV
/* Below are VFP hard-float ABI call and closure implementations.
- Add VFP FPU directive here. */
+ Add VFP FPU directive here. This is only compiled into the library under EABI. */
+#ifdef __ARM_EABI__
.fpu vfp
@ r0: fn
@@ -491,6 +492,7 @@ ARM_FUNC_START ffi_closure_VFP
.ffi_closure_VFP_end:
UNWIND .fnend
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
ENTRY(ffi_arm_trampoline)
stmfd sp!, {r0-r3}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Workaround ARM VFP issue
@ 2012-03-06 9:55 Chung-Lin Tang
0 siblings, 0 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2012-03-06 9:55 UTC (permalink / raw)
To: libffi-discuss; +Cc: green, ktinker
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
This is patch to workaround the issue mentioned in this thread:
http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
The issue is not really that soft-float is broken, but rather the
toolchain used is simply too old, not really because it is old-ABI, but
too old a version of binutils; the .fpu directive, nor VFP instructions
are supported in the assembler, hence even building of the VFP
call/closure shims fail.
This patch is sort of a least attempt to shield away the VFP stuff when
__ARM_EABI__ is not defined. I apologize for such a token workaround, as
it can probably be optimized a bit more, but I just feel it's not
worthwhile; even GCC (recent versions) assumes such assembler features.
Kyle, can you please see if the patch can work for you? If in case it
doesn't, I might also suggest that you try to rebuild your toolchain
with a newer binutils version (at least post circa 2005), which should
at least not fail to build the library.
Thanks,
Chung-Lin
2012-03-06 Chung-Lin Tang <cltang@codesourcery.com>
* src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
to ffi_call_VFP().
(ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
ffi_closure_VFP.
* src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
[-- Attachment #2.1: Type: application/applefile, Size: 430 bytes --]
[-- Attachment #2.2: ffi.diff --]
[-- Type: application/octet-stream, Size: 1311 bytes --]
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 1f8597d..3ccceb9 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -251,8 +251,10 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case FFI_VFP:
+#ifdef __ARM_EABI__
ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
break;
+#endif
default:
FFI_ASSERT(0);
@@ -609,8 +611,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
if (cif->abi == FFI_SYSV)
closure_func = &ffi_closure_SYSV;
+#ifdef __ARM_EABI__
else if (cif->abi == FFI_VFP)
closure_func = &ffi_closure_VFP;
+#endif
else
return FFI_BAD_ABI;
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index 60e2ae3..2505305 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -334,7 +334,8 @@ ARM_FUNC_START ffi_closure_SYSV
/* Below are VFP hard-float ABI call and closure implementations.
- Add VFP FPU directive here. */
+ Add VFP FPU directive here. This is only compiled into the library under EABI. */
+#ifdef __ARM_EABI__
.fpu vfp
@ r0: fn
@@ -491,6 +492,7 @@ ARM_FUNC_START ffi_closure_VFP
.ffi_closure_VFP_end:
UNWIND .fnend
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
ENTRY(ffi_arm_trampoline)
stmfd sp!, {r0-r3}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Workaround ARM VFP issue
@ 2012-03-06 9:54 Chung-Lin Tang
0 siblings, 0 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2012-03-06 9:54 UTC (permalink / raw)
To: libffi-discuss; +Cc: green, ktinker
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
This is patch to workaround the issue mentioned in this thread:
http://sourceware.org/ml/libffi-discuss/2012/msg00038.html
The issue is not really that soft-float is broken, but rather the
toolchain used is simply too old, not really because it is old-ABI, but
too old a version of binutils; the .fpu directive, nor VFP instructions
are supported in the assembler, hence even building of the VFP
call/closure shims fail.
This patch is sort of a least attempt to shield away the VFP stuff when
__ARM_EABI__ is not defined. I apologize for such a token workaround, as
it can probably be optimized a bit more, but I just feel it's not
worthwhile; even GCC (recent versions) assumes such assembler features.
Kyle, can you please see if the patch can work for you? If in case it
doesn't, I might also suggest that you try to rebuild your toolchain
with a newer binutils version (at least post circa 2005), which should
at least not fail to build the library.
Thanks,
Chung-Lin
2012-03-06 Chung-Lin Tang <cltang@codesourcery.com>
* src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call
to ffi_call_VFP().
(ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
ffi_closure_VFP.
* src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
[-- Attachment #2.1: Type: application/applefile, Size: 430 bytes --]
[-- Attachment #2.2: ffi.diff --]
[-- Type: application/octet-stream, Size: 1311 bytes --]
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 1f8597d..3ccceb9 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -251,8 +251,10 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case FFI_VFP:
+#ifdef __ARM_EABI__
ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue);
break;
+#endif
default:
FFI_ASSERT(0);
@@ -609,8 +611,10 @@ ffi_prep_closure_loc (ffi_closure* closure,
if (cif->abi == FFI_SYSV)
closure_func = &ffi_closure_SYSV;
+#ifdef __ARM_EABI__
else if (cif->abi == FFI_VFP)
closure_func = &ffi_closure_VFP;
+#endif
else
return FFI_BAD_ABI;
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index 60e2ae3..2505305 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -334,7 +334,8 @@ ARM_FUNC_START ffi_closure_SYSV
/* Below are VFP hard-float ABI call and closure implementations.
- Add VFP FPU directive here. */
+ Add VFP FPU directive here. This is only compiled into the library under EABI. */
+#ifdef __ARM_EABI__
.fpu vfp
@ r0: fn
@@ -491,6 +492,7 @@ ARM_FUNC_START ffi_closure_VFP
.ffi_closure_VFP_end:
UNWIND .fnend
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
+#endif
ENTRY(ffi_arm_trampoline)
stmfd sp!, {r0-r3}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-06-08 21:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-06 12:38 [PATCH] Workaround ARM VFP issue Chung-Lin Tang
2012-03-06 14:20 ` Kyle Tinker
2012-06-08 21:20 ` Kyle Tinker
-- strict thread matches above, loose matches on Subject: below --
2012-03-06 9:58 Chung-Lin Tang
2012-03-06 9:55 Chung-Lin Tang
2012-03-06 9:54 Chung-Lin Tang
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).