[RFA/commit] pre-initialize python-value.c:values_in_python (bug in MacOS linker)

Joel Brobecker brobecker@adacore.com
Fri Dec 5 18:42:00 GMT 2008


Hello,

We noticed that GDB does not build on x86-macos and x86_64-macos when
configured --without-python (we found this out because one of our
machine no longer has python installed on it). The problem is that
the linker complains that it cannot file values_in_python, referenced
from value.c. This is a bug, since we verified that the symbol was
defined inside python-value.o which was also part of the archive.
We think that this might be related to the fact that the symbol is
defined as "C" (common). We changed the code to add an initial value
of NULL (which in C is strictly equivalent to the current code),
which changed our variable to the Data section and, ta da, allowed
GDB to link.

2008-12-05  Joel Brobecker  <brobecker@adacore.com>

        * python/python-value.c (values_in_python): Add specific initialization
        to NULL to work-around a MacOS linker bug.

Tested on x86-linux, both using --with-python and --without-python.
No regression.

I think this is pretty safe and safe contained, and doesn't reduce
the quality of the code, so I'm planning on committing this on Monday
when back from weekend holiday (I'm in Europe). Any objection? Should
I add a comment?

Thanks,
-- 
Joel
-------------- next part --------------
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 8bf4ec8..c17fb3b 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -30,7 +30,7 @@
    can copy the values' types if needed.  This is declared
    unconditionally to reduce the number of uses of HAVE_PYTHON in the
    generic code.  */
-struct value *values_in_python;
+struct value *values_in_python = NULL;
 
 #ifdef HAVE_PYTHON
 


More information about the Gdb-patches mailing list