diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-04-25 08:23:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 08:23:48 +0100 |
| commit | b83809779b66fa4935eff356ee9f84a114982726 (patch) | |
| tree | 1a5baee3a497ad7ec415afc10a5f0062f5e1a656 /src/llvm_backend_stmt.cpp | |
| parent | cfb478808e7dae48f3a40fe7e40927c5e38a5d1d (diff) | |
| parent | 9284ebb5e831c6c25e90131f5c607997760a7396 (diff) | |
Merge pull request #5075 from Barinzaya/global-var-alignment
Fix Global/Static Variable Alignment
Diffstat (limited to 'src/llvm_backend_stmt.cpp')
| -rw-r--r-- | src/llvm_backend_stmt.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp index a0b7e8340..96a5d0db1 100644 --- a/src/llvm_backend_stmt.cpp +++ b/src/llvm_backend_stmt.cpp @@ -1984,6 +1984,7 @@ gb_internal void lb_build_static_variables(lbProcedure *p, AstValueDecl *vd) { char *c_name = alloc_cstring(permanent_allocator(), mangled_name); LLVMValueRef global = LLVMAddGlobal(p->module->mod, lb_type(p->module, e->type), c_name); + LLVMSetAlignment(global, cast(u32)type_align_of(e->type)); LLVMSetInitializer(global, LLVMConstNull(lb_type(p->module, e->type))); if (value.value != nullptr) { LLVMSetInitializer(global, value.value); |