From: Rob Landley <rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
To: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org,
buildroot-+q+6gMgSsvIBXFe83j6qeQ@public.gmane.org
Subject: Re: [musl] cortex-m support?
Date: Thu, 15 Dec 2016 12:34:00 -0600 [thread overview]
Message-ID: <7bfe2625-725d-d1bb-7177-f2d31ce09e9c@landley.net> (raw)
In-Reply-To: <20161208211116.GO1555-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
On 12/08/2016 03:11 PM, Rich Felker wrote:
> On Tue, Dec 06, 2016 at 11:52:29PM -0600, Rob Landley wrote:
>> Index: src/setjmp/arm/setjmp.S
>> ===================================================================
>> --- src/setjmp/arm/setjmp.S (revision 0)
>> +++ src/setjmp/arm/setjmp.S (revision 4920)
>> @@ -0,0 +1,45 @@
>> +.global __setjmp
>> +.global _setjmp
>> +.global setjmp
>> +.type __setjmp,%function
>> +.type _setjmp,%function
>> +.type setjmp,%function
>> +__setjmp:
>> +_setjmp:
>> +setjmp:
>> + mov ip,r0
>> +#if defined(__thumb__)
>> + stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp,lr}
>> + str sp, [ip], #4
>> +#else
>> + stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp,sp,lr}
>> +#endif
>
> My leaning is to just always use the version that works on thumb,
Presumaby there's a longjmp.S bit too because:
ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp,sp,lr}
Make sure you're aware of erratum 752419:
https://sourceware.org/ml/binutils/2011-05/msg00087.html
On a board with a lot of serial traffic, it takes about 3 minutes for
uClibc (yes, including the current -ng) to crash (by loading the link
register into the stack pointer and stomping code before the setjmp).
The emcraft guys fixed this in their cortex-m uClibc fork way back when
(http://www.emcraft.com/som/building-uclibc), and of _course_ never
bothered to send it upstream. (Or put it on github with their kernel and
uboot.) But the source is in their distro tarball, and their patch to
uClibc's __longjmp.S is basically:
--- uclibc-1.0.17/libc/sysdeps/linux/arm/__longjmp.S
+++ emcraft/libc/sysdeps/linux/arm/__longjmp.S
@@ -56,9 +60,15 @@
#if defined(__thumb2__)
/* Thumb-2 does not allow loading sp with ldm. */
ldmia ip!, {v1-v6, sl, fp}
+#if 0
ldr sp, [ip], #4
ldr lr, [ip], #4
#else
+ ldr sp, [ip, #0]
+ ldr lr, [ip, #4]
+ add ip, #8
+#endif
+#else
ldmia ip!, {v1-v6, sl, fp, sp, lr}
#endif
(Dunno why the "add ip, #8" because it's a scratch register and this is
the last use in the function, but maybe they just made it do exactly
what the #else case does?)
cc-ing buildroot because this is still broken in their november release.
Rob
next prev parent reply other threads:[~2016-12-15 18:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 5:52 Rob Landley
2016-12-07 15:29 ` Szabolcs Nagy
2016-12-07 15:35 ` Szabolcs Nagy
2016-12-08 0:55 ` Rob Landley
2016-12-08 1:16 ` Rich Felker
2016-12-08 19:10 ` Rob Landley
2016-12-08 21:01 ` Rich Felker
2016-12-08 22:36 ` Rob Landley
2016-12-13 0:29 ` Rob Landley
2016-12-13 1:48 ` Rich Felker
2016-12-20 4:23 ` Rich Felker
2016-12-07 20:19 ` Rob Landley
2016-12-08 21:11 ` Rich Felker
2016-12-09 6:33 ` Rich Felker
[not found] ` <20161208211116.GO1555-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2016-12-15 18:34 ` Rob Landley [this message]
[not found] ` <7bfe2625-725d-d1bb-7177-f2d31ce09e9c-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
2016-12-15 18:51 ` [musl] " Waldemar Brodkorb
2016-12-20 7:18 ` [Buildroot] " Rob Landley
[not found] ` <48fb6c09-9dcb-e563-dc2d-f30062c5fceb-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
2016-12-20 8:26 ` Thomas Petazzoni
[not found] ` <20161220092600.2ca96088-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-12-20 18:17 ` Rob Landley
2016-12-21 6:18 ` [musl] " Waldemar Brodkorb
[not found] ` <20161221061853.GB2915-zdp6y753eiWHneL7xjqqhBsWhVFi+jh/@public.gmane.org>
2016-12-27 22:03 ` Rob Landley
2016-12-18 0:29 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7bfe2625-725d-d1bb-7177-f2d31ce09e9c@landley.net \
--to=rob-voji6fs/r0vr7s880joybq@public.gmane.org \
--cc=buildroot-+q+6gMgSsvIBXFe83j6qeQ@public.gmane.org \
--cc=musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).