www.digitalmars.com         C & C++   DMDScript  

D.gnu - [patch] GDC 0.17 on Solaris/SPARC

reply Marcel Martin <marcel.martin uni-bielefeld.de> writes:
Hello,

thanks to the holidays I've again had some time to have a look at GDC on
Solaris/SPARC. A patch which makes GDC 0.17 work on Solaris 2.9 on SPARC
can be found at http://w148.de/~mmartin/d/gdc-0.17-sparc-solaris-patch .
I've tested it only with GCC 4.0.2.

A lot of stuff is still missing, but GDC itself compiles and can then be
used to compile small D programs. Phobos is still problematic, it uses
unaligned memory access in many places (those are not allowed by the
hardware and lead to bus errors at runtime).

Changes

- changed version() identifier from "Sparc" to "SPARC" as pointed out by
Anders Björklund (way back in February 2005). At the time of my last patch
I didn't know "SPARC" is actually an abbreviation (for Scalable Processor
Architecture, http://en.wikipedia.org/wiki/SPARC).

- "autoconfed" strtof(), it's not available on the system I used.

- added a bridge for fpclassify() (it's similar to the AIX code).

- adjusted Data_Start and Data_End for the garbage collector (see below)

Issues

- After some research I still don't know where Solaris' math functions
(isinf, signbit, fpclassify, ...) are supposed to be found. Some are in
libm.so, some in libsunmath.so, some in both. I don't know what the correct
way to handle this is. I wonder if it'd be a good idea to use the GCC
builtins.

- Data_Start is set to __dso_handle. I don't know what that symbol is for or
who put it there, but in the few experiments I did it always marked the
start of the data. I guess it's sheer luck this works in my case, but
_etext was even worse because using that led to segmentation faults.
Boehm GC uses "GC_SysVGetDataStart(0x10000, _etext)" on Solaris, which
eventually scans downwards starting at Data_End until it hits a page it
can't write.
Why isn't Boehm GC used anymore in GDC? Especially all the code that deals
with architecture-specific differences is already in there. It seems using
Phobos' GC means that all that has to be rewritten.


By the way, libphobos' Makefile.in has some missing dependencies, since
parallel make (make -j) doesn't work and has to be restarted a few times
for the build to finish.

I will try to fix the unaligned memory accesses in Phobos next, but I wonder
if it's possible to implement a -Wcast-align option, which would save some
work finding the problematic code.

How should those changes be handled? Should they be versioned with something
like version(No_Cast_Align)?

Lastly, please note that I'm no Solaris expert, just learning about it as I
go.

It actually took a few days to prepare this patch and I have to admit I'm a
bit disappointed it only has 8.4K ... I'm therefore quite impressed by what
David has done already, thank you!

Marcel
Dec 29 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Marcel Martin wrote:

 - changed version() identifier from "Sparc" to "SPARC" as pointed out by
 Anders Björklund (way back in February 2005). At the time of my last patch
 I didn't know "SPARC" is actually an abbreviation (for Scalable Processor
 Architecture, http://en.wikipedia.org/wiki/SPARC).
Actually I only wanted it to match the other two: "X86" and "PPC"... (see http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Version) But it seems that Walter is in no hurry to add versions not being used by the Digital Mars compiler, to the D language specification. Glad you changed it, though, and best of luck with the aligments. --anders
Dec 29 2005