mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-15 05:20:06 +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)
|
ST_FUNC void vset(CType *type, int r, int v)
|
||||||
{
|
{
|
||||||
CValue cval;
|
CValue cval = {0};
|
||||||
|
|
||||||
cval.i = v;
|
cval.i = v;
|
||||||
vsetc(type, r, &cval);
|
vsetc(type, r, &cval);
|
||||||
@ -1955,7 +1955,9 @@ static void gen_cast(CType *type)
|
|||||||
s = 24;
|
s = 24;
|
||||||
else if ((dbt & VT_BTYPE) == VT_SHORT)
|
else if ((dbt & VT_BTYPE) == VT_SHORT)
|
||||||
s = 16;
|
s = 16;
|
||||||
|
#ifdef TCC_TARGET_X86_64
|
||||||
|
if (!(dbt & (VT_PTR|VT_LLONG|VT_FUNC|VT_STRUCT)))
|
||||||
|
#endif
|
||||||
if(dbt & VT_UNSIGNED)
|
if(dbt & VT_UNSIGNED)
|
||||||
vtop->c.ui = ((unsigned int)vtop->c.ll << s) >> s;
|
vtop->c.ui = ((unsigned int)vtop->c.ll << s) >> s;
|
||||||
else
|
else
|
||||||
@ -3906,7 +3908,11 @@ ST_FUNC void unary(void)
|
|||||||
/* if forward reference, we must point to s */
|
/* if forward reference, we must point to s */
|
||||||
if (vtop->r & VT_SYM) {
|
if (vtop->r & VT_SYM) {
|
||||||
vtop->sym = s;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@ -5120,6 +5126,12 @@ static void init_putv(CType *type, Section *sec, unsigned long c,
|
|||||||
case VT_LLONG:
|
case VT_LLONG:
|
||||||
*(long long *)ptr |= (vtop->c.ll & bit_mask) << bit_pos;
|
*(long long *)ptr |= (vtop->c.ll & bit_mask) << bit_pos;
|
||||||
break;
|
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:
|
default:
|
||||||
if (vtop->r & VT_SYM) {
|
if (vtop->r & VT_SYM) {
|
||||||
greloc(sec, vtop->sym, c, R_DATA_PTR);
|
greloc(sec, vtop->sym, c, R_DATA_PTR);
|
||||||
|
Loading…
Reference in New Issue
Block a user