|
Message-ID: <CAOUYtQBPn7u-08C+RSaaGtt=eRSaOnqxBAmEm6RXMhR8qrshuw@mail.gmail.com>
Date: Wed, 31 Jan 2018 17:51:33 +0000
From: Jon Chesterfield <jonathanchesterfield@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Views on bare metal port
Thank you for your reply.
Implementing the syscalls probably wouldn't be too much trouble, thanks for
the advice.
I've been able to build 95% of math on our toolchain in the last hour.
Impressed by how straightforward that was. Nice codebase.
Cheers,
Jon
On 31 Jan 2018 15:25, "Rich Felker" <dalias@...c.org> wrote:
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
Content of type "text/html" skipped
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.