From 0919ea0afd11a5f88146f84e8120cdd03b128b81 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 4 Feb 2017 10:22:07 -0500 Subject: ability to set global variable alignment and ... ..section in the initialization expression --- src/codegen.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index aa35ee2838..942113d58d 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2808,7 +2808,8 @@ static void do_code_gen(CodeGen *g) { // Generate module level variables for (size_t i = 0; i < g->global_vars.length; i += 1) { - VariableTableEntry *var = g->global_vars.at(i); + TldVar *tld_var = g->global_vars.at(i); + VariableTableEntry *var = tld_var->var; if (var->value.type->id == TypeTableEntryIdNumLitFloat) { // Generate debug info for it but that's it. @@ -2852,11 +2853,11 @@ static void do_code_gen(CodeGen *g) { if (var->linkage == VarLinkageExport) { LLVMSetLinkage(global_value, LLVMExternalLinkage); } - if (var->section_name) { - LLVMSetSection(global_value, buf_ptr(var->section_name)); + if (tld_var->section_name) { + LLVMSetSection(global_value, buf_ptr(tld_var->section_name)); } - if (var->alignment) { - LLVMSetAlignment(global_value, var->alignment); + if (tld_var->alignment) { + LLVMSetAlignment(global_value, tld_var->alignment); } // TODO debug info for function pointers -- cgit v1.2.3