----- Original Message -----
> On 5/17/11 3:24 PM, Jose Fonseca wrote:
> 
> > I believe the best alternative here is to build  *_dri.so with -z
> > nodelete when linking against a shared libLLVM*.
> 
> That should work, even though it's incredibly unpleasant.  I would
> think
> LLVM would want to be robust against multiple users within the same
> address space.
> 
> - ajax
> 

I think I may have found a less intrusive workaround: to use another global 
variable inside libllvm.so to avoid doing the command line parsing twice. Diff 
below, but still need to verify on Fedora.

This is really just for LLVM 2.8, as LLVM 2.9 handles mmx properly out of the 
box.

Jose


diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 0ccf6a6..d2d7ecc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -106,13 +106,23 @@ lp_set_target_options(void)
     * See also:
     * - http://llvm.org/bugs/show_bug.cgi?id=3287
     * - 
http://l4.me.uk/post/2009/06/07/llvm-wrinkle-3-configuration-what-configuration/
+    *
+    * The -disable-mmx global option can be specified only once  since we
+    * dynamically link against LLVM it will reside in a separate shared object,
+    * which may or not be delete when this shared object is, so we use the
+    * llvm::DisablePrettyStackTrace variable (which we set below and should
+    * reside in the same shared library) to determine whether the -disable-mmx
+    * option has been set or not.
+    *
+    * Thankfully this ugly hack is not necessary on LLVM 2.9 onwards.
     */
-   static boolean first = TRUE;
-   if (first) {
+   if (!llvm::DisablePrettyStackTrace) {
+      static boolean first = TRUE;
       static const char* options[] = {
          "prog",
          "-disable-mmx"
       };
+      assert(first);
       llvm::cl::ParseCommandLineOptions(2, const_cast<char**>(options));
       first = FALSE;
    }
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to