Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 31 Jan 2018 10:25:07 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Views on bare metal port

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.