[LLVMdev] Customize Standard C Library Using LLVM (to support llvm backend optimization)

David Blaikie dblaikie at gmail.com
Wed Mar 11 09:55:55 PDT 2015

On Wed, Mar 11, 2015 at 9:13 AM, Chao Yan <yanchao2012 at gmail.com> wrote:

> Purpose:
> I implemented a pass on LLVM backend that changes the output format of
> *ARM* assembly/binary (e.g add a jump at the end of each basic block to
> eliminate fall through). By calling:
> llc -march=arm somefile.bc
> it generates expected arm assembly/binary that runs properly on arm gnu
> linux (I use qemu-arm and gem5 to simulate it). Now I want to do the same
> thing on standard c library, but here are problems.
> Problems:
> According to:
> http://article.gmane.org/gmane.comp.compilers.llvm.devel/77025 https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_14/docs/OpenProjects.html#glibc
> compiling glibc using llvm may not be a proper option.
Not an option /yet/, but it's a work in progress, by the sounds of it.
Kostya's been working on it recently & it sounds like there's one or two
things in the source code to tackle, then some build issues?

> On the other hand, according to:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/047088.html
> llvm could be able to compile newlib, thus people consider newlib as an
> alternative. However, according to:
> http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.html#id2711887
> newlib intends to support binaries for bare metal (no OS) software. It
> implements only the hardware independent parts (e.g libc and libm) and
> leave a stub for each hardware dependent syscall (e.g everything in
> libgloss).
> In fact I tried to compile a simple "hello world" c program using
> arm-none-eabi-gcc which was configured with "--with-newlib" option, the
> program execution ends up with segmentation faults on both qemu-arm and
> gem5.
> Questions:
> I'm not sure if the newlib is compatible with glibc. I'm wondering if I
> could use llvm to cross-compile the machine independent parts (at the same
> time change the arm output format) from newlib and use
> arm-none-linux-gnueabi-gcc to cross-compile the machine dependent parts
> from glibc and put these two parts together to generate my own standard c
> library?
> There might be mistakes/misunderstandings in my work. Are there any other
> possible methods that could add my changes to at least part of the standard
> c libraries, and make the program run on qemu-arm or gem5?
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150311/9631317e/attachment.html>

More information about the llvm-dev mailing list