From owner-svn-src-head@FreeBSD.ORG Thu Jun 6 12:42:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 95F176D7; Thu, 6 Jun 2013 12:42:51 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay004.isp.belgacom.be (mailrelay004.isp.belgacom.be [195.238.6.170]) by mx1.freebsd.org (Postfix) with ESMTP id 979F21EFB; Thu, 6 Jun 2013 12:42:50 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8GAPaCsFFbsJH7/2dsb2JhbABZgwkwv0V3F3SCIwEBBVYjEAsUBAkWBAsJAwIBAgEnDREGDQEFAgEBiA0IuyCOfzMHg1sDmGiQF4FYgTk6 Received: from 251.145-176-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.176.145.251]) by relay.skynet.be with ESMTP; 06 Jun 2013 14:42:42 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id r56CgfcE002768; Thu, 6 Jun 2013 14:42:41 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <51B083C0.7020001@FreeBSD.org> Date: Thu, 06 Jun 2013 14:42:40 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130517 Thunderbird/17.0.6 MIME-Version: 1.0 To: Marcel Moolenaar Subject: Re: svn commit: r250991 - in head: contrib/jemalloc/include/jemalloc include lib/libc/stdlib/jemalloc References: <201305251859.r4PIxChc053341@svn.freebsd.org> <51AC9933.7050201@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2013 12:42:51 -0000 On 2013-06-03 16:50, Marcel Moolenaar wrote: > > On Jun 3, 2013, at 6:25 AM, Dimitry Andric wrote: > >> On 2013-05-25 20:59, Marcel Moolenaar wrote: >>> Author: marcel >>> Date: Sat May 25 18:59:11 2013 >>> New Revision: 250991 >>> URL: http://svnweb.freebsd.org/changeset/base/250991 >>> >>> Log: >>> Make the malloc(3) family of functions weak and make their non-weak >>> implementations visible for use by applications. The functions $F that >>> are now weak symbols are: >>> allocm, calloc, dallocm, free, malloc, malloc_usable_size, >>> nallocm, posix_memalign, rallocm, realloc, sallocm >>> >>> The non-weak implementations of $F are exported as __$F. >> >> Hi Marcel, >> >> This commit seems to lead to various problems in ports, and possibly >> other software. For example, with Firefox I now always get a few >> messages like: >> >> firefox in free(): warning: malloc() has never been called >> >> Another example is the devel/talloc port, which now dies with: > > It looks like the python build is broken. The net effect is that _ctypes.so > has a strong definition of malloc, free, et al. This is not intentional, > but a side-effect of the what seems to be a bug in fficonfig.py.in (see > patch below). To elaborate: > > _ctypes.so incorporates the libffi functionality for what I presume is > the basis for Python bindings. libffi includes dlmalloc.c, an open source > allocator. dlmalloc.c is incuded by closures.c and closures.c defines > USE_DL_PREFIX. On top of that closures.c makes all allocator functions > static. This, by design there's no problem. In short: dlmalloc.c never > gets compiler separately/independently. > > The python build however compiles dlmalloc.c separately/independently. > As such, dlmalloc.c now defines and exports malloc et al and it also > get linked into _ctypes.so. > > Once _ctypes.so gets dynamically loaded, things start to break. > > Unfortunately, this means python needs to be recompiled from ports with > the following fix: > > Index: files/patch-Modules-_ctypes-libffi-fficonfig.py.in > =================================================================== > --- files/patch-Modules-_ctypes-libffi-fficonfig.py.in (revision 0) > +++ files/patch-Modules-_ctypes-libffi-fficonfig.py.in (working copy) > @@ -0,0 +1,10 @@ > +--- Modules/_ctypes/libffi/fficonfig.py.in.orig 2013-06-03 07:16:44.000000000 -0700 > ++++ Modules/_ctypes/libffi/fficonfig.py.in 2013-06-03 07:17:03.000000000 -0700 > +@@ -1,7 +1,6 @@ > + ffi_sources = """ > + src/prep_cif.c > + src/closures.c > +-src/dlmalloc.c > + """.split() > + > + ffi_platforms = { > > This has been tested with python-2.7.5. I can't say anything about > other versions. > > Do people concur that this is the right fix? Maybe you should send this patch to python@. They should know if it's the right fix. It worked for me anyway.