lib: mksection macro added for declaring program sections
%define MKGLOBAL(name,type,scope) global name
%endif ; WIN_ABI
+;;; macro to declare sections
+;;; The main uses case is to declare read-only data sections on linux & windows
+%macro mksection 1+
+%ifidni %1,.rodata
+ ;; read-only data section recognized
+%ifdef LINUX
+ section .rodata
+%else ; WIN_ABI
+ section .rdata
+%endif
+%elifidni %1,stack-noexec
+ ;; noexec stack marker
+%ifdef LINUX
+ section .note.GNU-stack noalloc noexec nowrite progbits
+%endif ; LINUX
+%else
+ ;; data, bss or code/text
+ section %1
+%endif
+%endmacro
+
%endif ; OS_ASM_FILE
