diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/d-decls.cc gcc-3.4.5-20060117-1/gcc/d/d-decls.cc --- gcc-3.4.5-20060117-1.orig/gcc/d/d-decls.cc Sat Nov 5 09:12:02 2005 +++ gcc-3.4.5-20060117-1/gcc/d/d-decls.cc Fri Apr 14 01:27:59 2006 @@ -640,6 +638,17 @@ g.ofile->setupStaticStorage(this, decl); +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + // Have to test for import first +// if (isImportedSymbol()) +// gen.addDeclAttribute( var_decl, "dllimport" ); +// else +// printf("%d,%d,%d:%s\n", prot(), prot() == PROTexport, isExport(), toChars()); + if (isExport()) + gen.addDeclAttribute( decl, "dllexport" ); +#endif + + TREE_CONSTANT( decl ) = 0; // DMD puts this into .data, not .rodata... TREE_READONLY( decl ) = 1; // Non-constant data, but still won't be assigned to. } @@ -661,6 +670,16 @@ DECL_NAME( decl ) = get_identifier( temp_sym->Sident ); delete temp_sym; +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + // Have to test for import first +// if (isImportedSymbol()) +// gen.addDeclAttribute( var_decl, "dllimport" ); +// else + if (isExport()) + gen.addDeclAttribute( decl, "dllexport" ); +#endif + + TREE_CONSTANT( decl ) = 1; // Interface ClassInfo images are in .rodata, but classes arent..? } return csym; @@ -699,6 +718,14 @@ dkeep(decl); g.ofile->setupStaticStorage(this, decl); +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + // Have to test for import first +// if (isImportedSymbol()) +// gen.addDeclAttribute( var_decl, "dllimport" ); +// else +// if (isExport()) + gen.addDeclAttribute( decl, "dllexport" ); +#endif TREE_CONSTANT( decl ) = 0; // *not* readonly, moduleinit depends on this TREE_READONLY( decl ) = 0; // Not an lvalue, tho @@ -729,6 +756,14 @@ dkeep(decl); g.ofile->setupStaticStorage(this, decl); +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + // Have to test for import first +// if (isImportedSymbol()) +// gen.addDeclAttribute( var_decl, "dllimport" ); +// else + if (isExport()) + gen.addDeclAttribute( decl, "dllexport" ); +#endif TREE_READONLY( decl ) = 1; TREE_CONSTANT( decl ) = 1; @@ -783,6 +818,15 @@ dkeep(t); g.ofile->setupStaticStorage(this, t); +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + // Have to test for import first +// if (isImportedSymbol()) +// gen.addDeclAttribute( var_decl, "dllimport" ); +// else +// printf("%d,%d,%d:%s\n", prot(), prot() == PROTexport, isExport(), toChars()); + if (isExport()) + gen.addDeclAttribute( t, "dllexport" ); +#endif // %% what's the diff between setting this stuff on the DECL and the // CONSTRUCTOR itself? diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/aggregate.h gcc-3.4.5-20060117-1/gcc/d/dmd/aggregate.h --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/aggregate.h Wed Oct 12 21:06:52 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/aggregate.h Fri Apr 14 01:27:59 2006 @@ -87,6 +87,7 @@ void accessCheck(Loc loc, Scope *sc, Dsymbol *smember); enum PROT prot(); + int isExport(); // Back end Symbol *stag; // tag symbol for debug data diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/class.c gcc-3.4.5-20060117-1/gcc/d/dmd/class.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/class.c Wed Oct 12 21:06:52 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/class.c Fri Apr 14 01:27:59 2006 @@ -844,6 +844,8 @@ interfaceSemantic(sc); + protection = sc->protection; + if (vtblOffset()) vtbl.push(this); // leave room at vtbl[0] for classinfo diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/declaration.c gcc-3.4.5-20060117-1/gcc/d/dmd/declaration.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/declaration.c Tue Oct 25 21:33:56 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/declaration.c Fri Apr 14 01:27:59 2006 @@ -32,6 +32,11 @@ linkage = LINKdefault; } +int Declaration::isExport() +{ + return (protection == PROTexport); +} + void Declaration::semantic(Scope *sc) { } @@ -752,7 +757,7 @@ { this->tinfo = tinfo; storage_class = STCstatic; - protection = PROTpublic; + protection = PROTexport; //TODO Probally change latter based on scope? linkage = LINKc; } @@ -767,6 +772,10 @@ assert(linkage == LINKc); } +int TypeInfoDeclaration::isImportedSymbol() +{ + return false; +} /***************************** TypeInfoStructDeclaration ***********************/ TypeInfoStructDeclaration::TypeInfoStructDeclaration(Type *tinfo) diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/declaration.h gcc-3.4.5-20060117-1/gcc/d/dmd/declaration.h --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/declaration.h Sun Oct 2 10:17:56 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/declaration.h Fri Apr 14 01:27:59 2006 @@ -111,6 +111,8 @@ enum PROT prot(); + int isExport(); + Declaration *isDeclaration() { return this; } }; @@ -246,6 +248,7 @@ Symbol *toSymbol(); void toObjFile(); // compile to .obj file virtual void toDt(dt_t **pdt); + int isImportedSymbol(); }; struct TypeInfoStructDeclaration : TypeInfoDeclaration diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/func.c gcc-3.4.5-20060117-1/gcc/d/dmd/func.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/func.c Mon Oct 24 17:48:04 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/func.c Fri Apr 14 01:27:59 2006 @@ -1284,7 +1284,10 @@ int FuncDeclaration::isExport() { - return protection == PROTexport; + return protection == PROTexport || + (isMember() && + !(protection == PROTprivate || protection == PROTpackage) && + toParent()->isExport()); } int FuncDeclaration::isImportedSymbol() diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/idgen.c gcc-3.4.5-20060117-1/gcc/d/dmd/idgen.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/idgen.c Fri Sep 9 17:27:06 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/idgen.c Fri Apr 14 01:27:59 2006 @@ -30,6 +30,7 @@ { "IUnknown" }, { "Object" }, { "object" }, + { "exception" }, { "max" }, { "min" }, { "This", "this" }, diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/module.c gcc-3.4.5-20060117-1/gcc/d/dmd/module.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/module.c Mon Oct 24 17:48:04 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/module.c Fri Apr 14 01:27:59 2006 @@ -528,6 +528,13 @@ members->shift(im); } + // Add import of "exception" if this module isn't "exception" + if (!md || (ident != Id::object && strcmp(md->toChars(), "exception") != 0)) + { + Import *im = new Import(0, NULL, Id::exception); + members->shift(im); + } + // Add all symbols into module's symbol table symtab = new DsymbolTable(); for (i = 0; i < members->dim; i++) diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/struct.c gcc-3.4.5-20060117-1/gcc/d/dmd/struct.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/struct.c Wed Oct 12 21:06:52 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/struct.c Fri Apr 14 01:27:59 2006 @@ -21,6 +21,11 @@ /********************************* AggregateDeclaration ****************************/ +int AggregateDeclaration::isExport() +{ + return (protection == PROTexport); +} + AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id) : ScopeDsymbol(id) { diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/dmd/toobj.c gcc-3.4.5-20060117-1/gcc/d/dmd/toobj.c --- gcc-3.4.5-20060117-1.orig/gcc/d/dmd/toobj.c Tue Oct 25 21:33:56 2005 +++ gcc-3.4.5-20060117-1/gcc/d/dmd/toobj.c Fri Apr 14 01:27:59 2006 @@ -262,6 +262,10 @@ //printf("ClassDeclaration::toObjFile('%s')\n", toChars()); + // Lets try TypeInfo + if (getType() && getType()->getTypeInfoDeclaration()) + getType()->getTypeInfoDeclaration()->toObjFile(); + if (!members) return; diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/Makefile.in gcc-3.4.5-20060117-1/gcc/d/phobos/Makefile.in --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/Makefile.in Sun Nov 27 23:17:52 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/Makefile.in Mon Apr 24 16:17:42 2006 @@ -125,7 +125,7 @@ ti_Abit.o ti_void.o MAIN_OBJS=std/asserterror.o internal/switch.o gcstats.o \ - internal/critical.o internal/object.o internal/monitor.o internal/arraycat.o internal/invariant.o \ + internal/critical.o internal/object.o internal/exception.o internal/monitor.o internal/arraycat.o internal/invariant.o \ std/outofmemory.o internal/aaA.o internal/adi.o internal/aApply.o std/file.o \ std/compiler.o std/system.o std/moduleinit.o std/md5.o std/base64.o \ internal/cast.o std/path.o std/string.o internal/memset.o std/math.o std/mmfile.o \ @@ -288,7 +288,7 @@ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ for f in $(srcdir)/$$i/*.[hd]; do $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; done; \ done - for i in crc32.d gcstats.d object.d; do \ + for i in crc32.d gcstats.d object.d exception.d; do \ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); done $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/gcc $(INSTALL_HEADER) $(host_alias)/gcc/config.d $(DESTDIR)$(gdc_include_dir)/$(host_alias)/gcc diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/exception.d gcc-3.4.5-20060117-1/gcc/d/phobos/exception.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/exception.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/exception.d Fri Apr 14 01:27:59 2006 @@ -0,0 +1,22 @@ +module exception; + +// Recoverable errors + +class Exception : Object +{ + char[] msg; + + this(char[] msg); + void print(); + char[] toString(); +} + +// Non-recoverable errors + +class Error : Exception +{ + Error next; + + this(char[] msg); + this(char[] msg, Error next); +} diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/dgccmain2.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/dgccmain2.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/dgccmain2.d Fri Sep 9 17:27:06 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/dgccmain2.d Tue Apr 25 14:05:44 2006 @@ -7,6 +7,7 @@ import std.c.stdio; import std.c.stdlib; import std.string; +import std.gc; version (GNU) { private import gcc.config; @@ -24,6 +25,81 @@ extern (C) void _moduleDtor(); extern (C) void _moduleUnitTests(); +/********************************************** + * Determine base address and size of static data segment. + */ + +version (GNU) +{ +// This is MinGW specific +extern (C) +{ + // TODO: skip the .rdata between .data and .bss? + extern int _data_start__; + extern int _bss_end__; +} + +void os_query_staticdataseg(void **base, uint *nbytes) +{ + *base = cast(void *)&_data_start__; + *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char *)&_data_start__); +} + +} +else +{ + +extern (C) +{ + extern int _xi_a; // &_xi_a just happens to be start of data segment + extern int _edata; // &_edata is start of BSS segment + extern int _end; // &_end is past end of BSS +} +extern (C) +void os_query_staticdataseg(void **base, uint *nbytes) +{ + *base = cast(void *)&_xi_a; + *nbytes = cast(uint)(cast(char *)&_end - cast(char *)&_xi_a); +} +} + +extern (C) + static void scanStaticData() + { + void *pbot; + void *ptop; + uint nbytes; + + //debug(PRINTF) printf("+GC.scanStaticData()\n"); + os_query_staticdataseg(&pbot, &nbytes); + ptop = pbot + nbytes; + version (GNU) { + if (pbot) { + std.gc.addRange(pbot, ptop); + } + } else { + std.gc.addRange(pbot, ptop); + } + //debug(PRINTF) printf("-GC.scanStaticData()\n"); + } + +extern (C) + static void unscanStaticData() + { + void *pbot; + uint nbytes; + + os_query_staticdataseg(&pbot, &nbytes); + version (GNU) { + if (pbot) { + std.gc.removeRange(pbot); + } + } else { + std.gc.removeRange(pbot); + } + } + + /*********************************** * The D main() function supplied by the user's program */ @@ -61,6 +137,7 @@ _STI_monitor_staticctor(); _STI_critical_init(); gc_init(); + scanStaticData(); version (GNU_CBridge_Stdio) _d_gnu_cbridge_init_stdio(); am = cast(char[] *) malloc(argc * (char[]).sizeof); diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/exception.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/exception.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/exception.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/exception.d Fri Apr 14 01:27:59 2006 @@ -0,0 +1,45 @@ +module exception; +/** + * All recoverable exceptions should be derived from class Exception. + */ +class Exception : Object +{ + char[] msg; + + /** + * Constructor; msg is a descriptive message for the exception. + */ + this(char[] msg) + { + this.msg = msg; + } + + void print() + { + printf("%.*s\n", toString()); + } + + char[] toString() { return msg; } +} + +/** + * All irrecoverable exceptions should be derived from class Error. + */ +class Error : Exception +{ + Error next; + + /** + * Constructor; msg is a descriptive message for the exception. + */ + this(char[] msg) + { + super(msg); + } + + this(char[] msg, Error next) + { + super(msg); + this.next = next; + } +} diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gc.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gc.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gc.d Sun Nov 27 10:59:46 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gc.d Tue Apr 25 12:42:52 2006 @@ -80,7 +80,7 @@ throw new Error("incompatible gc versions"); // Add our static data to the new gc - GC.scanStaticData(g); + //GC.scanStaticData(g); _gc = g; // return oldp; @@ -88,7 +88,7 @@ void endGCHandle() { - GC.unscanStaticData(_gc); + //GC.unscanStaticData(_gc); } extern (C) @@ -112,7 +112,7 @@ _gc = cast(GC *) std.c.stdlib.calloc(1, GC.sizeof); } _gc.initialize(); - GC.scanStaticData(_gc); + //GC.scanStaticData(_gc); std.thread.Thread.thread_init(); } diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gc_dyn.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gc_dyn.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gc_dyn.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gc_dyn.d Sun Apr 23 20:20:42 2006 @@ -0,0 +1,9 @@ +import gcx; + +gc_t __gc; + +gc_t _gc( ) +{ return __gc; } + +void _gc( gc_t gc ) +{ __gc = gc; } \ No newline at end of file diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gcx.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gcx.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/gcx.d Thu Aug 11 22:32:44 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/gcx.d Tue Apr 25 12:43:08 2006 @@ -558,41 +558,6 @@ } } - static void scanStaticData(gc_t g) - { - void *pbot; - void *ptop; - uint nbytes; - - //debug(PRINTF) printf("+GC.scanStaticData()\n"); - os_query_staticdataseg(&pbot, &nbytes); - ptop = pbot + nbytes; - version (GNU) { - if (pbot) { - g.addRange(pbot, ptop); - } - } else { - g.addRange(pbot, ptop); - } - //debug(PRINTF) printf("-GC.scanStaticData()\n"); - } - - static void unscanStaticData(gc_t g) - { - void *pbot; - uint nbytes; - - os_query_staticdataseg(&pbot, &nbytes); - version (GNU) { - if (pbot) { - g.removeRange(pbot); - } - } else { - g.removeRange(pbot); - } - } - - void addRoot(void *p) // add p to list of roots { synchronized (gcLock) diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/win32.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/win32.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/gc/win32.d Thu Apr 28 17:12:44 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/gc/win32.d Tue Apr 25 12:47:39 2006 @@ -82,44 +82,6 @@ } } -/********************************************** - * Determine base address and size of static data segment. - */ - -version (GNU) -{ -// This is MinGW specific -extern (C) -{ - // TODO: skip the .rdata between .data and .bss? - extern int _data_start__; - extern int _bss_end__; -} - -void os_query_staticdataseg(void **base, uint *nbytes) -{ - *base = cast(void *)&_data_start__; - *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char *)&_data_start__); -} - -} -else -{ - -extern (C) -{ - extern int _xi_a; // &_xi_a just happens to be start of data segment - extern int _edata; // &_edata is start of BSS segment - extern int _end; // &_end is past end of BSS -} - -void os_query_staticdataseg(void **base, uint *nbytes) -{ - *base = cast(void *)&_xi_a; - *nbytes = cast(uint)(cast(char *)&_end - cast(char *)&_xi_a); -} - -} /++++ void os_query_staticdataseg(void **base, uint *nbytes) diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/object.d gcc-3.4.5-20060117-1/gcc/d/phobos/internal/object.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/internal/object.d Wed Oct 12 21:06:52 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/internal/object.d Mon Apr 24 16:17:42 2006 @@ -583,49 +583,5 @@ int function(void*,void*) xopCmp; } -/** - * All recoverable exceptions should be derived from class Exception. - */ -class Exception : Object -{ - char[] msg; - - /** - * Constructor; msg is a descriptive message for the exception. - */ - this(char[] msg) - { - this.msg = msg; - } - - void print() - { - printf("%.*s\n", toString()); - } - - char[] toString() { return msg; } -} - -/** - * All irrecoverable exceptions should be derived from class Error. - */ -class Error : Exception -{ - Error next; - - /** - * Constructor; msg is a descriptive message for the exception. - */ - this(char[] msg) - { - super(msg); - } - - this(char[] msg, Error next) - { - super(msg); - this.next = next; - } -} //extern (C) int nullext = 0; diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/d/phobos/object.d gcc-3.4.5-20060117-1/gcc/d/phobos/object.d --- gcc-3.4.5-20060117-1.orig/gcc/d/phobos/object.d Tue Oct 25 21:33:56 2005 +++ gcc-3.4.5-20060117-1/gcc/d/phobos/object.d Mon Apr 24 16:17:42 2006 @@ -108,24 +108,3 @@ int function(void*,void*) xopCmp; } -// Recoverable errors - -class Exception : Object -{ - char[] msg; - - this(char[] msg); - void print(); - char[] toString(); -} - -// Non-recoverable errors - -class Error : Exception -{ - Error next; - - this(char[] msg); - this(char[] msg, Error next); -} - diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc/version.c gcc-3.4.5-20060117-1/gcc/version.c --- gcc-3.4.5-20060117-1.orig/gcc/version.c Tue Apr 25 15:00:54 2006 +++ gcc-3.4.5-20060117-1/gcc/version.c Tue Apr 25 14:32:30 2006 @@ -5,7 +5,7 @@ please modify this string to indicate that, e.g. by putting your organization's name in parentheses at the end of the string. */ -const char version_string[] = "3.4.5 (mingw special) (gdc 0.17, using dmd 0.140)"; +const char version_string[] = "3.4.5 (mingw special) (gdc 0.16, using dmd 0.137)"; /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, diff -wbBruN gcc-3.4.5-20060117-1.orig/gcc-3.4.5-build.sh gcc-3.4.5-20060117-1/gcc-3.4.5-build.sh --- gcc-3.4.5-20060117-1.orig/gcc-3.4.5-build.sh Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/gcc-3.4.5-build.sh Fri Apr 14 02:28:27 2006 @@ -0,0 +1,5 @@ +#!/bin/sh +../gcc-3.4.5-20060117-1/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,d --disable-win32-registry --disable-shared --enable-libstdcxx-debug +make CFLAGS="-O2 -fomit-frame-pointer" CXXFLAGS="-mthreads -fno-omit-frame-pointer -O2" LDFLAGS=-s bootstrap +#cd gcc +#make CFLAGS=-O2 LDFLAGS=-s LN_S=ln gnatlib_and_tools diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/Makefile.in gcc-3.4.5-20060117-1/libphobos/Makefile.in --- gcc-3.4.5-20060117-1.orig/libphobos/Makefile.in Sun Nov 27 23:17:52 2005 +++ gcc-3.4.5-20060117-1/libphobos/Makefile.in Mon Apr 24 16:17:42 2006 @@ -125,7 +125,7 @@ ti_Abit.o ti_void.o MAIN_OBJS=std/asserterror.o internal/switch.o gcstats.o \ - internal/critical.o internal/object.o internal/monitor.o internal/arraycat.o internal/invariant.o \ + internal/critical.o internal/object.o internal/exception.o internal/monitor.o internal/arraycat.o internal/invariant.o \ std/outofmemory.o internal/aaA.o internal/adi.o internal/aApply.o std/file.o \ std/compiler.o std/system.o std/moduleinit.o std/md5.o std/base64.o \ internal/cast.o std/path.o std/string.o internal/memset.o std/math.o std/mmfile.o \ @@ -288,7 +288,7 @@ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ for f in $(srcdir)/$$i/*.[hd]; do $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; done; \ done - for i in crc32.d gcstats.d object.d; do \ + for i in crc32.d gcstats.d object.d exception.d; do \ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); done $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/gcc $(INSTALL_HEADER) $(host_alias)/gcc/config.d $(DESTDIR)$(gdc_include_dir)/$(host_alias)/gcc diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/exception.d gcc-3.4.5-20060117-1/libphobos/exception.d --- gcc-3.4.5-20060117-1.orig/libphobos/exception.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/libphobos/exception.d Fri Apr 14 01:27:59 2006 @@ -0,0 +1,22 @@ +module exception; + +// Recoverable errors + +class Exception : Object +{ + char[] msg; + + this(char[] msg); + void print(); + char[] toString(); +} + +// Non-recoverable errors + +class Error : Exception +{ + Error next; + + this(char[] msg); + this(char[] msg, Error next); +} diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/dgccmain2.d gcc-3.4.5-20060117-1/libphobos/internal/dgccmain2.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/dgccmain2.d Fri Sep 9 17:27:06 2005 +++ gcc-3.4.5-20060117-1/libphobos/internal/dgccmain2.d Tue Apr 25 14:05:44 2006 @@ -7,6 +7,7 @@ import std.c.stdio; import std.c.stdlib; import std.string; +import std.gc; version (GNU) { private import gcc.config; @@ -24,6 +25,81 @@ extern (C) void _moduleDtor(); extern (C) void _moduleUnitTests(); +/********************************************** + * Determine base address and size of static data segment. + */ + +version (GNU) +{ +// This is MinGW specific +extern (C) +{ + // TODO: skip the .rdata between .data and .bss? + extern int _data_start__; + extern int _bss_end__; +} + +void os_query_staticdataseg(void **base, uint *nbytes) +{ + *base = cast(void *)&_data_start__; + *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char *)&_data_start__); +} + +} +else +{ + +extern (C) +{ + extern int _xi_a; // &_xi_a just happens to be start of data segment + extern int _edata; // &_edata is start of BSS segment + extern int _end; // &_end is past end of BSS +} +extern (C) +void os_query_staticdataseg(void **base, uint *nbytes) +{ + *base = cast(void *)&_xi_a; + *nbytes = cast(uint)(cast(char *)&_end - cast(char *)&_xi_a); +} +} + +extern (C) + static void scanStaticData() + { + void *pbot; + void *ptop; + uint nbytes; + + //debug(PRINTF) printf("+GC.scanStaticData()\n"); + os_query_staticdataseg(&pbot, &nbytes); + ptop = pbot + nbytes; + version (GNU) { + if (pbot) { + std.gc.addRange(pbot, ptop); + } + } else { + std.gc.addRange(pbot, ptop); + } + //debug(PRINTF) printf("-GC.scanStaticData()\n"); + } + +extern (C) + static void unscanStaticData() + { + void *pbot; + uint nbytes; + + os_query_staticdataseg(&pbot, &nbytes); + version (GNU) { + if (pbot) { + std.gc.removeRange(pbot); + } + } else { + std.gc.removeRange(pbot); + } + } + + /*********************************** * The D main() function supplied by the user's program */ @@ -61,6 +137,7 @@ _STI_monitor_staticctor(); _STI_critical_init(); gc_init(); + scanStaticData(); version (GNU_CBridge_Stdio) _d_gnu_cbridge_init_stdio(); am = cast(char[] *) malloc(argc * (char[]).sizeof); diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/exception.d gcc-3.4.5-20060117-1/libphobos/internal/exception.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/exception.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/libphobos/internal/exception.d Fri Apr 14 01:27:59 2006 @@ -0,0 +1,45 @@ +module exception; +/** + * All recoverable exceptions should be derived from class Exception. + */ +class Exception : Object +{ + char[] msg; + + /** + * Constructor; msg is a descriptive message for the exception. + */ + this(char[] msg) + { + this.msg = msg; + } + + void print() + { + printf("%.*s\n", toString()); + } + + char[] toString() { return msg; } +} + +/** + * All irrecoverable exceptions should be derived from class Error. + */ +class Error : Exception +{ + Error next; + + /** + * Constructor; msg is a descriptive message for the exception. + */ + this(char[] msg) + { + super(msg); + } + + this(char[] msg, Error next) + { + super(msg); + this.next = next; + } +} diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gc.d gcc-3.4.5-20060117-1/libphobos/internal/gc/gc.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gc.d Sun Nov 27 10:59:46 2005 +++ gcc-3.4.5-20060117-1/libphobos/internal/gc/gc.d Tue Apr 25 12:42:52 2006 @@ -80,7 +80,7 @@ throw new Error("incompatible gc versions"); // Add our static data to the new gc - GC.scanStaticData(g); + //GC.scanStaticData(g); _gc = g; // return oldp; @@ -88,7 +88,7 @@ void endGCHandle() { - GC.unscanStaticData(_gc); + //GC.unscanStaticData(_gc); } extern (C) @@ -112,7 +112,7 @@ _gc = cast(GC *) std.c.stdlib.calloc(1, GC.sizeof); } _gc.initialize(); - GC.scanStaticData(_gc); + //GC.scanStaticData(_gc); std.thread.Thread.thread_init(); } diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gc_dyn.d gcc-3.4.5-20060117-1/libphobos/internal/gc/gc_dyn.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gc_dyn.d Wed Dec 31 19:00:00 1969 +++ gcc-3.4.5-20060117-1/libphobos/internal/gc/gc_dyn.d Sun Apr 23 20:20:42 2006 @@ -0,0 +1,9 @@ +import gcx; + +gc_t __gc; + +gc_t _gc( ) +{ return __gc; } + +void _gc( gc_t gc ) +{ __gc = gc; } \ No newline at end of file diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gcx.d gcc-3.4.5-20060117-1/libphobos/internal/gc/gcx.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/gcx.d Thu Aug 11 22:32:44 2005 +++ gcc-3.4.5-20060117-1/libphobos/internal/gc/gcx.d Tue Apr 25 12:43:08 2006 @@ -558,41 +558,6 @@ } } - static void scanStaticData(gc_t g) - { - void *pbot; - void *ptop; - uint nbytes; - - //debug(PRINTF) printf("+GC.scanStaticData()\n"); - os_query_staticdataseg(&pbot, &nbytes); - ptop = pbot + nbytes; - version (GNU) { - if (pbot) { - g.addRange(pbot, ptop); - } - } else { - g.addRange(pbot, ptop); - } - //debug(PRINTF) printf("-GC.scanStaticData()\n"); - } - - static void unscanStaticData(gc_t g) - { - void *pbot; - uint nbytes; - - os_query_staticdataseg(&pbot, &nbytes); - version (GNU) { - if (pbot) { - g.removeRange(pbot); - } - } else { - g.removeRange(pbot); - } - } - - void addRoot(void *p) // add p to list of roots { synchronized (gcLock) diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/win32.d gcc-3.4.5-20060117-1/libphobos/internal/gc/win32.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/gc/win32.d Thu Apr 28 17:12:44 2005 +++ gcc-3.4.5-20060117-1/libphobos/internal/gc/win32.d Tue Apr 25 12:47:39 2006 @@ -82,44 +82,6 @@ } } -/********************************************** - * Determine base address and size of static data segment. - */ - -version (GNU) -{ -// This is MinGW specific -extern (C) -{ - // TODO: skip the .rdata between .data and .bss? - extern int _data_start__; - extern int _bss_end__; -} - -void os_query_staticdataseg(void **base, uint *nbytes) -{ - *base = cast(void *)&_data_start__; - *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char *)&_data_start__); -} - -} -else -{ - -extern (C) -{ - extern int _xi_a; // &_xi_a just happens to be start of data segment - extern int _edata; // &_edata is start of BSS segment - extern int _end; // &_end is past end of BSS -} - -void os_query_staticdataseg(void **base, uint *nbytes) -{ - *base = cast(void *)&_xi_a; - *nbytes = cast(uint)(cast(char *)&_end - cast(char *)&_xi_a); -} - -} /++++ void os_query_staticdataseg(void **base, uint *nbytes) diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/internal/object.d gcc-3.4.5-20060117-1/libphobos/internal/object.d --- gcc-3.4.5-20060117-1.orig/libphobos/internal/object.d Wed Oct 12 21:06:52 2005 +++ gcc-3.4.5-20060117-1/libphobos/internal/object.d Mon Apr 24 16:17:42 2006 @@ -583,49 +583,5 @@ int function(void*,void*) xopCmp; } -/** - * All recoverable exceptions should be derived from class Exception. - */ -class Exception : Object -{ - char[] msg; - - /** - * Constructor; msg is a descriptive message for the exception. - */ - this(char[] msg) - { - this.msg = msg; - } - - void print() - { - printf("%.*s\n", toString()); - } - - char[] toString() { return msg; } -} - -/** - * All irrecoverable exceptions should be derived from class Error. - */ -class Error : Exception -{ - Error next; - - /** - * Constructor; msg is a descriptive message for the exception. - */ - this(char[] msg) - { - super(msg); - } - - this(char[] msg, Error next) - { - super(msg); - this.next = next; - } -} //extern (C) int nullext = 0; diff -wbBruN gcc-3.4.5-20060117-1.orig/libphobos/object.d gcc-3.4.5-20060117-1/libphobos/object.d --- gcc-3.4.5-20060117-1.orig/libphobos/object.d Tue Oct 25 21:33:56 2005 +++ gcc-3.4.5-20060117-1/libphobos/object.d Mon Apr 24 16:17:42 2006 @@ -108,24 +108,3 @@ int function(void*,void*) xopCmp; } -// Recoverable errors - -class Exception : Object -{ - char[] msg; - - this(char[] msg); - void print(); - char[] toString(); -} - -// Non-recoverable errors - -class Error : Exception -{ - Error next; - - this(char[] msg); - this(char[] msg, Error next); -} -