The defaults assumed by NASM if you do not specify the above
qualifiers are:
-\c section .text progbits alloc exec nowrite align=16
-\c section .data progbits alloc noexec write align=4
-\c section .bss nobits alloc noexec write align=4
-\c section other progbits alloc noexec nowrite align=1
+\c section .text progbits alloc exec nowrite align=16
+\c section .rodata progbits alloc noexec nowrite align=4
+\c section .data progbits alloc noexec write align=4
+\c section .bss nobits alloc noexec write align=4
+\c section other progbits alloc noexec nowrite align=1
(Any section name other than \c{.text}, \c{.data} and \c{.bss} is
treated by default like \c{other} in the above code.)
if (!strcmp(name, ".text"))
i = elf_make_section (name, SHT_PROGBITS,
SHF_ALLOC | SHF_EXECINSTR, 16);
+ else if (!strcmp(name, ".rodata"))
+ i = elf_make_section (name, SHT_PROGBITS,
+ SHF_ALLOC, 4);
else if (!strcmp(name, ".data"))
i = elf_make_section (name, SHT_PROGBITS,
SHF_ALLOC | SHF_WRITE, 4);
; [15] Reference a text-section symbol in the data section
; [16] Reference a data-section symbol in the data section
; [17] Reference a BSS-section symbol in the data section
+; [18] Define a non-global rodata-section symbol
BITS 32
GLOBAL lrotate ; [1]
; a local integer
localint resd 1 ; [6]
+
+ SECTION .rodata
+readonly dd readonly ; [18]