gdc-4.5 testing

Iain Buclaw ibuclaw at ubuntu.com
Wed Dec 22 03:32:46 PST 2010


== Quote from Neal Becker (ndbecker2 at gmail.com)'s article
> Anders F Björklund wrote:
> > Neal Becker wrote:
> >> Does this support building shared libs now (on x86_64)?
> >>
> > ...
> >>> I uploaded the packages to SourceForge, if anyone else
> >>> wants to try them... It's made for Fedora 14 (x86_64):
> >>>
> >>> http://sourceforge.net/projects/gdcgnu/files/gdc/8ac6cb4f40aa/
> >
> > You mean in general, or specifics ? (like throwing exceptions
> > or allocating memory or whatever...) Was it a problem before ?
> >
> > Basic creation seems to work:
> >
> > $ gdc -fPIC -o foo.o -c foo.d
> > $ gcc -shared -o libfoo.so foo.o
> > $ file libfoo.so
> > libfoo.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
> > dynamically linked, not stripped
> >
> > AFAIK both shared libraries and x86_64 code have been working
> > for years with GDC, even though that is not the case with DMD.
> >
> > Phobos is still static, though.
> >
> > --anders
> But you can't link shared obj to static lib (Phobos), except on i386 - so
> you really can't use shared obj on x86_64 (if you need phobos).

As far as I'm aware, the #1 reason why (for GDC, at least) Phobos can't be
compiled as shared is because of inline asm clobbering the PIC register (EBX on
i386). Because we're not smart enough (LDC likely suffers from this also), in
some instances EBX can be wrongly marked as being clobbered too.

So things you can do to address this is:
1) Improve the inline asm. :~)
2) Hide all problematic places with version(D_PIC) in Phobos.
3) Turn off D_InlineAsm when flag_pic is turned on.



More information about the Digitalmars-d mailing list