[Barrelfish-users] New version of glibc?

Kornilios Kourtis kornilios.kourtis at inf.ethz.ch
Fri Oct 19 11:39:47 CEST 2012

Hi Robert,

On Thu, Oct 18, 2012 at 06:06:09PM +0200, Robert Radkiewicz wrote:
> Hi,
> I am working on porting Barrelfish on the TilePro64 architecture and 


> have a problem now with the libc.
> Tilera has an own distribution of the glibc, containing the
> tilera-specific header files. These files are also included in the
> latest release (2.16) of the official glibc distribution from gnu.org.
> Additionally they have an own distribution of the newlib.
> Initially I wasn't able to just use one of the distributions, because 
> some redefinitions happened, so I copied some of the newlib files (the 
> ones with the right #ifdefs) into the barrelfish release, but no I have 
> some subtile bugs, occuring through mixed version. I now found out the 
> newlib release from Tilera seems to base on a version of 2004, so some 
> of the inner interface are changed.
> So I am back on trying to use a whole release including the Tilera 
> files. Since the newlib files are old, I think using the glibc is the 
> better option here. Can someone give me some directions, what the steps 
> to include a new version of glibc are or describe the way you used to 
> start with them initially?

As you might already know, we 've recently switched to using newlib as
our default libc (this was based on work done by Zeus Gómez Marmolejo).
Currently, the tree contains the old C library (oldc) as well. This will
make your porting effort easier, since libc is now separated from the
rest of the system. 

Here are a couple of things to get you started:

 - You will need to incorporate your library to the barrelfish building
   system (hake). This means to two things: a) building your libc using
   hake, and b) building barrelfish programs using your libc.
   The latter is probably the easy part: See Config.libc/Config.libcInc
   variables in hake/Config.hs[1]. Library "/lib/lib" ++ Config.libc ++
   ".a" is linked to all applications. [2]

   For the former part, you will need to use hake for building your libc.
   You might be able to avoid that part and build it externally, but I'm
   not sure if this is the better option in the long term. Good starting
   points are oldc's and newlib's Hakefiles.
- You will need to implement the necessary OS glue that is needed by
  libc. For the most part, this glue deals with file access (stdio) and
  memory management (malloc and friends). Barrelfish is not a Unix OS,
  so this presents some challenges.  An approach would be to have libc
  build on top of posixcompat layer, which provides (at some degree) what
  a C library would expect from a Unix OS. The problem with this is that
  it requires all barrelfish programs be linked to posixcompat and
  friends, since all programs use libc. Since we didn't like that, the
  libcs included in our tree do not dependent to posixcompat, and they
  contain a glue layer to allow things like file access, only if the
  appropriate libraries are linked in. The code for newlib glue exists in
  the lib/newlib/newlib/libc/sys/barrelfish directory.
[1] A barrelfish build is configured using hake/Config.hs in the build
directory which is created based on hake/Config.hs.template in the source

[2] This happens in hake/ArchDefaults.hs

Kornilios Kourtis

More information about the Barrelfish-users mailing list