Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120730042117.GW544@brightrain.aerifal.cx>
Date: Mon, 30 Jul 2012 00:21:17 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: bootstrap-linux patches for cross compilation to arm

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.