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 18:37:24 +0000
From: Jon Chesterfield <>
Subject: Re: Views on bare metal port

Yep, that's the 5%! There's work on rounding modes happening in LLVM at
present, but it doesn't work yet and I can't justify working on it :(

There are a number of style warnings from clang related to operator
precedence (suggesting more parentheses) - would patches for these be worth


On 31 Jan 2018 18:26, "Szabolcs Nagy" <> wrote:

* Jon Chesterfield <> [2018-01-31 17:51:33
> Implementing the syscalls probably wouldn't be too much trouble, thanks
> 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.

note that in particular for math code llvm is problematic.

i'm not aware of any issues in musl libm currently, but
rounding mode changes can break in unexpected ways because
there is no support for -frounding-math (last time i checked
the few cases where it matters clang did not miscompile those,
but this is not actively tested)

an illustration of the kind of things that can go wrong:
we don't have equivalent hacks in musl.

> On 31 Jan 2018 15:25, "Rich Felker" <> 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,
> > 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
> > 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.