clang/llvm with glibc

This question has been asked occasionally with no positive responses.

Has anybody had success compiling glib with clang/llvm? If so, can you share any details?

If not, are there any good libc replacements with more complete functionality than newlib?

Thanks, dave

Roland says the main blocker for now is support for nested functions, he thinks the rest should be straightforward.

There was apparently a post to the glibc mailing list about this.

Here’s a clang bug I filed long ago for it that was closed wontfix:
http://llvm.org/bugs/show_bug.cgi?id=9206

It is (almost) possible to compile glibc using DragonEgg -- there
are only a handful of patches required (for LLVM and DragonEgg),
most of which are now up for review.

It builds, and most of glibc's test suite currently passes, except
for some tests that deal with floating point arithmetic, and some
tests which use very obscure GNU as features which I haven't seen
used outside the glibc test suite.

Hopefully within a month or so everything should be upstreamed, but
if you're itching for something that works now I can try to find some
time to send some WIP patches and instructions.

Thanks,

Thanks Peter,

I'll try that path and follow up with you for the patches when I get to that
point

Best, dave

It is (almost) possible to compile glibc using DragonEgg -- there
are only a handful of patches required (for LLVM and DragonEgg),
most of which are now up for review.

It builds, and most of glibc's test suite currently passes, except
for some tests that deal with floating point arithmetic, and some
tests which use very obscure GNU as features which I haven't seen
used outside the glibc test suite.

Hopefully within a month or so everything should be upstreamed, but
if you're itching for something that works now I can try to find some
time to send some WIP patches and instructions.

This is amazing!

What are you guys doing about -fno-toplevel-reorder?

Cheers,
Rafael

I haven't done anything about this flag, to be honest. From looking
at glibc's git HEAD it seems to currently be only used by two files
-- siglist.c and errlist.c -- and maybe I'm missing something but I
can't see any reason why either of these files now need it (in the
past these files seem to have contained some assembly but now
only contain straight C declarations). It also seems to have been used
in the past by initfini.c but that file is now gone from glibc git.

Thanks,

What are you guys doing about -fno-toplevel-reorder?

I haven't done anything about this flag, to be honest. From looking
at glibc's git HEAD it seems to currently be only used by two files
-- siglist.c and errlist.c -- and maybe I'm missing something but I
can't see any reason why either of these files now need it (in the
past these files seem to have contained some assembly but now
only contain straight C declarations). It also seems to have been used
in the past by initfini.c but that file is now gone from glibc git.

I went looking in glibc's git and found
3add8e1353d62d77fdd9b4ca363cdfe7006b0efb adding support for crti and
crtn written is assembly, which eventually replaced the old initfini.c
hack.

Congratulations to all those involved, this a much better state than I
would have dreamed possible some years ago.

Cheers,
Rafael