[PATCH 2/3] sparse, llvm: Fix 'extern' symbol code generation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
Cc: Jeff Garzik <jgarzik@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux