From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10803 Path: news.gmane.org!.POSTED!not-for-mail From: Rob Landley Newsgroups: gmane.comp.lib.uclibc.buildroot,gmane.linux.lib.musl.general Subject: Re: [musl] cortex-m support? Date: Thu, 15 Dec 2016 12:34:00 -0600 Message-ID: <7bfe2625-725d-d1bb-7177-f2d31ce09e9c@landley.net> References: <04e5a294-719e-8029-704f-a57d1ec935b0@landley.net> <20161208211116.GO1555@brightrain.aerifal.cx> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1481826857 28302 195.159.176.226 (15 Dec 2016 18:34:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Dec 2016 18:34:17 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 To: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org, buildroot-+q+6gMgSsvIBXFe83j6qeQ@public.gmane.org Original-X-From: buildroot-bounces-9GAsQqxh4YTR7s880joybQ@public.gmane.org Thu Dec 15 19:34:13 2016 Return-path: Envelope-to: gclub-buildroot@m.gmane.org Original-Received: from smtp1.osuosl.org ([140.211.166.138] helo=whitealder.osuosl.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHar5-0006Lq-0R for gclub-buildroot@m.gmane.org; Thu, 15 Dec 2016 19:34:11 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8B66D81D21; Thu, 15 Dec 2016 18:34:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Original-Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CzHbAiJbnaGe; Thu, 15 Dec 2016 18:34:12 +0000 (UTC) Original-Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 211C4816F2; Thu, 15 Dec 2016 18:34:12 +0000 (UTC) Original-Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 666F21C0674 for ; Thu, 15 Dec 2016 18:34:03 +0000 (UTC) Original-Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BA56181C24 for ; Thu, 15 Dec 2016 18:34:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Original-Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yl9wl2uq8usM for ; Thu, 15 Dec 2016 18:34:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Original-Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id B41F7811C8 for ; Thu, 15 Dec 2016 18:34:02 +0000 (UTC) Original-Received: by mail-pg0-f66.google.com with SMTP id x23so6949003pgx.3 for ; Thu, 15 Dec 2016 10:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=8e4KYSz3HK35yFwYRww8aTuf63aCDdf2Gy9lccb1f5o=; b=aMhQNK/SRjcveB/stIXQq6Es65ZlN2rQPMC1iqM7SAb2PSkOi/e7r3x8glru14KsrM 8JBz0UjPu8UpjVPZHFY4MHn6nftAYiLzu4oB0a9V2j7ovXPYIfJPbZp5bUOQlbO4biOw slet01S9YJAD+d6aGADsh7af2v0EXmto0TJTFsAzolxYSSr58T5KozZY/9Da3LaKcvW0 Po0bsyt/vL4kHwcF+uDPAzr2TxQJBmKYLgMfp6N85tqfx2GIpW/T1DQC8SlK9MQpEosv qmv/1BzVuSXHaoJo8iFjCQMrZEHSC0W2j1tJE5jHxThoES0DyofaP6Us6s/0ZjkBIGE5 M1tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=8e4KYSz3HK35yFwYRww8aTuf63aCDdf2Gy9lccb1f5o=; b=QjGQ7daGE+o9kUofpR8QWhja98Coon71H12DJ01AMOLyN6A5NWcdzd+r6E+iytM0Kq oQgwBAAB0EWZ/2Dpm1Mw5hKB0wgkFYMM8JvWDIMmdpvZKJxpJksAMgvPPOar+yklV1C2 Zb+IiE4URVsV82ilf34jdKruFOx1eG2AbG3sVfPCQ7HIFO8YcH01c7HBwAR5EUzlP4gZ 9tcSQcx1Ryr6cFHT2eJy3Yu8JIjdYJILn6rEoEVMXN4iwgtzvJNZSRjgGF1QUzb06Er8 gukF/TYm0re/hbrNh3Ow6RxQweVcEUHuUzwDOvBEwqYr3HSIiUM5dynHLnVatHdEKPpW 8Tvw== X-Gm-Message-State: AKaTC02MFagrhsVhyhfvZKyRt/ImTXqREMkLIHp23onVUjvYzB6+A4rH4bKe+gvHS7jWHg== X-Received: by 10.84.214.15 with SMTP id h15mr5206340pli.135.1481826842327; Thu, 15 Dec 2016 10:34:02 -0800 (PST) Original-Received: from [192.168.16.169] ([216.253.203.25]) by smtp.googlemail.com with ESMTPSA id s8sm6189351pfj.45.2016.12.15.10.34.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2016 10:34:01 -0800 (PST) In-Reply-To: <20161208211116.GO1555-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org> X-BeenThere: buildroot-9GAsQqxh4YTR7s880joybQ@public.gmane.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces-9GAsQqxh4YTR7s880joybQ@public.gmane.org Original-Sender: "buildroot" Xref: news.gmane.org gmane.comp.lib.uclibc.buildroot:167197 gmane.linux.lib.musl.general:10803 Archived-At: 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