----- Original Message ----- > > Hi, > > On Thursday, April 25, 2013 10:29:27 Jose Fonseca wrote: > > - There are a bunch of options that need to be set via globals, (see > > lp_set_target_options), so app/drivers could tamper with each other > > options. > > > > - llvm::cl::ParseCommandLineOptions will complain if called multiple times > > -- I think we no longer need to call it these days though > > > > In short, LLVM was not designed for multiple users in the same process. > Yep. > > Also llvm is still emerging too fast to assume a specific version to be > available. At least with r600 we do currently need a somewhat recent version > and kind of have this assumption. > But due to the api not kept strictly backwards compatible and all the > pitfalls > that happen while emerging fast its very likely that a potential application > that also tries to make use of the driver modules just brings its own > probably > incompatible llvm version in some way. So shielding this in any way makes > sense ... > > > For the Mesa wrappers: > I have attached a shell script again as a rapid proof that is able to build a > linker script that builds up a wrapper shared library that contains a private > llvm copy. > > That's again non optimal - it contains just all static libs that I > have in my current test environment... It's just to sketch how this could > work. > > The MesaLLVM-with-prefix.link script can by used with the command > > g++ -shared -o libMesaLLVM.so MesaLLVM-with-prefix.link > > to produce a libMesaLLVM.so that contains all C symbols starting with LLVM > from libLLVMCore.a. All of them get prefixed with Mesa and are the only > exported symbols then. > That's close to Joses suggestion but with less work to be done in sources. > > The MesaLLVM-with-version.link script can by used with the command > > g++ -shared -o libMesaLLVM.so MesaLLVM-with-version.link > > to produce a libMesaLLVM.so shared library that uses symbol versioning to > distinguish between the llvm versions. I got this idea yesterday and this > might simplify the problem a lot. > By this variant we do not even need to prefix all the callers by Mesa. What > this does is to explicitly assign a symbol version to all these calls. At > static link symbol resolve time with this libMesaLLVM.so, this symbol version > (the 'A MesaLLVM_1.0' entry) is then pulled out of this shared object and all > users, in libllvmradeon.so for example, are linked against > LLVMCreateContext@MesaLLVM_1,0 instead of just LLVMCreateContext. So we > should > get a private copy of llvm in libMesaLLVM.so with just the same call names > than usual source code wise. > That's to be tested and verified, but if this works like I think it should, > this is the easiest way to get our own LLVM version on linux at least.
Wow. I confess I wasn't aware that linker scripts were this powerful. And if it works, using a custom version instead of a custom symbol prefix seems a genial idea IMO. Jose _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev