Add @(align=N) for variables, raising the alignment of globals, locals, @(static) and @(thread_local) variables to at least N

This commit is contained in:
gingerBill committed 2026-10-07 15:54:21 +01:00
1 parent 30f80e1079
commit 5ff7268cab
8 files changed
+35 -5

No files matched your search

+1 -1
View File
@@ -2421,7 +2421,7 @@ gb_internal void lb_create_global_variable(lbModule *m, lbGlobalVariable *var) {
LLVM_SET_INTERNAL_WEAK_LINKAGE(g.value);
}
lb_set_linkage_from_entity_flags(m, g.value, e->flags);
LLVMSetAlignment(g.value, cast(u32)type_align_of(e->type));
LLVMSetAlignment(g.value, cast(u32)gb_max(type_align_of(e->type), e->Variable.custom_align));
if (e->Variable.link_section.len > 0) {
LLVMSetSection(g.value, alloc_cstring(permanent_allocator(), e->Variable.link_section));