ICE due to unsupported target
Johannes Pfau
nospam at example.com
Sat Mar 8 01:37:44 PST 2014
Am Sat, 08 Mar 2014 09:12:48 +0000
schrieb "Mike" <none at none.com>:
> On Saturday, 8 March 2014 at 08:09:29 UTC, Timo Sintonen wrote:
> >
> > Why do you need synchronized? Are you building some kind of
> > multithreading library?
>
> I don't need it yet. I'm just exploring features of D and trying
> to learn how to implement them. The real problem isn't that I
> can't use synchronized, but rather that the compiler is not aware
> of my target. I haven't searched through GDC's source code yet,
> but I suspect there will be more problems in the near future if
> the compiler is not taught about this target.
>
> Mike
>
critsecsize looks like a perfect example for configuration parameters
which should be provided by the runtime.
I'm thinking of a core/config.d module which can be read by the
compiler to get information about the runtime:
------------
enum critsecsize = 4;
enum hasGC = true;
enum hasAArray = true;
enum hasUnicodeLoops = true;
enum hasExceptions = true;
enum ...
------------
I wouldn't be too worried about 'isLinux' in general. Iain moved many
of these checks out of the frontend IIRC and rewrote them as checks
using Target::. In the end isLinux is just not the correct check if you
want to know the critsecsize/used ABI/...
grep isLinux */* shows that the only place in GDC where it's ever used
is critsecsize.
If you grep for isWindows you'll see that these checks are DMD-only and
GDC already avoids them. (isWindows affects extern(System) but that's
fine). It's similar for in the other cases.
So the compiler doesn't really have to be aware you're targeting
bare-metal as it shouldn't be tightly coupled to OS anyway. But what
you might want is a version identifier for 'BareMetal/NoOS' and
'CortexM3'. If you really need those, file a pull request for this
documentation:
http://dlang.org/version.html
For GDC version identifiers are implemented using these GCC patches:
https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/patches/patch-versym-cpu-4.9.x
https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/patches/patch-versym-os-4.9.x
I'm not really sure if CortexM3/M4 versions are easy to add though.
General rule: If there's some kind of macro for this in GCC/C/C++ it's
easy to add for GDC.
More information about the D.gnu
mailing list