From owner-freebsd-arch@FreeBSD.ORG Fri Jan 18 04:09:42 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 261B8D63 for ; Fri, 18 Jan 2013 04:09:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id BDAF7A89 for ; Fri, 18 Jan 2013 04:09:41 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r0I49XGp055208; Fri, 18 Jan 2013 06:09:33 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r0I49XGp055208 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r0I49XJk055207; Fri, 18 Jan 2013 06:09:33 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 18 Jan 2013 06:09:33 +0200 From: Konstantin Belousov To: Steve Kiernan Subject: Re: [JNPR] Proposal to add weak symbols for malloc, realloc, and free to libc Message-ID: <20130118040933.GU2522@kib.kiev.ua> References: <20130117161311.4c15c7c4@stevek-ubuntu> <20130117184654.06f8e330@stevek-ubuntu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CYcXvPfqKSDi0QhV" Content-Disposition: inline In-Reply-To: <20130117184654.06f8e330@stevek-ubuntu> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Jason Evans , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2013 04:09:42 -0000 --CYcXvPfqKSDi0QhV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 17, 2013 at 06:46:54PM -0500, Steve Kiernan wrote: > On Thu, 17 Jan 2013 15:42:19 -0800 > Jason Evans wrote: >=20 > > On Jan 17, 2013, at 1:13 PM, Steve Kiernan wrote: > > > When libc was changed to use jemalloc, the weak symbols for malloc, r= ealloc, and free ended up being removed. > > > This makes it a bit difficult for an application to replace (or augme= nt) the malloc implementation. > > >=20 > > > This proposal is to add back the weak symbols similar to how they exi= sted in libc prior to jemalloc introduction. > > >=20 > > > See the following patch for the changes: > > > http://people.freebsd.org/~marcel/Juniper/weak-malloc.diff > > >=20 > > > I'm not sure if the the symbols are in the proper place in the Symbol= =2Emap file and would welcome comments. > >=20 > > What about calloc(), posix_memalign(), and malloc_usable_size()? Simil= arly, I think the *allocm() functions in -current may need the same treatme= nt. >=20 > I think you are correct and those would probably be necessary, as well, y= es. >=20 > It looked like previously, calloc was not made weak because it was implem= ented in terms of malloc, but since that is not the case in jemalloc, it wi= ll need to be addressed. >=20 > I'll update the patch. New symbols should be added to the current version, which is FBSD_1.3 for the 10.0. That said, what are the difficulties you experiencing with the malloc interposing ? According to the normal ELF symbol lookup rules, the definitions from any object which is loaded before libc overrides the libc symbols. --CYcXvPfqKSDi0QhV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQ+Mr8AAoJEJDCuSvBvK1BwJoP/i4KWKy869fJT9PMYUr62msL liKfv9BbDWkY258wTg/TScBNDV7GLvdYtyD58UsfcYoGLN+YKN6Ilf8FHzxj0lKu N62nobUUKELI3TbvacpxgZsy6aC1hlG1an1O4zZFgZk/dLsXhTQY4gX2gIVuBjPY t34v5pDUJrsjDzGv1NoSpWSfLbfjwPOu4Vf6bHlYa/5VIXrSCTEdqtvQmbDtb7B7 svBmwKpr2t1Nx/hG6de9Ro6V8uJMDbQvNt9qFtjMBffdHLLb4JN0cvMzje3R0W89 2UiWAgNDcvYwAPi1/6XUBOkcNR0GNGf2F8gDgdRQrTOmgRAOusEOR9vOn+UXSD0P xw9lWNyBadr5mSZ5gQrxcpMfAQqrBwQrLCk5uxqoEqImigO4/ifHadM/iQlg1DqR AAawBJpRjH8quXVWqAyQt5tmOGJmh+lWfbXSeVHmEo+OT3VKVRNzwCKhrrBGemKC 0oSjGFp7dc5wvzStpTjQQnSIFBbxs9tF2H5bNKeMnmYOs5YyIBrogFXI9UZ53K5F slZvZImvIo7cD32i4z9IqhQki5csRiPj4JBIXUnmZKKGmmse9ubf1VhXFeNRFk7B jIx/bolf8CEwC+0McQJ6HqX2hZaVecqIdkF3hXzzjayXTS3aPk353i8Dkb70NbaD 5K0YbJwPM189NhzHSRbg =5bY2 -----END PGP SIGNATURE----- --CYcXvPfqKSDi0QhV--