diff options
-rw-r--r-- | doc/nasmdoc.src | 8 | ||||
-rw-r--r-- | macros.pl | 2 | ||||
-rw-r--r-- | nasm.h | 2 | ||||
-rw-r--r-- | outcoff.c | 11 |
4 files changed, 20 insertions, 3 deletions
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 53e4b70a..fcf47006 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -3422,6 +3422,10 @@ analogously to \c{code}. Data sections are marked as readable and writable, but not executable. \c{data} declares an initialised data section, whereas \c{bss} declares an uninitialised data section. +\b \c{rdata} declares an initialised data section that is readable +but not writable. Microsoft compilers use this section to place +constants in it. + \b \c{info} defines the section to be an \i{informational section}, which is not included in the executable file by the linker, but may (for example) pass information \e{to} the linker. For example, @@ -3435,7 +3439,8 @@ sections}alignment requirements of the section. The maximum you may specify is 64: the Win32 object file format contains no means to request a greater section alignment than this. If alignment is not explicitly specified, the defaults are 16-byte alignment for code -sections, and 4-byte alignment for data (and BSS) sections. +sections, 8-byte alignment for rdata sections and 4-byte alignment +for data (and BSS) sections. Informational sections get a default alignment of 1 byte (no alignment), though the value does not matter. @@ -3444,6 +3449,7 @@ qualifiers are: \c section .text code align=16 \c section .data data align=4 +\c section .rdata rdata align=8 \c section .bss bss align=4 Any other section name is treated by default like \c{.text}. @@ -18,7 +18,7 @@ open INPUT,$fname || die "unable to open $fname\n"; open OUTPUT,">macros.c" || die "unable to open macros.c\n"; print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" . - " - don't edit it */\n\nstatic char *stdmac[] = {\n"; + " - don't edit it */\n\n#include <stddef.h>\n\nstatic char *stdmac[] = {\n"; while (<INPUT>) { $line++; @@ -13,7 +13,7 @@ #define NASM_MAJOR_VER 0 #define NASM_MINOR_VER 98 -#define NASM_VER "0.98.17" +#define NASM_VER "0.98.18" #ifndef NULL #define NULL 0 @@ -102,6 +102,7 @@ struct Section { #define DATA_FLAGS (win32 ? 0xC0300040L : 0x40L) #define BSS_FLAGS (win32 ? 0xC0300080L : 0x80L) #define INFO_FLAGS 0x00100A00L +#define RDATA_FLAGS (win32 ? 0x40400040L : 0x40L) #define SECT_DELTA 32 static struct Section **sects; @@ -249,6 +250,14 @@ static long coff_section_names (char *name, int pass, int *bits) flags = TEXT_FLAGS; } else if (!nasm_stricmp(q, "data")) { flags = DATA_FLAGS; + } else if (!nasm_stricmp(q, "rdata")) { + if (win32) + flags = RDATA_FLAGS; + else { + flags = DATA_FLAGS; /* gotta do something */ + error (ERR_NONFATAL, "standard COFF does not support" + " read-only data sections"); + } } else if (!nasm_stricmp(q, "bss")) { flags = BSS_FLAGS; } else if (!nasm_stricmp(q, "info")) { @@ -295,6 +304,8 @@ static long coff_section_names (char *name, int pass, int *bits) if (!flags) { if (!strcmp(name, ".data")) flags = DATA_FLAGS; + else if (!strcmp(name, ".rdata")) + flags = RDATA_FLAGS; else if (!strcmp(name, ".bss")) flags = BSS_FLAGS; else |