diff options
| author | gingerBill <bill@gingerbill.org> | 2024-07-23 02:40:51 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-07-23 02:40:51 +0100 |
| commit | bc5b41938ec29cbc7678c0307e7571a02b3d84b1 (patch) | |
| tree | 139cf901083e9eaa938ed374766eb0f1d88e4312 /src/llvm_backend_const.cpp | |
| parent | 527c0b3202a5c61c253b83f527aea08fea2370fb (diff) | |
Fix #3964
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 12bcc4e1f..4f9ca8714 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -470,7 +470,7 @@ gb_internal bool lb_is_nested_possibly_constant(Type *ft, Selection const &sel, return lb_is_elem_const(elem, ft); } -gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_local) { +gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_local, bool is_rodata) { LLVMContextRef ctx = m->ctx; type = default_type(type); @@ -565,6 +565,10 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo array_data = LLVMAddGlobal(m->mod, lb_type(m, t), str); LLVMSetInitializer(array_data, backing_array.value); + if (is_rodata) { + LLVMSetGlobalConstant(array_data, true); + } + lbValue g = {}; g.value = array_data; g.type = t; |