I am trying to reuse some assembly code in my C project. Suppose I have a sequence of instructions, and I would like to organize them as a function:
void foo() {
__asm__ (
"mov %eax, %ebx"
"push %eax"
...
);
}
However, one obstacle is that in the compiled assembly code of function foo, besides the inlined assembly code, compiler would also generate some prologue instructions for this function, and the whole assembly program would become something like:
foo:
push %ebp <---- routine code generated by compilers
mov %ebp, %esp <---- routine code generated by compilers
mov %eax, %ebx
push %eax
Given my usage scenario, such routine code actually breaks the original semantics of the inlined assembly.
So here is my question, is there any way that I can prevent compiler from generating those function prologue and epilogue instructions, and only include the inlined assembly code?