All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] sparse, llvm: Fix symbol initializer code generation
@ 2011-11-21 20:03 Pekka Enberg
  2011-11-21 20:03 ` [PATCH 2/3] sparse, llvm: Fix 'extern' symbol " Pekka Enberg
  2011-11-21 20:03 ` [PATCH 3/3] sparse, llvm: Make llc output to stdout in sparsec Pekka Enberg
  0 siblings, 2 replies; 3+ messages in thread
From: Pekka Enberg @ 2011-11-21 20:03 UTC (permalink / raw)
  To: linux-sparse; +Cc: Pekka Enberg, Christopher Li, Jeff Garzik, Linus Torvalds

The output_data() function does not see right hand side symbols for expressions
such as this in target.c:

  struct symbol *size_t_ctype = &uint_ctype;

Therefore, call output_data() recursively if LLVMGetNamedGlobal() returns NULL
for a symbol.

Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 sparse-llvm.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index c037e02..ca49a6e 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -1055,7 +1055,7 @@ static void output_fn(LLVMModuleRef module, struct entrypoint *ep)
 	END_FOR_EACH_PTR(bb);
 }
 
-static int output_data(LLVMModuleRef module, struct symbol *sym)
+static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
 {
 	struct expression *initializer = sym->initializer;
 	LLVMValueRef initial_value;
@@ -1071,6 +1071,8 @@ static int output_data(LLVMModuleRef module, struct symbol *sym)
 			struct symbol *sym = initializer->symbol;
 
 			initial_value = LLVMGetNamedGlobal(module, show_ident(sym->ident));
+			if (!initial_value)
+				initial_value = output_data(module, sym);
 			break;
 		}
 		default:
@@ -1090,7 +1092,7 @@ static int output_data(LLVMModuleRef module, struct symbol *sym)
 
 	LLVMSetInitializer(data, initial_value);
 
-	return 0;
+	return data;
 }
 
 static int compile(LLVMModuleRef module, struct symbol_list *list)
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-21 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 20:03 [PATCH 1/3] sparse, llvm: Fix symbol initializer code generation Pekka Enberg
2011-11-21 20:03 ` [PATCH 2/3] sparse, llvm: Fix 'extern' symbol " Pekka Enberg
2011-11-21 20:03 ` [PATCH 3/3] sparse, llvm: Make llc output to stdout in sparsec Pekka Enberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.