From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1386 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: bootstrap-linux patches for cross compilation to arm Date: Mon, 30 Jul 2012 00:21:17 -0400 Message-ID: <20120730042117.GW544@brightrain.aerifal.cx> References: <20120728125421.GU544@brightrain.aerifal.cx> <20120728203703.GV544@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1343622081 28120 80.91.229.3 (30 Jul 2012 04:21:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 30 Jul 2012 04:21:21 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1387-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 30 06:21:22 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SvhTq-0006hF-LG for gllmg-musl@plane.gmane.org; Mon, 30 Jul 2012 06:21:18 +0200 Original-Received: (qmail 27973 invoked by uid 550); 30 Jul 2012 04:21:17 -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 27965 invoked from network); 30 Jul 2012 04:21:17 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1386 Archived-At: On Mon, Jul 30, 2012 at 11:14:46AM +1000, James Bond wrote: > > This is stupid; there's no reason for the division to raise signals or > > generate exceptions. Integer division by zero results in undefined > > [...] > > Agreed. > > A few people have been hit by this problem, I found at least two here: > - earlier problem (2009) with proposed hack > http://gcc.gnu.org/ml/gcc-help/2009-10/msg00332.html > - more recent problem (2012) with proposed patches > http://comments.gmane.org/gmane.comp.gcc.help/41025 > > The patch involves disabling exception in libgcc's libunwind. However I'm > not qualified to judge the correctness or suitability of these patches for > general purpose as they are targetting bare metal, while for our case we > are targetting musl. The patch seems correct or at least suitable as a workaround. It looks like this is a bug in gcc's code generation for arm; with exceptions enabled, it seems to be generating code to throw an exception for division by zero. There's no reason this should be done; integer division by zero is UB not an exception you can catch and handle (even in C++). Rich