From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/512 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] properly terminate linked link of dsos Date: Thu, 13 Oct 2011 21:03:17 -0400 Message-ID: <20111014010317.GY132@brightrain.aerifal.cx> References: <1318427173.165420.11829@legion> <20111012140141.GX132@brightrain.aerifal.cx> <37ae4188867ea36022c6305ae687bd23@exys.org> <05e2d053cdb7c8726eb0f9bcebbbf048@exys.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1318554704 9133 80.91.229.12 (14 Oct 2011 01:11:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2011 01:11:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-513-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 14 03:11:40 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1REWJH-0000F0-J3 for gllmg-musl@lo.gmane.org; Fri, 14 Oct 2011 03:11:39 +0200 Original-Received: (qmail 9637 invoked by uid 550); 14 Oct 2011 01:11:38 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9628 invoked from network); 14 Oct 2011 01:11:38 -0000 Content-Disposition: inline In-Reply-To: <05e2d053cdb7c8726eb0f9bcebbbf048@exys.org> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:512 Archived-At: On Wed, Oct 12, 2011 at 04:46:30PM +0200, aep wrote: > clang optimized away the check in calloc.c to false. > I can work around it with a cast to something volatile: You could instead just change the (size_t *) cast to (volatile size_t *)... But I think the problem is much deeper. This "optimization" is necessarily based on the compiler making an assumption about what the function named "malloc" does. Compiling the implementation (libc) itself requires disabling such assumptions; with gcc, this is achieved with -ffreestanding (-fno-builtin will also work). Can you use the same or similar option with clang? I made similar comments on IRC.. Rich