Implement function alignment via attributes

which requires being able to emit an arbitrary number of NOP
instructions, which is also implemented here.  For x86 we
could emit other sequences but these are the easiest.
This commit is contained in:
Michael Matz
2018-04-06 23:01:45 +02:00
parent ef668aae1e
commit 671dcace82
8 changed files with 56 additions and 0 deletions

View File

@@ -2035,6 +2035,16 @@ void gfunc_epilog(void)
}
}
ST_FUNC void gen_fill_nops(int bytes)
{
if ((bytes & 3))
tcc_error("alignment of code section not multiple of 4");
while (bytes > 0) {
C67_NOP(4);
bytes -= 4;
}
}
/* generate a jump to a label */
int gjmp(int t)
{