aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-04 10:22:07 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-04 10:22:07 -0500
commit0919ea0afd11a5f88146f84e8120cdd03b128b81 (patch)
treeae7ea0e9768b148e369c825b6a2302b673d997aa /src/codegen.cpp
parent67b02326f88805df8bbda5e93d1cf46e40c48862 (diff)
downloadzig-0919ea0afd11a5f88146f84e8120cdd03b128b81.tar.gz
zig-0919ea0afd11a5f88146f84e8120cdd03b128b81.zip
ability to set global variable alignment and ...
..section in the initialization expression
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp11
1 files changed, 6 insertions, 5 deletions
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