Skip to content

Commit

Permalink
more Win64 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Aug 31, 2012
1 parent e9ab704 commit d909c4f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/backend/cod1.c
Expand Up @@ -2542,6 +2542,9 @@ code *cdfunc(elem *e,regm_t *pretregs)
if (config.exe == EX_WIN64)
{
//printf("[%d] size = %u, numpara = %d ep = %p ", i, psize, numpara, ep); WRTYxx(ep->Ety); printf("\n");
#ifdef DEBUG
if (psize > REGSIZE) elem_print(e);
#endif
assert(psize <= REGSIZE);
psize = REGSIZE;
}
Expand Down
3 changes: 3 additions & 0 deletions src/backend/out.c
Expand Up @@ -333,6 +333,9 @@ void outdata(symbol *s)
if (s->Sclass == SCglobal
#if ELFOBJ || MACHOBJ
|| s->Sclass == SCstatic
#endif
#if OMFOBJ
|| (s->Sclass == SCstatic && I64)
#endif
)
objmod->pubdefsize(seg,s,s->Soffset,datasize); /* do the definition */
Expand Down
6 changes: 3 additions & 3 deletions src/e2ir.c
Expand Up @@ -781,7 +781,7 @@ elem *SymbolExp::toElem(IRState *irs)
nrvo = 1;
}

if (s->Sclass == SCauto || s->Sclass == SCparameter)
if (s->Sclass == SCauto || s->Sclass == SCparameter || s->Sclass == SCshadowreg)
{
if (fd && fd != irs->getFunc())
{ // 'var' is a variable in an enclosing function.
Expand Down Expand Up @@ -941,7 +941,7 @@ elem *VarExp::toElem(IRState *irs)
nrvo = 1;
}

if (s->Sclass == SCauto || s->Sclass == SCparameter)
if (s->Sclass == SCauto || s->Sclass == SCparameter || s->Sclass == SCshadowreg)
{
if (fd && fd != irs->getFunc())
{ // 'var' is a variable in an enclosing function.
Expand Down Expand Up @@ -1064,7 +1064,7 @@ elem *SymOffExp::toElem(IRState *irs)
assert(!var->isImportedSymbol());

// This code closely parallels that in VarExp::toElem()
if (s->Sclass == SCauto || s->Sclass == SCparameter)
if (s->Sclass == SCauto || s->Sclass == SCparameter || s->Sclass == SCshadowreg)
{
if (fd && fd != irs->getFunc())
{ // 'var' is a variable in an enclosing function.
Expand Down
6 changes: 5 additions & 1 deletion src/s2ir.c
Expand Up @@ -51,6 +51,8 @@ elem *callfunc(Loc loc,
elem *exp2_copytotemp(elem *e);
elem *incUsageElem(IRState *irs, Loc loc);
StructDeclaration *needsPostblit(Type *t);
elem *addressElem(elem *e, Type *t, bool alwaysCopy = false);


#define elem_setLoc(e,loc) ((e)->Esrcpos.Sfilename = (char *)(loc).filename, \
(e)->Esrcpos.Slinnum = (loc).linnum)
Expand Down Expand Up @@ -1010,7 +1012,9 @@ void SwitchStatement::toIR(IRState *irs)
/* Call:
* _d_switch_string(string[] si, string econd)
*/
elem *eparam = el_param(econd, el_var(si));
if (config.exe == EX_WIN64)
econd = addressElem(econd, condition->type, true);
elem *eparam = el_param(econd, (config.exe == EX_WIN64) ? el_ptr(si) : el_var(si));
switch (condition->type->nextOf()->ty)
{
case Tchar:
Expand Down
8 changes: 6 additions & 2 deletions src/scanmscoff.c
Expand Up @@ -68,8 +68,12 @@ void scanMSCoffObjModule(void* pctx, void (*pAddSymbol)(void* pctx, char* name,
break;

default:
error(loc, "MS-Coff object module %s has magic = %x, should be %x",
module_name, header->f_magic, IMAGE_FILE_MACHINE_AMD64);
if (buf[0] == 0x80)
error(loc, "Object module %s is 32 bit OMF, but it should be 64 bit MS-Coff",
module_name);
else
error(loc, "MS-Coff object module %s has magic = %x, should be %x",
module_name, header->f_magic, IMAGE_FILE_MACHINE_AMD64);
return;
}

Expand Down

0 comments on commit d909c4f

Please sign in to comment.