summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-05-20 11:54:18 +0100
committerJosé Fonseca <[email protected]>2011-05-20 11:54:52 +0100
commita436b3b2d4524447c59d8f4003895d626cab309c (patch)
treeaef8d7130df8391839f27687ee55af7928bc728a
parent4f59b321784e7c16bc91696303886c1ce7270960 (diff)
gallivm: Fix for dynamically linked LLVM 2.8 library.
This prevents the error prog: for the -disable-mmx option: may only occur zero or one times! when creating a new context after XCloseDisplay with DRI drivers linked with a shared LLVM 2.8 library.
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 0ccf6a698bd..d2d7eccd92f 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;
}