aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-10 20:07:05 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:06:21 +0900
commit1d2d432a112ca20abf2cd0d82254204f0018407f (patch)
treebaa4971d227acb52ec1e9d292c15095c1b916527
parent3e7147bb740afb5c78944d2ef721af9bf5ddbb95 (diff)
downloadducc-1d2d432a112ca20abf2cd0d82254204f0018407f.tar.gz
ducc-1d2d432a112ca20abf2cd0d82254204f0018407f.tar.zst
ducc-1d2d432a112ca20abf2cd0d82254204f0018407f.zip
feat: put string literals on read-only section
-rw-r--r--codegen.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/codegen.c b/codegen.c
index 7ca5fe7..941d69c 100644
--- a/codegen.c
+++ b/codegen.c
@@ -527,6 +527,7 @@ void codegen(Program* prog) {
printf(".intel_syntax noprefix\n\n");
+ printf(".section .rodata\n\n");
int i;
for (i = 0; prog->str_literals[i]; ++i) {
printf(".Lstr__%d:\n", i + 1);
@@ -535,6 +536,7 @@ void codegen(Program* prog) {
printf(".globl main\n\n");
+ printf(".text\n\n");
for (i = 0; i < prog->funcs->node_len; ++i) {
AstNode* func = prog->funcs->node_items + i;
codegen_func(g, func);