[LLVMdev] jit X86 target compilation callback bug

Anton Korobeynikov anton at korobeynikov.info
Tue Feb 2 09:12:04 PST 2010


Hello

> We are running llvm jit x86 on MS Visual Studio 2005. It seems there
> is a bug in asm code in function X86CompilationCallback in file
> X86JITInfo.cpp. Current code sets stack pointer to invalid value in
> instruction "and   esp,  16". Depending on current stack pointer value
> it sometimes overwrites ecx and edx registers with next three lines.
How so? The stack grows downwards, thus this realignment just equivalent
to "sub esp, some_value" with some_value being less than 16.
We don't use register save area inside the compilation callback,
however, since we're generating stubs "by hands".

> We have fixed this problem by changing this instruction to "sub  esp,
> 8" (8 because this function needs 2 temp 32bit variables).
What is "this" function?

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University




More information about the llvm-dev mailing list