1 Feb 10:55
[RFC/PATCH 2/2] sparse, llvm: Fix varargs functions
Pekka Enberg <penberg <at> kernel.org>
2012-02-01 09:55:52 GMT
2012-02-01 09:55:52 GMT
From: Benjamin Herrenschmidt <benh <at> kernel.crashing.org> We need to tell llvm about it or it won't generate the proper stack frame & argument list on some architectures. Cc: Christopher Li <sparse <at> chrisli.org> Cc: Jeff Garzik <jgarzik <at> redhat.com> Cc: Linus Torvalds <torvalds <at> linux-foundation.org> Signed-off-by: Benjamin Herrenschmidt <benh <at> kernel.crashing.org> [ penberg <at> kernel.org: Fix function pointer calls ] Signed-off-by: Pekka Enberg <penberg <at> kernel.org> --- sparse-llvm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sparse-llvm.c b/sparse-llvm.c index a291a0d..9226a21 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -79,7 +79,7 @@ static LLVMTypeRef sym_func_type(LLVMModuleRef module, struct symbol *sym) arg_type[idx++] = symbol_type(module, arg_sym); } END_FOR_EACH_PTR(arg); func_type = LLVMFunctionType(ret_type, arg_type, n_arg, - /* varargs? */ 0); + sym->ctype.base_type->variadic); return func_type; } @@ -744,7 +744,7 @@ static LLVMTypeRef get_func_type(struct function *fn, struct instruction *insn) } END_FOR_EACH_PTR(arg);(Continue reading)
Not something we absolutely need to sort out right now but another
reason why we really need to base the LLVM side definition based on the
declaration.
I'll try to toy a bit more this week-end see if the patches work for all
cases I can think of. We really have two different things (represented
by the two different hunks) which we might try to better factor:
RSS Feed