[LLVMdev] Compiling glibc on Linux

Reid Spencer rspencer at reidspencer.com
Wed May 9 13:57:50 PDT 2007


On Wed, 2007-05-09 at 13:38 -0700, Babak Salamat wrote:
> I am convinced to use llvm-gcc. As I mentioned in my previous email,  
> I have changed native code generation in llc to generate code with a  
> different stack organization. In order to have working binaries, the  
> libraries must be compiled with the new tool and have the same stack  
> organization. Now that I cannot use llc, it seems that I have to  
> modify llvm-gcc to have it generate code with the stack organization  
> that I want.

I think you're missing the point. llvm-gcc and llc link with *exactly*
the same set of libraries for code generation. If you've modified llc
then llvm-gcc (after rebuild) will produce the same results. 

If you've built your own target then you need to ensure that llvm-gcc
links that target in by modifying the llvm-gcc/gcc/Makefile.in file.

> 
> For X86 target I have particularly changed  
> X86RegisterInfo::eliminateFrameIndex, X86RegisterInfo::emitPrologue  
> and X86RegisterInfo::emitEpilogue in the llc source code.

To be clear, llc does not contain any of those functions. They are part
of the X86 target in lib/Target/X86. This is the same X86 target that is
linked into llvm-gcc when you build it. There should be zero difference
between your llvm-gcc output and your llc output.

> 
> Can I find equivalent functions in the llvm-gcc source, so that I can  
> implement the needed stack organization?

Yes you can .. its the same source!

> 
> Thank you,
> Babak

Hope this clears it up.

Reid.

> 
> 
> On May 9, 2007, at 12:47 PM, Reid Spencer wrote:
> 
> > Babak,
> >
> > I strongly suggest you drop trying to use llvmc.  Instead, probably  
> > just
> > compiling your library with llvm-gcc should be sufficient. The llvm- 
> > gcc
> > tool has much of llc's functionality built in to it so you're going to
> > get the same output.  If that doesn't work for you, then please  
> > describe
> > what you're trying to do in more detail and we'll tell you how it  
> > can be
> > done. Coming at it from the "llvmc doesn't work" angle, doesn't  
> > help us
> > solve your actual problem (because we don't know what it is).
> >
> > Thanks,
> >
> > Reid.
> >
> > On Wed, 2007-05-09 at 00:08 -0700, Babak Salamat wrote:
> >> Thank you Chris.
> >>
> >> Actually, I have changed the stack organization in the "llc" source
> >> codes for x86 target. Thus, I need libraries compiled with the new
> >> stack organization. If I use llvm-gcc (and apparently also llvmc),
> >> llc will not be invoked. I was hoping that llvmc would call llvm-gcc
> >> to compile to bc file and then call llc to compile to native
> >> assembly, but apparently this doesn't happen.
> >> Do you know of any possible ways to involve llc in compilation of
> >> libraries?
> >>
> >> --Babak
> >>
> >> On May 8, 2007, at 11:33 PM, Chris Lattner wrote:
> >>
> >>> On Tue, 8 May 2007, Babak Salamat wrote:
> >>>> Yes, I have built and installed llvm-gcc and "llvm-gcc --print- 
> >>>> prog-
> >>>> name=cc1" return the correct path for cc1, so I assume its path is
> >>>> set correctly in the config files, but I haven't installed config
> >>>> files separately. Do I need to do that? Is there any documentation
> >>>> about it?
> >>>
> >>> I'd strongly suggest just building with CC=llvm-gcc CXX=llvm-g++.
> >>>
> >>> llvmc is extremely experimental and has not seen wide use.
> >>>
> >>> -Chris
> >>>
> >>>> On May 8, 2007, at 7:33 PM, Reid Spencer wrote:
> >>>>
> >>>>> Babak,
> >>>>>
> >>>>> As its manual page (http://llvm.org/docs/CommandGuide/html/
> >>>>> llvmc.html)
> >>>>> states, llvmc is an experimental tool:
> >>>>>
> >>>>> llvmc is considered an experimental LLVM tool because it has these
> >>>>> deficiencies:
> >>>>>
> >>>>> Poor configuration support
> >>>>>         The support for configuring new languages, etc. is weak.
> >>>>> There
> >>>>>         are many command line configurations that cannot be  
> >>>>> achieved
> >>>>>         with the current support. Furthermore the grammar is
> >>>>> cumbersome
> >>>>>         for configuration files. Please see http://llvm.org/PR686
> >>>>> for
> >>>>>         further details.
> >>>>>
> >>>>> That said, you should be able to get it to work with llvm-gcc.
> >>>>>
> >>>>> Did you build llvm-gcc? Did you check the paths in the "c" config
> >>>>> file?
> >>>>> Did you install the config files?
> >>>>>
> >>>>> All of these things need to be done in order for the standard  
> >>>>> config
> >>>>> file to work.
> >>>>>
> >>>>> Reid.
> >>>>>
> >>>>> On Tue, 2007-05-08 at 18:40 -0700, Babak Salamat wrote:
> >>>>>>   Hi,
> >>>>>>
> >>>>>> I am trying to compile glibc on Linux using llvm. I need to do  
> >>>>>> this
> >>>>>> for a research project.
> >>>>>> The problem is that llvmc doesn't work, and I guess I have to set
> >>>>>> CC=llvmc to get the glic compiled. For some reason llvmc  
> >>>>>> complains
> >>>>>> that it cannot find %llvmcc1%. I have this problem both on my
> >>>>>> Mac and
> >>>>>> my Linux system. Other tools that I have tested including llvm- 
> >>>>>> gcc
> >>>>>> work without any problem.
> >>>>>> First, I appreciate it if you let me know what can cause this
> >>>>>> problem
> >>>>>> and second, tell me if you think I have any chance to compile  
> >>>>>> glibc
> >>>>>> using LLVM.
> >>>>>>
> >>>>>> Thank you,
> >>>>>> Babak
> >>>>>>
> >>>>>> ---------------------------------------------------------------
> >>>>>> Babak Salamat
> >>>>>> PhD Student
> >>>>>> Department of Computer Science
> >>>>>> School of Information and Computer Sciences
> >>>>>> University of California, Irvine
> >>>>>> email: bsalamat at uci.edu
> >>>>>> web: www.ics.uci.edu/~bsalamat
> >>>>>> ---------------------------------------------------------------
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> LLVM Developers mailing list
> >>>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>>>>
> >>>>> _______________________________________________
> >>>>> LLVM Developers mailing list
> >>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>>>
> >>>> _______________________________________________
> >>>> LLVM Developers mailing list
> >>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>>>
> >>>
> >>> -Chris
> >>>
> >>> -- 
> >>> http://nondot.org/sabre/
> >>> http://llvm.org/
> >>> _______________________________________________
> >>> LLVM Developers mailing list
> >>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list