fix up ARM assembly to use 'bx lr' in place of 'mov pc, lr'.
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.
Signature · 95 lines
maks ----- Forwarded message from Steve Langasek <[email protected]> ----- Date: Wed, 16 Feb 2011 22:05:42 -0000 From: Steve Langasek <[email protected]> Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pc I've also touched it up to be mergeable with Debian (support v4t builds with #ifdef). Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree. Fixes: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/527720 --- klibc-1.5.20.orig/usr/klibc/arch/arm/vfork.S +++ klibc-1.5.20/usr/klibc/arch/arm/vfork.S @@ -25,7 +25,11 @@ vfork: ldrcs r3, 1f mvncs r0, #0 strcs r2, [r3] +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .balign 4 1: @@ -49,7 +53,11 @@ vfork: str r2, [r1] neg r0, r0 1: +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .balign 4 2: --- klibc-1.5.20.orig/usr/klibc/arch/arm/setjmp.S +++ klibc-1.5.20/usr/klibc/arch/arm/setjmp.S @@ -29,7 +29,11 @@ setjmp: stmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} mov r0, #0 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size setjmp,.-setjmp .text @@ -39,7 +43,11 @@ setjmp: longjmp: ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} mov r0, r1 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size longjmp,.-longjmp #else /* __thumb__ */ @@ -75,7 +83,11 @@ setjmp: mov r7, sp stmia r0!, {r3, r4, r5, r6, r7} mov r0, #0 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size setjmp,.-setjmp .text @@ -96,7 +108,11 @@ longjmp: mov r0, r1 bne 1f mov r0, #1 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) 1: mov pc, r3 +#else +1: bx r3 +#endif .size longjmp,.-longjmp #endif /* __thumb__ */
Quoted 29 lines · maximilian attems
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.Signature · 18 lines
maks ----- Forwarded message from Steve Langasek <[email protected]> ----- Date: Wed, 16 Feb 2011 22:05:42 -0000 From: Steve Langasek <[email protected]> Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pc I've also touched it up to be mergeable with Debian (support v4t builds with #ifdef). Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree. Fixes: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/527720
usr/klibc/arch/arm/vfork.S vfork: · line 28
Quoted 4 lines
usr/klibc/arch/arm/vfork.S +1
-0@@ -25,7 +25,11 @@ vfork: ldrcs r3, 1f mvncs r0, #0 strcs r2, [r3] +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
Quoted 74 lines
usr/klibc/arch/arm/vfork.S +7
-0mov pc, lr +#else + bx lr +#endif .balign 4 1:@@ -49,7 +53,11 @@ vfork: str r2, [r1] neg r0, r0 1: +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .balign 4 2:usr/klibc/arch/arm/setjmp.S +16
-0@@ -29,7 +29,11 @@ setjmp: stmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} mov r0, #0 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size setjmp,.-setjmp .text@@ -39,7 +43,11 @@ setjmp: longjmp: ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} mov r0, r1 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size longjmp,.-longjmp #else /* __thumb__ */@@ -75,7 +83,11 @@ setjmp: mov r7, sp stmia r0!, {r3, r4, r5, r6, r7} mov r0, #0 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) mov pc, lr +#else + bx lr +#endif .size setjmp,.-setjmp .text@@ -96,7 +108,11 @@ longjmp: mov r0, r1 bne 1f mov r0, #1 +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) 1: mov pc, r3 +#else +1: bx r3 +#endif .size longjmp,.-longjmp #endif /* __thumb__ */_______________________________________________
klibc mailing list
klibc at zytor.com
http://www.zytor.com/mailman/listinfo/klibc
Signature · 1 line
Kirill A. Shutemov
Thanks for forwarding this on, maks.
Quoted 13 lines · Kirill A. Shutemov
Quoted 12 lines
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 9 lines
usr/klibc/arch/arm/vfork.S vfork: · line 28
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +1
-0@@ -25,7 +25,11 @@ vfork: ldrcs r3, 1f mvncs r0, #0 strcs r2, [r3] +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
I see from
https://wiki.ubuntu.com/ARM/Thumb2PortingHowto#Identifying%20the%20Target%20Architecture
that you are correct - but then in
https://wiki.ubuntu.com/ARM/Thumb2PortingHowto#Detailed%20Instruction%20Behaviour
the recommendation given is to use exactly this guard for backwards compatibility.
I'm cc:ing Dave Martin from ARM who drafted this porting guide. Dave, was there some other reason besides instruction compatibility to prefer the original "mov pc,lr" on armv4t, or is this simply a miscopy?
Quoted 4 lines
usr/klibc/arch/arm/vfork.S vfork: · line 32
Quoted 4 lines
usr/klibc/arch/arm/vfork.S +3
-0mov pc, lr +#else + bx lr +#endif
Thanks,
Signature · 11 lines
Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ slangasek at ubuntu.com vorlon at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 828 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110216/ff3d096d/attachment.sig>
Quoted 27 lines · Kirill A. Shutemov
Quoted 26 lines · maximilian attems
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.--
maks----- Forwarded message from Steve Langasek <[email protected]> -----
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 9 lines
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +0
-0@@ -25,7 +25,11 @@ vfork:? ? ? ? ?ldrcs ? ? ? ?r3, 1f
? ? ? ? ?mvncs ? ? ? ?r0, #0
? ? ? ? ?strcs ? ? ? ?r2, [r3]
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
Does ARMv4t support BX lr ?
Quoted 84 lines
Quoted 69 lines
? ? ? mov ? ? pc, lr
usr/klibc/arch/arm/vfork.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .balign 4
?1:usr/klibc/arch/arm/vfork.S +0
-0@@ -49,7 +53,11 @@ vfork:? ? ? str ? ? r2, [r1]
? ? ? neg ? ? r0, r0
?1:
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/vfork.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .balign 4
?2:usr/klibc/arch/arm/setjmp.S +0
-0@@ -29,7 +29,11 @@?setjmp:
? ? ? stmia ? r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} ? ? ? mov ? ? r0, #0
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size setjmp,.-setjmp
? ? ? .text
usr/klibc/arch/arm/setjmp.S +0
-0@@ -39,7 +43,11 @@ setjmp:?longjmp:
? ? ? ldmia ? r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} ? ? ? mov ? ? r0, r1
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size longjmp,.-longjmp
?#else /*
__thumb__*/usr/klibc/arch/arm/setjmp.S +0
-0@@ -75,7 +83,11 @@ setjmp:? ? ? mov ? ? r7, sp
? ? ? stmia ? r0!, {r3, r4, r5, r6, r7}
? ? ? mov ? ? r0, #0
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size setjmp,.-setjmp
? ? ? .text
usr/klibc/arch/arm/setjmp.S +0
-0@@ -96,7 +108,11 @@ longjmp:? ? ? mov ? ? r0, r1
? ? ? bne ? ? 1f
? ? ? mov ? ? r0, #1
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ?1: ? mov ? ? pc, r3usr/klibc/arch/arm/setjmp.S +3
-0+#else +1: ? bx ? ? ?r3 +#endif? ? ? .size longjmp,.-longjmp
Quoted 6 lines
?#endif /*
__thumb__*/_______________________________________________
klibc mailing list
klibc at zytor.com
http://www.zytor.com/mailman/listinfo/klibc--
?Kirill A. Shutemov_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 26 lines · Steve Langasek
Thanks for forwarding this on, maks.
Quoted 13 lines · Kirill A. Shutemov
Quoted 12 lines
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 9 lines
usr/klibc/arch/arm/vfork.S vfork: · line 28
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +1
-0@@ -25,7 +25,11 @@ vfork: ldrcs r3, 1f mvncs r0, #0 strcs r2, [r3] +#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
Quoted 6 lines
I see from
https://wiki.ubuntu.com/ARM/Thumb2PortingHowto#Identifying%20the%20Target%20Architecture
that you are correct - but then in
https://wiki.ubuntu.com/ARM/Thumb2PortingHowto#Detailed%20Instruction%20Behaviour
the recommendation given is to use exactly this guard for backwards compatibility.
glibc-ports:
sysdeps/arm/sysdep.h:
#if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
&& !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__))
# define __USE_BX__
#endifsysdeps/arm/dl-machine.h:
#if defined(__USE_BX__)
#define BX(x) "bx\t" #x
#else
#define BX(x) "mov\tpc, " #x
#endif
Quoted 16 lines
I'm cc:ing Dave Martin from ARM who drafted this porting guide. Dave, was there some other reason besides instruction compatibility to prefer the original "mov pc,lr" on armv4t, or is this simply a miscopy?
Quoted 4 lines
usr/klibc/arch/arm/vfork.S vfork: · line 32
Quoted 4 lines
usr/klibc/arch/arm/vfork.S +3
-0mov pc, lr +#else + bx lr +#endifThanks,
Signature · 4 lines
Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ slangasek at ubuntu.com vorlon at debian.org
Signature · 1 line
Kirill A. Shutemov
Quoted 39 lines · Khem Raj
Quoted 27 lines · Kirill A. Shutemov
Quoted 26 lines · maximilian attems
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.--
maks----- Forwarded message from Steve Langasek <[email protected]> -----
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 9 lines
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +0
-0@@ -25,7 +25,11 @@ vfork:? ? ? ? ?ldrcs ? ? ? ?r3, 1f
? ? ? ? ?mvncs ? ? ? ?r0, #0
? ? ? ? ?strcs ? ? ? ?r2, [r3]
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
Quoted 1 line
Does ARMv4t support BX lr ?
Sure.
See http://wiki.debian.org/ArmEabiPort
Signature · 1 line
Kirill A. Shutemov
Quoted 39 lines · Khem Raj
Quoted 27 lines · Kirill A. Shutemov
Quoted 26 lines · maximilian attems
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.--
maks----- Forwarded message from Steve Langasek <[email protected]> -----
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 9 lines
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +0
-0@@ -25,7 +25,11 @@ vfork:? ? ? ? ?ldrcs ? ? ? ?r3, 1f
? ? ? ? ?mvncs ? ? ? ?r0, #0
? ? ? ? ?strcs ? ? ? ?r2, [r3]
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
Quoted 1 line
Does ARMv4t support BX lr ?
hmm yes it does. I confused it with blx <Rm> which is unpredictable in thumb mode on architectures < armv5t
Quoted 87 lines
Quoted 86 lines
Quoted 71 lines
? ? ? mov ? ? pc, lr
usr/klibc/arch/arm/vfork.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .balign 4
?1:usr/klibc/arch/arm/vfork.S +0
-0@@ -49,7 +53,11 @@ vfork:? ? ? str ? ? r2, [r1]
? ? ? neg ? ? r0, r0
?1:
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/vfork.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .balign 4
?2:usr/klibc/arch/arm/setjmp.S +0
-0@@ -29,7 +29,11 @@?setjmp:
? ? ? stmia ? r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} ? ? ? mov ? ? r0, #0
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size setjmp,.-setjmp
? ? ? .text
usr/klibc/arch/arm/setjmp.S +0
-0@@ -39,7 +43,11 @@ setjmp:?longjmp:
? ? ? ldmia ? r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} ? ? ? mov ? ? r0, r1
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size longjmp,.-longjmp
?#else /*
__thumb__*/usr/klibc/arch/arm/setjmp.S +0
-0@@ -75,7 +83,11 @@ setjmp:? ? ? mov ? ? r7, sp
? ? ? stmia ? r0!, {r3, r4, r5, r6, r7}
? ? ? mov ? ? r0, #0
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ? ? ? mov ? ? pc, lrusr/klibc/arch/arm/setjmp.S +3
-0+#else + ? ? bx ? ? ?lr +#endif? ? ? .size setjmp,.-setjmp
? ? ? .text
usr/klibc/arch/arm/setjmp.S +0
-0@@ -96,7 +108,11 @@ longjmp:? ? ? mov ? ? r0, r1
? ? ? bne ? ? 1f
? ? ? mov ? ? r0, #1
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) ?1: ? mov ? ? pc, r3usr/klibc/arch/arm/setjmp.S +3
-0+#else +1: ? bx ? ? ?r3 +#endif? ? ? .size longjmp,.-longjmp
Quoted 6 lines
?#endif /*
__thumb__*/_______________________________________________
klibc mailing list
klibc at zytor.com
http://www.zytor.com/mailman/listinfo/klibc--
?Kirill A. Shutemov_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 27 lines · Kirill A. Shutemov
Quoted 26 lines · maximilian attems
hello vorlon,
got notified of your patch,
will apply next days upstream unless some critiques are voiced on ml. thanks.--
maks----- Forwarded message from Steve Langasek <[email protected]> -----
Date: Wed, 16 Feb 2011 22:05:42 -0000
From: Steve Langasek <[email protected]>
Subject: [Bug 527720] Re: thumb2 porting issues identified: klibc uses mov.*pcI've also touched it up to be mergeable with Debian (support v4t builds with #ifdef).
Confirmed that installing the resulting klibc packages on my beagleboard gives me a successfully-booting initramfs with klibc; and the vfork/setjmptest test cases all pass in the klibc package tree.
Quoted 10 lines
Quoted 7 lines
usr/klibc/arch/arm/vfork.S +0
-0@@ -25,7 +25,11 @@ vfork:? ? ? ? ?ldrcs ? ? ? ?r3, 1f
? ? ? ? ?mvncs ? ? ? ?r0, #0
? ? ? ? ?strcs ? ? ? ?r2, [r3]
+#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)NAK. ARMv4T supports bx intruction. ARMv4 doesn't.
You're strictly correct. My original rationale was to ensure there is no disruption for people building for v4/v4T -- since the more restricted functionality of Thumb-1 means people tend not to use it to build the whole distro anyway.
If people using <v5 are prepared to accept the change, I've got no problem with changing the #ifs to #ifdef __ARM_ARCH_4__
We can't get rid of the #ifdef though, unless we can persuade everyone targeting v4 to build with gcc/as -march=armv4t + ld --fix-v4bx (unlikely).
Cheers
---Dave