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

@@ -157,6 +157,12 @@ static int oad(int c, int s)
return t;
}
ST_FUNC void gen_fill_nops(int bytes)
{
while (bytes--)
g(0x90);
}
/* generate jmp to a label */
#define gjmp2(instr,lbl) oad(instr,lbl)