summaryrefslogtreecommitdiff
path: root/src/con_.S
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2026-04-03 21:45:17 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2026-04-04 01:37:54 +0100
commit2ee93c3f46f8e948d2331eab46c95322a88874ee (patch)
treeb3a39f8e79ef725579b569748ac4be28b82b1266 /src/con_.S
parente174011b5e7390dc8714910185aaa40d0a44702f (diff)
downloadsst-2ee93c3f46f8e948d2331eab46c95322a88874ee.tar.gz
sst-2ee93c3f46f8e948d2331eab46c95322a88874ee.zip
Size-optimise cvar value cleanup
Put all the cvars together contiguously; then we don't need to generate lots of individual calls to extfree() and can instead simply iterate a fixed-sized array.
Diffstat (limited to 'src/con_.S')
-rw-r--r--src/con_.S20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/con_.S b/src/con_.S
index 0c6ec2d..a9a7447 100644
--- a/src/con_.S
+++ b/src/con_.S
@@ -42,4 +42,24 @@ ASM_MANGLE(_con_colourmsg):
.byte 0x25
.long ASM_MANGLE(_con_colourmsgf)
+// The DEF_CVAR macros put stuff in .rdata$y/.rodata.cvars1. Sandwiching that
+// between empty x/0 and z/2 sections gives us section start/end pointers to
+// iterate the cvars, which is used for freeing the values on unload. Relies
+// on the section merging not adding extra padding, which is fine with the
+// linker + settings we use in practice.
+#ifdef _WIN32
+.section .rdata$x, "rw"
+#else
+.section .rodata.cvars0, "rw"
+#endif
+.globl ASM_MANGLE(_con_vars_start)
+ASM_MANGLE(_con_vars_start):
+#ifdef _WIN32
+.section .rdata$z, "rw"
+#else
+.section .rodata.cvars2, "rw"
+#endif
+.globl ASM_MANGLE(_con_vars_end)
+ASM_MANGLE(_con_vars_end):
+
// vi: sw=4 ts=4 noet tw=80 cc=80