aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-06-06 15:20:47 +0100
committergingerBill <bill@gingerbill.org>2024-06-06 15:20:47 +0100
commitbea47db4953559dbbcdce1da5dbaf38d0bb8d943 (patch)
treeded35c03f4e5bb20c3f602740ea8dd3a1dfab0d3 /src/llvm_backend_stmt.cpp
parent9ef43fc782159893b7af139f9d9be3aec3108ecd (diff)
Allow `@(rodata)` on `@(static)` variables
Diffstat (limited to 'src/llvm_backend_stmt.cpp')
-rw-r--r--src/llvm_backend_stmt.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/llvm_backend_stmt.cpp b/src/llvm_backend_stmt.cpp
index b18db4e45..9f28e45e0 100644
--- a/src/llvm_backend_stmt.cpp
+++ b/src/llvm_backend_stmt.cpp
@@ -1850,7 +1850,9 @@ gb_internal void lb_build_static_variables(lbProcedure *p, AstValueDecl *vd) {
LLVMSetInitializer(global, LLVMConstNull(lb_type(p->module, e->type)));
if (value.value != nullptr) {
LLVMSetInitializer(global, value.value);
- } else {
+ }
+ if (e->Variable.is_rodata) {
+ LLVMSetGlobalConstant(global, true);
}
if (e->Variable.thread_local_model != "") {
LLVMSetThreadLocal(global, true);