From 2ee93c3f46f8e948d2331eab46c95322a88874ee Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 3 Apr 2026 21:45:17 +0100 Subject: 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. --- src/con_.S | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/con_.S') 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 -- cgit v1.2.3-54-g00ecf