Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 May 2016 23:05:01 -0700
From: Gry Gunvor <>
Subject: porting musl to RISCV-64

I am interested in compiling for RISCV-64 ( using a
libc that I compile myself so that I can run it through some
source-to-source transformations before compiling it.  The default
RISCV tools will target their ports of either gnu libc or newlib.  Gnu
libc is huge, so I would rather avoid it; also I would rather use
something released under a permissive open source license (BSD).
Newlib is small, but I am not interested in multithreading and the
multithreading/reentrancy support they have built into the library is
causing me problems.  So I thought I would try musl.

I'm running on a vanilla Ubuntu 14.04 x86 machine and muscl builds out
of the box.  Using your gcc wrapper, hello world links and runs.  I
tried wrapping malloc at link time and that worked.  Thus, so far,
muscl is working great.

FYI: You might want to know that this recent post on the subject of
teaching C speaks of musl as "high-quality":
"We’ll want some lecture material about C’s place in the modern world
and we also need to spend time reading some high-quality C code,
perhaps starting with Redis, Musl, or Xv6. Musl, in particular, is a
good match for teaching since it contains lots of cute little
functions that can be understood in isolation."

Anyway, suppose I want to port musl to RISCV-64 and cross-compile it.
MIPS is a RISC architecture that is rather close to RISCV, but your
MIPS support says 32-bit (and big-endian), so I take it you have some
dependencies on what used to be called the "machine word size" (RISCV
is 64-bit, but the RISCV docs still call a 32-bit unit a "word"; ugh;
so now we need a new word for "word").  Thus I suspect that this is
going to be non-trival.  How much work is this going to be?  Hints?

More generally, any comments on what do you recommend as the easiest
thing to do?  Port musl to RISCV-64?  Use a different libc?  For those
of you who know newlib, hack newlib to remove reentrancy goop?


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.