mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
Make .rodata a recognized ELF section with default attributes
This commit is contained in:
parent
64af0aa6de
commit
77a036e213
@ -4024,10 +4024,11 @@ requirements of the section.
|
||||
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.)
|
||||
|
@ -327,6 +327,9 @@ static long elf_section_names (char *name, int pass, int *bits)
|
||||
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);
|
||||
|
@ -22,6 +22,7 @@
|
||||
; [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]
|
||||
@ -81,3 +82,6 @@ integer resd 1 ; [3]
|
||||
|
||||
; a local integer
|
||||
localint resd 1 ; [6]
|
||||
|
||||
SECTION .rodata
|
||||
readonly dd readonly ; [18]
|
||||
|
Loading…
Reference in New Issue
Block a user