Skip to content

Commit

Permalink
forgot to check this in
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jul 12, 2012
1 parent 0b058c6 commit f264c0b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/eh.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ symbol *except_gentables()

outdata(s); // output the scope table

obj_ehtables(funcsym_p,funcsym_p->Ssize,s);
Obj::ehtables(funcsym_p,funcsym_p->Ssize,s);
#endif
return NULL;
}
Expand Down
51 changes: 31 additions & 20 deletions src/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void obj_append(Dsymbol *s)
void obj_write_deferred(Library *library)
{
for (size_t i = 0; i < obj_symbols_towrite.dim; i++)
{ Dsymbol *s = obj_symbols_towrite.tdata()[i];
{ Dsymbol *s = obj_symbols_towrite[i];
Module *m = s->getModule();

char *mname;
Expand Down Expand Up @@ -223,7 +223,7 @@ void obj_start(char *srcfile)
slist_reset();
clearStringTab();

obj_init(&objbuf, srcfile, NULL);
Obj::init(&objbuf, srcfile, NULL);

el_reset();
#if TX86
Expand All @@ -234,7 +234,7 @@ void obj_start(char *srcfile)

void obj_end(Library *library, File *objfile)
{
obj_term();
Obj::term();

if (library)
{
Expand All @@ -261,6 +261,17 @@ void obj_end(Library *library, File *objfile)
objbuf.inc = 0;
}

bool obj_includelib(const char *name)
{
return Obj::includelib(name);
}

void obj_startaddress(Symbol *s)
{
return Obj::startaddress(s);
}


/**************************************
* Generate .obj file for Module.
*/
Expand All @@ -273,7 +284,7 @@ void Module::genobjfile(int multiobj)

lastmname = srcfile->toChars();

obj_initfile(lastmname, NULL, toPrettyChars());
Obj::initfile(lastmname, NULL, toPrettyChars());

eictor = NULL;
ictorlocalgot = NULL;
Expand Down Expand Up @@ -413,7 +424,7 @@ void Module::genobjfile(int multiobj)

if (doppelganger)
{
obj_termfile();
Obj::termfile();
return;
}

Expand Down Expand Up @@ -491,7 +502,7 @@ void Module::genobjfile(int multiobj)
genmoduleinfo();
#endif

obj_termfile();
Obj::termfile();
}


Expand Down Expand Up @@ -607,37 +618,37 @@ void FuncDeclaration::toObjFile(int multiobj)
// Pull in RTL startup code (but only once)
if (func->isMain() && onlyOneMain(loc))
{
objextdef("_main");
Obj::external_def("_main");
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
obj_ehsections(); // initialize exception handling sections
Obj::ehsections(); // initialize exception handling sections
#endif
#if TARGET_WINDOS
objextdef("__acrtused_con");
Obj::external_def("__acrtused_con");
#endif
obj_includelib(libname);
Obj::includelib(libname);
s->Sclass = SCglobal;
}
else if (strcmp(s->Sident, "main") == 0 && linkage == LINKc)
{
#if TARGET_WINDOS
objextdef("__acrtused_con"); // bring in C startup code
obj_includelib("snn.lib"); // bring in C runtime library
Obj::external_def("__acrtused_con"); // bring in C startup code
Obj::includelib("snn.lib"); // bring in C runtime library
#endif
s->Sclass = SCglobal;
}
#if TARGET_WINDOS
else if (func->isWinMain() && onlyOneMain(loc))
{
objextdef("__acrtused");
obj_includelib(libname);
Obj::external_def("__acrtused");
Obj::includelib(libname);
s->Sclass = SCglobal;
}

// Pull in RTL startup code
else if (func->isDllMain() && onlyOneMain(loc))
{
objextdef("__acrtused_dll");
obj_includelib(libname);
Obj::external_def("__acrtused_dll");
Obj::includelib(libname);
s->Sclass = SCglobal;
}
#endif
Expand Down Expand Up @@ -948,7 +959,7 @@ void FuncDeclaration::toObjFile(int multiobj)

writefunc(s);
if (isExport())
obj_export(s, Poffset);
Obj::export_symbol(s, Poffset);

for (size_t i = 0; i < irs.deferToObj->dim; i++)
{
Expand All @@ -959,13 +970,13 @@ void FuncDeclaration::toObjFile(int multiobj)
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
// A hack to get a pointer to this function put in the .dtors segment
if (ident && memcmp(ident->toChars(), "_STD", 4) == 0)
obj_staticdtor(s);
Obj::staticdtor(s);
#endif
#if DMDV2
if (irs.startaddress)
{
printf("Setting start address\n");
obj_startaddress(irs.startaddress);
//printf("Setting start address\n");
Obj::startaddress(irs.startaddress);
}
#endif
}
Expand Down
14 changes: 7 additions & 7 deletions src/tocvdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ unsigned cv4_Denum(EnumDeclaration *e)
if (!property)
{
for (size_t i = 0; i < e->members->dim; i++)
{ EnumMember *sf = (e->members->tdata()[i])->isEnumMember();
{ EnumMember *sf = (*e->members)[i]->isEnumMember();
dinteger_t value;

if (sf)
Expand Down Expand Up @@ -185,7 +185,7 @@ unsigned cv4_Denum(EnumDeclaration *e)
unsigned j = 2;
unsigned fieldi = 0;
for (size_t i = 0; i < e->members->dim; i++)
{ EnumMember *sf = (e->members->tdata()[i])->isEnumMember();
{ EnumMember *sf = (*e->members)[i]->isEnumMember();
dinteger_t value;

if (sf)
Expand Down Expand Up @@ -249,7 +249,7 @@ void TypedefDeclaration::toDebug()
TOWORD(debsym,length - 2);

assert(length <= 40 + len);
obj_write_bytes(SegData[DEBSYM],length,debsym);
Obj::write_bytes(SegData[DEBSYM],length,debsym);
}
}

Expand Down Expand Up @@ -277,7 +277,7 @@ void EnumDeclaration::toDebug()
TOWORD(debsym,length - 2);

assert(length <= 40 + len);
obj_write_bytes(SegData[DEBSYM],length,debsym);
Obj::write_bytes(SegData[DEBSYM],length,debsym);
}
}

Expand Down Expand Up @@ -429,7 +429,7 @@ void StructDeclaration::toDebug()
TOWORD(debsym,length - 2);

assert(length <= 40 + len);
obj_write_bytes(SegData[DEBSYM],length,debsym);
Obj::write_bytes(SegData[DEBSYM],length,debsym);

// return typidx;
}
Expand Down Expand Up @@ -507,7 +507,7 @@ void ClassDeclaration::toDebug()
n = 0;
descriptor = 0;
for (size_t i = 0; i < vtbl.dim; i++)
{ FuncDeclaration *fd = (FuncDeclaration *)vtbl.tdata()[i];
{ FuncDeclaration *fd = (FuncDeclaration *)vtbl[i];

//if (intsize == 4)
descriptor |= 5;
Expand Down Expand Up @@ -611,7 +611,7 @@ void ClassDeclaration::toDebug()
TOWORD(debsym,length - 2);

assert(length <= 40 + len);
obj_write_bytes(SegData[DEBSYM],length,debsym);
Obj::write_bytes(SegData[DEBSYM],length,debsym);

// return typidx;
}
Expand Down
12 changes: 6 additions & 6 deletions src/toobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void Module::genmoduleinfo()

//////////////////////////////////////////////

obj_moduleinfo(msym);
Obj::moduleinfo(msym);
}

/* ================================================================== */
Expand Down Expand Up @@ -639,7 +639,7 @@ void ClassDeclaration::toObjFile(int multiobj)
// ClassInfo cannot be const data, because we use the monitor on it
outdata(csym);
if (isExport())
obj_export(csym,0);
Obj::export_symbol(csym,0);

//////////////////////////////////////////////

Expand Down Expand Up @@ -694,7 +694,7 @@ void ClassDeclaration::toObjFile(int multiobj)
out_readonly(vtblsym);
outdata(vtblsym);
if (isExport())
obj_export(vtblsym,0);
Obj::export_symbol(vtblsym,0);
}

/******************************************
Expand Down Expand Up @@ -936,7 +936,7 @@ void InterfaceDeclaration::toObjFile(int multiobj)
out_readonly(csym);
outdata(csym);
if (isExport())
obj_export(csym,0);
Obj::export_symbol(csym,0);
}

/* ================================================================== */
Expand Down Expand Up @@ -1141,11 +1141,11 @@ void VarDeclaration::toObjFile(int multiobj)
if (!sz && type->toBasetype()->ty != Tsarray)
assert(0); // this shouldn't be possible

if (sz || obj_allowZeroSize())
if (sz || Obj::allowZeroSize())
{
outdata(s);
if (isExport())
obj_export(s,0);
Obj::export_symbol(s,0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/typinf.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ void TypeInfoDeclaration::toObjFile(int multiobj)

outdata(s);
if (isExport())
obj_export(s,0);
Obj::export_symbol(s,0);
}

#endif
Expand Down

0 comments on commit f264c0b

Please sign in to comment.