[LLVMdev] porting glibc

Misha Brukman brukman at uiuc.edu
Sat Mar 8 14:33:01 PST 2003


On Fri, Mar 07, 2003 at 10:08:23PM -0600, Francesco Spadini wrote:
> I noticed that the open projects lists porting glibc to LLVM.  I was
> wondering if anyone was working on this currently.  If no one is on
> it, does anyone have an idea of how nasty this would be to do? 

You'd just have to make glibc compile using llvm-gcc... :) It may need
some minor tweaks to be accepted as LLVM-valid code. It may show that
there are some bugs in llvm-gcc (if it cannot handle glibc due to an
internal error) or it might work, but it may not be necessarily verified
to be correct. So in response to your question, the nastiness is waiting
to be discovered.

To the best of my knowledge, this is not being done right now.

> I'd like to have LLVM output to a new ISA, it'd be great if all I had
> to do was proxy system calls like read and write in my architectural
> simulator.

Note that compiling glibc with LLVM does not give you a solution to THIS
problem: you'd still have to write a new backend for your ISA. There is
currently a Sparc backend and an X86 backend. Depending on how similar
your architecture is to one or the other, you might be able to leverage
existing code. Take a look at llvm/lib/Target/{Sparc,X86}, though the
X86 target codebase is smaller.

Also note that having glibc compiled by LLVM isn't a prerequisite for
your new ISA, as long as you either emulate the library calls or you
have it compiled in some other manner for your target architecture.

-- 
Misha Brukman :: http://uiuc.edu/~brukman



More information about the llvm-dev mailing list