aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorXi Wang <xi.wang@gmail.com>2013-05-21 04:05:20 -0400
committerPekka Enberg <penberg@kernel.org>2013-05-21 12:21:09 +0300
commit317876877c7c818c5cfd69da7bb45174b6ddadd4 (patch)
tree96b78605be36857516b6861b11f7a3583afc2541
parent5b950a99d4a81db8581741def3ea6acf05b0b493 (diff)
downloadsparse-dev-317876877c7c818c5cfd69da7bb45174b6ddadd4.tar.gz
sparse, llvm: set more data attributes
Set const, thread_local, and alignment for global variables. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--sparse-llvm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c
index e385d27c..92f1d0e7 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -1050,6 +1050,12 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
data = LLVMAddGlobal(module, LLVMTypeOf(initial_value), name);
LLVMSetLinkage(data, data_linkage(sym));
+ if (sym->ctype.modifiers & MOD_CONST)
+ LLVMSetGlobalConstant(data, 1);
+ if (sym->ctype.modifiers & MOD_TLS)
+ LLVMSetThreadLocal(data, 1);
+ if (sym->ctype.alignment)
+ LLVMSetAlignment(data, sym->ctype.alignment);
if (!(sym->ctype.modifiers & MOD_EXTERN))
LLVMSetInitializer(data, initial_value);