* [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
* [PATCH 2/3] sparse, llvm: Fix 'extern' symbol code generation
2011-11-21 20:03 [PATCH 1/3] sparse, llvm: Fix symbol initializer code generation Pekka Enberg
@ 2011-11-21 20:03 ` Pekka Enberg
2011-11-21 20:03 ` [PATCH 3/3] sparse, llvm: Make llc output to stdout in sparsec Pekka Enberg
1 sibling, 0 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
LLVMExternalLinkage is used for both extern and non-extern C symbols. The
linkage is differentiated by LLVMSetInitializer() which is should not be called
for extern symbols.
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 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sparse-llvm.c b/sparse-llvm.c
index ca49a6e..1a2a34d 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -1090,7 +1090,8 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
LLVMSetLinkage(data, data_linkage(sym));
- LLVMSetInitializer(data, initial_value);
+ if (!(sym->ctype.modifiers & MOD_EXTERN))
+ LLVMSetInitializer(data, initial_value);
return data;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] sparse, llvm: Make llc output to stdout in sparsec
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 ` Pekka Enberg
1 sibling, 0 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
This patch fixes a bug in 'sparsec' that made it generate empty object files.
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>
---
sparsec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sparsec b/sparsec
index 33e1a2b..9c90b30 100755
--- a/sparsec
+++ b/sparsec
@@ -34,7 +34,7 @@ TMPFILE=`mktemp -t tmp.XXXXXX`".o"
$DIRNAME/sparse-llvm $SPARSEOPTS > $TMPLLVM
-llc $TMPLLVM | as -o $TMPFILE
+llc -o - $TMPLLVM | as -o $TMPFILE
if [ $NEED_LINK -eq 1 ]; then
if [ -z $OUTFILE ]; then
--
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.