Re: [Qt-iphone-developer] Solution to bug 3082827 (4.7 fails to link)
Status: Pre-Alpha
Brought to you by:
greybird
|
From: Mark K. <gre...@ma...> - 2010-10-20 08:48:52
|
I forgot to ask, did you run the test case for qatomicponter and qatomicinit just to be safe?
Regards,
Mark Kromis
On Oct 19, 2010, at 1:34 PM, jacob navia wrote:
> Hi
> Bug 3082827 says:
> ---------------------------------------------------------------
> Hi
>
> We have translated the 4.7 source code. There were minor problems tat we
> got around by modifying the Makefiles. When we arrive at the link time
> however, we are confronted to a bug that we can´t solve:
>
> [code]
> {standard input}:66:selected processor does not support `ldrex ip,[r3]'
> {standard input}:67:lo register required -- `sub ip,ip,#1'
> {standard input}:68:selected processor does not support `strex r1,ip,[r3]'
> {standard input}:69:selected processor does not support `teq r1,#0'
> Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
> failed with exit code 1
> [/code]
>
> There is no way to know which object code file is at fault. We suspect
> that the C++ error handling but we cnt say for sure.
>
> My email is
> ja...@ja...
>
> Thanks in advance for your help
> -----------------------------------------------------------------
>
> This problem doesn't appear when compiling for the simulator of course.
>
> More information.
> This bug is produced by the inline assembly in qatomic_armv6.h, in the
> function
> inline bool QBasicAtomicInt::ref()
> {
> register int newValue;
> register int result;
> asm volatile("0:\n\t"
> "ldrex %[newValue], [%[_q_value]]\n\t"
> "add %[newValue], %[newValue], #1\n\t"
> "strex %[result], %[newValue], [%[_q_value]]\n\t"
> "teq %[result], #0\n\t"
> "bne 0b\n\t"
> : [newValue] "=&r" (newValue),
> [result] "=&r" (result),
> "+m" (_q_value)
> : [_q_value] "r" (&_q_value)
> : "cc", "memory");
> return newValue != 0;
> }
>
> The problem seems to be that the inline assembler of the gcc version is
> completely broken.
> (1) The instruction ldrex is a valid instruction for the ARM v6
> (2) The syntax for the instruction is also valid
> (3) The inline assembler uses for [newvalue] the register ip
> (instruction pointer). This can't work of course.
> This led me to the belief that somehow I could try to use a fixed
> register instead of letting the compiler
> assign a new one for me, but that didn't work. Still the instruction
> ldrex isn't recognized.
> (4) I tried to switch to the generic atomic instructions file
> qatomic_arm.h, but that did not work either
> because no assembler instruction woud be recognized.
>
> Conclusion:
>
> The inline assembler is broken.
>
>
> WORKAROUND:
> ------------
> (1) I learned ARM assembly enough to write the following assembler file:
>
> .globl q_atomic_swp
> q_atomic_swp:
> push {r7, lr}
> swpb r0,r2,[r3]
> pop {r7,pc}
>
> (2) I changed the file qatomic_arm.h:
>
> #if 0
> inline static char q_atomic_swp(volatile char *ptr, char newval)
> {
> register char ret;
> asm volatile("swpb %0,%2,[%3]"
> : "=&r"(ret), "=m" (*ptr)
> : "r"(newval), "r"(ptr)
> : "cc", "memory");
> return ret;
> }
> #else
> extern "C" char q_atomic_swp(char *ptr,char newval);
> #endif
>
>
> (3) I added the assembler file to the Xcode project, and my project
> linked and loaded.
>
> Total work time: a week.
>
>
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Qt-iphone-developer mailing list
> Qt-...@li...
> https://lists.sourceforge.net/lists/listinfo/qt-iphone-developer
|