From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7896 invoked by alias); 5 Dec 2008 18:42:19 -0000 Received: (qmail 7884 invoked by uid 22791); 5 Dec 2008 18:42:17 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Dec 2008 18:41:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9D6382A9649 for ; Fri, 5 Dec 2008 13:41:25 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jOjhw7PcoViD for ; Fri, 5 Dec 2008 13:41:25 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 6D3F02A9639 for ; Fri, 5 Dec 2008 13:41:25 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A7A73E7ACD; Fri, 5 Dec 2008 19:41:23 +0100 (CET) Date: Fri, 05 Dec 2008 18:42:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA/commit] pre-initialize python-value.c:values_in_python (bug in MacOS linker) Message-ID: <20081205184123.GF5382@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="yNb1oOkm5a9FJOVX" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00098.txt.bz2 --yNb1oOkm5a9FJOVX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1207 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 * 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 --yNb1oOkm5a9FJOVX Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="python-value.diff" Content-length: 429 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 --yNb1oOkm5a9FJOVX--