[prev in list] [next in list] [prev in thread] [next in thread]
List: freetype-devel
Subject: [ft-devel] Re: Re: Fw: Compile Error use arm-linux-gcc3.4.1
From: "Johnson Y. Yan" <yinsen_yan () foxitsoftware ! com>
Date: 2011-01-16 1:28:51
Message-ID: 201101160928483596730 () foxitsoftware ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
[Attachment #4 (text/plain)]
Thanks freetype team, I use "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */, and it work fine now.
Johnson Y. Yan
发件人: mpsuzuki
发送时间: 2011-01-15 20:49:46
收件人: yinsen_yan
抄送: freetype; freetype-devel
主题: Re: Fw: Compile Error use arm-linux-gcc3.4.1
Dear Johnson,
I guess this failure has following scenario and not
related with ARM instruction set. I found that quite
similar error was found by Qt developers:
http://bugreports.qt.nokia.com/browse/QTBUG-6521
1) You build with default ftconfig.h in "include/freetype/config/ftconfig.h",
instead of auto-configured ftconfig.h in "builds/unix/ftconfig.h".
It is not so popular for the cross developers using
configure (so the error reproduction could be tricky),
but it might be popular for the projects that include
FreeType2 source code and build with external configurators,
aslike Qt.
2) FT_MulFix_arm() in include/freetype/config/ftconfig.h has
a problematic syntax, an argument to "orr" instruction is
omitted. On the other hand, builds/unix/ftconfig.h does
not have.
include/freetype/config/ftconfig.h
----------------------------------
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
builds/unix/ftconfig.in
-----------------------
__asm__ __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
You can find the number of arguments to "orr" is different.
3) The earlier version of GNU binutils does not accept this
"omitted" syntax, although latest version (binutils-2.21,
I've tested) accepts it. As far as using GNU binutils (to
reproduce this error, I used GNU binutils-2.12), even if
I add "-march=armv5" to GCC, the problem occurs. So I
think this is not related with the incorrect instruction
set.
4) Therefore, I guess, fixing the omitted syntax in
include/freetype/config/ftconfig.h
may help you...? Also, "__asm__" would be better "asm".
I've fixed in GIT. Please check if the fix of the argument
number can help you.
diff --git a/ChangeLog b/ChangeLog
index c3dff28..fcc47ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2011-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ Fix ARM assembly code in include/freetype/config/ftconfig.h.
+
+ * include/freetype/config/ftconfig.h (FT_MulFix_arm):
+ Copy the maintained code from builds/unix/ftconfig.in.
+ Old GNU binutils could not accept the reduced syntax
+ `orr %0, %2, lsl #16'. Un-omitted syntax like RVCT,
+ `orr %0, %0, %2, lsl #16' is better. Reported by
+ Johnson Y. Yan. The bug report by Qt developers is
+ considered too.
+
+ http://bugreports.qt.nokia.com/browse/QTBUG-6521
+
+2011-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS.
* builds/unix/configure.raw: Consider recent gcc-standard
diff --git a/builds/unix/install-sh b/builds/unix/install-sh
old mode 100644
new mode 100755
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index cbe30f2..bcbcd6f 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -348,14 +348,14 @@ FT_BEGIN_HEADER
register FT_Int32 t, t2;
- asm __volatile__ (
- "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
- "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
- "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
- "adds %1, %1, %0\n\t" /* %1 += %0 */
- "adc %2, %2, #0\n\t" /* %2 += carry */
- "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
- "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
+ __asm__ __volatile__ (
+ "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
+ "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
+ "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
+ "adds %1, %1, %0\n\t" /* %1 += %0 */
+ "adc %2, %2, #0\n\t" /* %2 += carry */
+ "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
+ "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b) );
return a;
Regards,
mpsuzuki
On Sat, 15 Jan 2011 19:54:11 +0900
suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> wrote:
>Dear Johnson,
>
>I will take a look, but I don't have ARMv4 machine to check
>the assembly code. Could you help me to check the revised
>version will work or not? The easiest/simplest fix would be
>disabling the assembly code for smaller versions of ARM
>architecture, but it won't be what you want...
>
>Regards,
>mpsuzuki
>
>Werner LEMBERG wrote:
>> ARM developers, please comment and help if possible!
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.6049" name=GENERATOR>
<STYLE>@font-face {
font-family: 宋体;
}
@font-face {
font-family: Verdana;
}
@font-face {
font-family: @宋体;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; \
layout-grid: 15.6pt; } P.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: \
"Times New Roman"; TEXT-ALIGN: justify }
LI.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: \
"Times New Roman"; TEXT-ALIGN: justify }
DIV.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: \
"Times New Roman"; TEXT-ALIGN: justify }
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: Verdana; \
TEXT-DECORATION: none; mso-style-type: personal-compose }
DIV.Section1 {
page: Section1
}
BLOCKQUOTE {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
</HEAD>
<BODY style="MARGIN-TOP: 10px; MARGIN-LEFT: 10px; MARGIN-RIGHT: 10px">
<DIV><FONT face=Verdana color=#0000ff size=2><FONT color=#000000>Thanks freetype
team, I use</FONT> <FONT
color=#000000>"orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */, \
and it work fine now.</FONT></FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV align=left>
<DIV align=left><FONT face=Verdana size=2></FONT></DIV>
<DIV><FONT face=Verdana size=2>Johnson Y. Yan</FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT></DIV></DIV>
<DIV><FONT face=Verdana size=2>
<HR>
</FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发件人:</STRONG>
mpsuzuki</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发送时间:</STRONG>
2011-01-15 20:49:46</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>收件人:</STRONG>
yinsen_yan</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>抄送:</STRONG> freetype;
freetype-devel</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>主题:</STRONG> Re: Fw: Compile Error
use arm-linux-gcc3.4.1</FONT></FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2>
<DIV>Dear Johnson,</DIV>
<DIV></DIV>
<DIV>I guess this failure has following scenario and not</DIV>
<DIV>related with ARM instruction set. I found that quite</DIV>
<DIV>similar error was found by Qt developers:</DIV>
<DIV> http://bugreports.qt.nokia.com/browse/QTBUG-6521</DIV>
<DIV></DIV>
<DIV>1) You build with default ftconfig.h in "include/freetype/config/ftconfig.h",</DIV>
<DIV> instead of auto-configured ftconfig.h in "builds/unix/ftconfig.h".</DIV>
<DIV> It is not so popular for the cross developers using</DIV>
<DIV> configure (so the error reproduction could be tricky),</DIV>
<DIV> but it might be popular for the projects that include</DIV>
<DIV> FreeType2 source code and build with external configurators,</DIV>
<DIV> aslike Qt.</DIV>
<DIV></DIV>
<DIV>2) FT_MulFix_arm() in include/freetype/config/ftconfig.h has</DIV>
<DIV> a problematic syntax, an argument to "orr" instruction is</DIV>
<DIV> omitted. On the other hand, builds/unix/ftconfig.h does</DIV>
<DIV> not have.</DIV>
<DIV></DIV>
<DIV> include/freetype/config/ftconfig.h</DIV>
<DIV> ----------------------------------</DIV>
<DIV></DIV>
<DIV> asm __volatile__ (</DIV>
<DIV> "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */</DIV>
<DIV> "mov %0, %2,&nbs \
p;asr #31\n\t" /* %0 = (hi >> 31) */</DIV>
<DIV> "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */</DIV>
<DIV> "adds %1, %1, %0\ \
n\t" /* %1 += %0 */</DIV>
<DIV> "adc %2, %2,&nbs \
p;#0\n\t" /* %2 += carry */</DIV>
<DIV> "mov %0, %1,&nbs \
p;lsr #16\n\t" /* %0 = %1 >> 16 */</DIV>
<DIV> "orr %0, %2,&nbs \
p;lsl #16\n\t" /* %0 |= %2 << 16 */</DIV>
<DIV></DIV>
<DIV> builds/unix/ftconfig.in</DIV>
<DIV> -----------------------</DIV>
<DIV> __asm__ __volatile__ (</DIV>
<DIV> "smull %1, %2, %4, \
%3\n\t" /* (lo=%1,hi=%2) = a*b */</DIV>
<DIV> "mov %0, %2,&nbs \
p;asr #31\n\t" /* %0 = (hi >> 31) */</DIV>
<DIV> "add %0, %0,&nbs \
p;#0x8000\n\t" /* %0 += 0x8000 */</DIV>
<DIV> "adds %1, %1, %0\ \
n\t" /* %1 += %0 */</DIV>
<DIV> "adc %2, %2,&nbs \
p;#0\n\t" /* %2 += carry */</DIV>
<DIV> "mov %0, %1,&nbs \
p;lsr #16\n\t" /* %0 = %1 >> 16 */</DIV>
<DIV> "orr %0, %0,&nbs \
p;%2, lsl #16\n\t" /* %0 |= %2 << 16 */</DIV>
<DIV></DIV>
<DIV> You can find the number of arguments to "orr" is different.</DIV>
<DIV></DIV>
<DIV>3) The earlier version of GNU binutils does not accept this</DIV>
<DIV> "omitted" syntax, although latest version (binutils-2.21,</DIV>
<DIV> I've tested) accepts it. As far as using GNU binutils (to</DIV>
<DIV> reproduce this error, I used GNU binutils-2.12), even if</DIV>
<DIV> I add "-march=armv5" to GCC, the problem occurs. So I</DIV>
<DIV> think this is not related with the incorrect instruction</DIV>
<DIV> set.</DIV>
<DIV></DIV>
<DIV>4) Therefore, I guess, fixing the omitted syntax in</DIV>
<DIV> include/freetype/config/ftconfig.h</DIV>
<DIV> may help you...? Also, "__asm__" would be better "asm".</DIV>
<DIV></DIV>
<DIV>I've fixed in GIT. Please check if the fix of the argument</DIV>
<DIV>number can help you.</DIV>
<DIV></DIV>
<DIV>diff --git a/ChangeLog b/ChangeLog</DIV>
<DIV>index c3dff28..fcc47ee 100644</DIV>
<DIV>--- a/ChangeLog</DIV>
<DIV>+++ b/ChangeLog</DIV>
<DIV>@@ -1,5 +1,19 @@</DIV>
<DIV> 2011-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp></DIV>
<DIV> </DIV>
<DIV>+
Fix ARM assembly code in include/freetype/config/ftconfig.h.</DIV>
<DIV>+</DIV>
<DIV>+ * include/freetype/config/ftconfig.h (FT_MulFix_arm):</DIV>
<DIV>+
Copy the maintained code from builds/unix/ftconfig.in.</DIV>
<DIV>+
Old GNU binutils could not accept the reduced syntax</DIV>
<DIV>+
`orr %0, %2, lsl #16'. Un-omitted syntax like RVCT,</DIV>
<DIV>+
`orr %0, %0, %2, lsl #16' is better. Reported by</DIV>
<DIV>+
Johnson Y. Yan. The bug report by Qt developers is</DIV>
<DIV>+ considered too.</DIV>
<DIV>+</DIV>
<DIV>+ http://bugreports.qt.nokia.com/browse/QTBUG-6521</DIV>
<DIV>+</DIV>
<DIV>+2011-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp></DIV>
<DIV>+</DIV>
<DIV>
Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS.</DIV>
<DIV> </DIV>
<DIV>
* builds/unix/configure.raw: Consider recent gcc-standard</DIV>
<DIV>diff --git a/builds/unix/install-sh b/builds/unix/install-sh</DIV>
<DIV>old mode 100644</DIV>
<DIV>new mode 100755</DIV>
<DIV>diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h</DIV>
<DIV>index cbe30f2..bcbcd6f 100644</DIV>
<DIV>--- a/include/freetype/config/ftconfig.h</DIV>
<DIV>+++ b/include/freetype/config/ftconfig.h</DIV>
<DIV>@@ -348,14 +348,14 @@ FT_BEGIN_HEADER</DIV>
<DIV> register FT_Int32 t, t2;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>- asm __volatile__ (</DIV>
<DIV>- "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */</DIV>
<DIV>- "mov %0, %2,&nb \
sp;asr #31\n\t" /* %0 = (hi >> 31) */</DIV>
<DIV>- "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */</DIV>
<DIV>- "adds %1, %1, %0 \
\n\t" /* %1 += %0 */</DIV>
<DIV>- "adc %2, %2,&nb \
sp;#0\n\t" /* %2 += carry */</DIV>
<DIV>- "mov %0, %1,&nb \
sp;lsr #16\n\t" /* %0 = %1 >> 16 */</DIV>
<DIV>- "orr %0, %2,&nb \
sp;lsl #16\n\t" /* %0 |= %2 << 16 */</DIV>
<DIV>+ __asm__ __volatile__ (</DIV>
<DIV>+ "smull %1, %2, %4,  \
;%3\n\t" /* (lo=%1,hi=%2) = a*b */</DIV>
<DIV>+ "mov %0, %2,&nb \
sp;asr #31\n\t" /* %0 = (hi >> 31) */</DIV>
<DIV>+ "add %0, %0,&nb \
sp;#0x8000\n\t" /* %0 += 0x8000 */</DIV>
<DIV>+ "adds %1, %1, %0 \
\n\t" /* %1 += %0 */</DIV>
<DIV>+ "adc %2, %2,&nb \
sp;#0\n\t" /* %2 += carry */</DIV>
<DIV>+ "mov %0, %1,&nb \
sp;lsr #16\n\t" /* %0 = %1 >> 16 */</DIV>
<DIV>+ "orr %0, %0,&nb \
sp;%2, lsl #16\n\t" /* %0 |= %2 << 16 */</DIV>
<DIV> : "=r"(a), "=&r"(t2), "=&r"(t)</DIV>
<DIV> : "r"(a), "r"(b) );</DIV>
<DIV> return a;</DIV>
<DIV></DIV>
<DIV>Regards,</DIV>
<DIV>mpsuzuki</DIV>
<DIV></DIV>
<DIV></DIV>
<DIV>On Sat, 15 Jan 2011 19:54:11 +0900</DIV>
<DIV>suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> wrote:</DIV>
<DIV></DIV>
<DIV>>Dear Johnson,</DIV>
<DIV>></DIV>
<DIV>>I will take a look, but I don't have ARMv4 machine to check</DIV>
<DIV>>the assembly code. Could you help me to check the revised</DIV>
<DIV>>version will work or not? The easiest/simplest fix would be</DIV>
<DIV>>disabling the assembly code for smaller versions of ARM</DIV>
<DIV>>architecture, but it won't be what you want...</DIV>
<DIV>></DIV>
<DIV>>Regards,</DIV>
<DIV>>mpsuzuki</DIV>
<DIV>></DIV>
<DIV>>Werner LEMBERG wrote:</DIV>
<DIV>>> ARM developers, please comment and help if possible!</DIV>
<DIV></DIV></FONT></DIV></BODY></HTML>
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic