Exceptions in ARM

Johannes Pfau nospam at example.com
Wed Jan 8 07:52:07 PST 2014


Am Wed, 08 Jan 2014 08:37:43 +0000
schrieb "Timo Sintonen" <t.sintonen at luukku.com>:

> On Sunday, 5 January 2014 at 10:21:36 UTC, Timo Sintonen wrote:
> > On Sunday, 5 January 2014 at 10:06:48 UTC, Johannes Pfau wrote:
> >
> >> I should really start pushing my local ARM changes upstream. 
> >> Here's a
> >> fix for the EABI unwinder:
> >> https://github.com/jpf91/GDC/commit/262e432e95cbe31a6764cd337f64022a56011eda
> >>
> >> IIRC I also thought the code in gcc/deh.d wasn't correct. As 
> >> it wouldn't
> >> work for the eabi unwinder anyway (no Phase1Info member) I 
> >> didn't
> >> investigate that though.
> >
> > Meanwhile I got it to pass with this:
> > align(8) int _pad;
> >
> Exceptions still not working. The code call the unwind routine in 
> libgcc but that never calls back to personality routine. Neither 
> it resumes to the error callback nor abort.
> 
> There are several addresses in tables like the call to cleanup 
> code and jump to the catch routine. Are they called in libgcc 
> side or in personality routine? I was just wondering if thumb 
> mode has been taken into account.
> 
> Cortex processors have only the 16 bit 'thumb' instruction set. 
> This is indicated by setting the lsb of the address to 1 in any 
> address that is used in jumps or calls or any address loads to 
> pc. If the lsb is 0 it will result to illegal instruction fault 
> in Cortex.
> 
> When compiling with -mthumb the compiler always sets this bit for 
> any address and there is a separate libgcc for thumb mode. When 
> calculating address offsets from exception tables the compiler 
> can not know they are used as jump addresses. It may be possible 
> that callback functions are called in wrong mode.
> 
> Any thoughts?

Stupid question, but are C++ exceptions working for you? I think we
don't change anything inthe compiler related to exception handling, so
if C++ worked and D didn't it could only be a problem with the runtime
code?


More information about the D.gnu mailing list