mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Views on bare metal port
Date: Wed, 31 Jan 2018 10:25:07 -0500	[thread overview]
Message-ID: <20180131152507.GO1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAOUYtQDkm-0gvMo+JnyV9KFRUq+g3vyuKBzO-32UiHMP+wyCfw@mail.gmail.com>

On Wed, Jan 31, 2018 at 01:38:44PM +0000, Jon Chesterfield wrote:
> Hello musl,
> 
> I'm writing an llvm back end for a custom asic. There's no kernel, limited
> syscall support. As far as I can tell from the source tree, musl expects a
> host OS. I'm aware of a couple of projects running musl by emulating the
> Linux syscall interface.
> 
> I would like to derive libc from a subset of musl. Math.h included,
> filesystem excluded. Malloc and threads tdb.
> 
> Are there any bare metal projects that use musl without syscall emulation?
> If not, would one be of interest to this mailing list?

I'm not aware of any specific ones to recommend (maybe others can
suggest) but here are a couple general guidelines:

1. The easiest and probably-recommended way to do this is just writing
   a trap handler to implement the syscalls you need and using musl
   unmodified. You've said you don't want to do that, though, so
   moving on...

2. The other intended/recommended way is making new arch dirs with a
   syscall_impl.h that implements the syscall.h backend stuff as calls
   to your own functions. The SYS_* macros can actually be defined as
   function pointers if you like, or you can still use numbers and a
   switch-based dispatch table. Either way the vast majority of
   syscall points have constant expressions for the syscall number so
   it should all collapse/inline fine to a single direct call.

3. While you can trim down parts of the tree you don't need, there's
   usually no compelling reason to do so. Static linking (only option
   for bare metal anyway) will not link things you don't use.

Hope this helps a bit.

Rich


  reply	other threads:[~2018-01-31 15:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOUYtQBwKmfwjmxUy+mfd0Qg+n78rCwKtK2=X6xgK-Cmt6EGXQ@mail.gmail.com>
     [not found] ` <CAOUYtQB4+8Yey+Q2yT3GWqTiobgPNf60G6dZHjUyjbj1SUC0TA@mail.gmail.com>
     [not found]   ` <CAOUYtQD1LF03fbZ3U4e=s3uXiiY46jkuTjvzdfnz=c3mvzCrhw@mail.gmail.com>
     [not found]     ` <CAOUYtQAZ-90b39f0Okz+KsnYK9G1FwdpTGtMSwJsWtsPwEWM-Q@mail.gmail.com>
     [not found]       ` <CAOUYtQCNCU4rN74+HHmBTfgLTEdAhypWSL1L=Ooc1ocqjpEW_Q@mail.gmail.com>
     [not found]         ` <CAOUYtQCCwhp-RSmod+dzLrFzqrR_Om-p6dD5kEkNtMT2B48FjQ@mail.gmail.com>
     [not found]           ` <CAOUYtQDM4BW=WEXD5RK2YWf+3zj+opBuK8vsPwEPfyM3Hyo_6w@mail.gmail.com>
     [not found]             ` <CAOUYtQCsJU_qczmjpH8NHbgqSHVLEAYOdpHVu7nmkie3zWAAyw@mail.gmail.com>
     [not found]               ` <CAOUYtQDc8VHkH13Ah_+azk+goeOsthjFOhE4KfV6PCMoMKfukA@mail.gmail.com>
     [not found]                 ` <CAOUYtQCJD1Y-xV2bbBiGxE-W8jSWA9Qm=bzn1ri5Lq9+ACKSLw@mail.gmail.com>
     [not found]                   ` <CAOUYtQA3i8-z+LtzDbsUTJmLn76UXvDUpbKVHNfECSCMrPdiKA@mail.gmail.com>
     [not found]                     ` <CAOUYtQBDV0_0hkjtT3A+uOqnDkuKD-ZDr_DLo=DVSO5B6YZ3AA@mail.gmail.com>
     [not found]                       ` <CAOUYtQCHi6qR+=Jae--6M1VzeSiDBjj9_86hkpmN=XhSFDTTiQ@mail.gmail.com>
2018-01-31 13:38                         ` Jon Chesterfield
2018-01-31 15:25                           ` Rich Felker [this message]
2018-01-31 17:51                             ` Jon Chesterfield
2018-01-31 18:25                               ` Szabolcs Nagy
2018-01-31 18:37                                 ` Jon Chesterfield
2018-01-31 19:11                                   ` Rich Felker
2018-04-01 11:19                                 ` ardi
2018-04-01 14:29                                   ` Szabolcs Nagy
2018-04-01 20:12                                     ` ardi
2018-02-17 22:37                           ` ardi

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=20180131152507.GO1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /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).