mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
Fixes for PE x86_64 for fail in code
int (*fn1)=0x13fde16b5; and int fn1(int a) {...} struct { int (*fn2)(int a); } b = { fn1 };
This commit is contained in:
parent
935d8169b8
commit
ea7b17f641
18
tccgen.c
18
tccgen.c
@ -446,7 +446,7 @@ ST_FUNC void vpush_global_sym(CType *type, int v)
|
||||
|
||||
ST_FUNC void vset(CType *type, int r, int v)
|
||||
{
|
||||
CValue cval;
|
||||
CValue cval = {0};
|
||||
|
||||
cval.i = v;
|
||||
vsetc(type, r, &cval);
|
||||
@ -1955,7 +1955,9 @@ static void gen_cast(CType *type)
|
||||
s = 24;
|
||||
else if ((dbt & VT_BTYPE) == VT_SHORT)
|
||||
s = 16;
|
||||
|
||||
#ifdef TCC_TARGET_X86_64
|
||||
if (!(dbt & (VT_PTR|VT_LLONG|VT_FUNC|VT_STRUCT)))
|
||||
#endif
|
||||
if(dbt & VT_UNSIGNED)
|
||||
vtop->c.ui = ((unsigned int)vtop->c.ll << s) >> s;
|
||||
else
|
||||
@ -3906,7 +3908,11 @@ ST_FUNC void unary(void)
|
||||
/* if forward reference, we must point to s */
|
||||
if (vtop->r & VT_SYM) {
|
||||
vtop->sym = s;
|
||||
vtop->c.ul = 0;
|
||||
#ifdef TCC_TARGET_X86_64
|
||||
s1->vtop->c.ull = 0;
|
||||
#else
|
||||
s1->vtop->c.ul = 0;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -5120,6 +5126,12 @@ static void init_putv(CType *type, Section *sec, unsigned long c,
|
||||
case VT_LLONG:
|
||||
*(long long *)ptr |= (vtop->c.ll & bit_mask) << bit_pos;
|
||||
break;
|
||||
case VT_PTR:
|
||||
if (s1->vtop->r & VT_SYM) {
|
||||
greloc(s1, sec, s1->vtop->sym, c, R_DATA_PTR);
|
||||
}
|
||||
*(addr_t *)ptr |= (s1->vtop->c.ull & bit_mask) << bit_pos;
|
||||
break;
|
||||
default:
|
||||
if (vtop->r & VT_SYM) {
|
||||
greloc(sec, vtop->sym, c, R_DATA_PTR);
|
||||
|
Loading…
Reference in New Issue
Block a user