Eli Friedman wrote:> This isn't first-hand, but from what I remember hearing on IRC, > putting llvm into shared libraries caused a ridiculous explosion in > dynamic linking (and therefore startup) times. So there is no option > to make shared libraries, at least at the moment.Well, by tweaking configure and make options, I've managed to build LLVM 2.2 shared libraries on Linux (x86), and they seemed to work fine. (I did have to work around a circular dependencies error, though.) This makes a *lot* of sense. E.g., my application is a functional language interpreter (http://pure-lang.sf.net) which has to be linked against most of LLVM, and it makes a whole lot of a difference to have those 8+MB of libraries being handled by the dynamic linker instead of including them all in a fat interpreter executable, for the same reason that you don't want each and every C/C++ application to link libc and the C++ library statically. Just imagine that you have 50 instances of the interpreter running simultaneously! Note that you can also work around this by just linking the static LLVM libs into a shared lib which in turn is linked against your application. That's what I actually do with my interpreter now, since the users shouldn't have to tweak the LLVM stuff just to build my interpreter. (Unfortunately, that approach doesn't work on x86-64 with LLVM 2.2, since some parts of the LLVM JIT apparently contain non-relocatable code; I hope that this will be fixed in the forthcoming LLVM 2.3.) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de WWW: http://www.musikinformatik.uni-mainz.de/ag
On Monday 09 June 2008, Albert Graef wrote:> Unfortunately, that approach doesn't work on x86-64 with LLVM 2.2, > since some parts of the LLVM JIT apparently contain non-relocatable > code; I hope that this will be fixed in the forthcoming LLVM 2.3.Unfortunately it's not fixed in 2.3 :( I made a patch ([1]) for 2.2 and gave it to one of the developer, I guess he forgot about it, unfortunately it doesn't apply on 2.3. Once I have the time (and a 64bits linux under the hand), I will make a patch for 2.3 and submit it to llvm's bug system (unless someone else want to do it before that ;) ) [1] http://www.opengtl.org/download/X86JITInfo.cpp.pic.patch -- Cyrille Berger
Cyrille Berger wrote:> Unfortunately it's not fixed in 2.3 :(That's indeed unfortunate. On x86-64 the Pure interpreter currently is a 7MB behemoth, and most of that is LLVM. ;-) On 32 bit I have all that stuff in a separate runtime library, resulting in a 27K interpreter executable. It goes without saying that this makes a world of a difference. I don't care if LLVM is a shared library itself, and I understand the reasons speaking against that, but it should at least be linkable into a dll.> [1] http://www.opengtl.org/download/X86JITInfo.cpp.pic.patchCool, many thanks! That's exactly what I've been looking for. :) If you do get around updating the patch for 2.3, it would be very kind if you could let me know. Thanks, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de WWW: http://www.musikinformatik.uni-mainz.de/ag
Hi Cyrille, concerning your patch,> [1] http://www.opengtl.org/download/X86JITInfo.cpp.pic.patchthere are two minor glitches: s/#ifdef/#if/, s/#end/#endif/. Otherwise it works great over here! Pure builds fine with a shared runtime lib on 64 bit now, so I'm a happy camper. :) I would like to make this patch available on the Pure website, ok with you? Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de WWW: http://www.musikinformatik.uni-mainz.de/ag