Table of Contents
The win32 object format generates
Microsoft Win32 object files
for use on the 32-bit native Windows XP (and Vista) platforms. Object files produced using this
object format may be linked with 32-bit Microsoft linkers such as Visual Studio in order to produce 32-bit PE executables.
The win32 object format provides a default output
filename extension of .obj.
Note that although Microsoft say that Win32 object files follow the COFF (Common Object File Format) standard, the object files
produced by Microsoft Win32 compilers are not compatible with COFF linkers such as
DJGPP’s, and vice versa. This is due to a difference of opinion over the precise
semantics of PC-relative relocations. To produce COFF files suitable for DJGPP, use the
coff output format; conversely, the coff format does not produce object files that Win32 linkers can
generate correct output from.
The
win32 object format allows you to specify additional
information on the SECTION directive line, to control the
type and properties of sections you declare. Section types and properties are generated
automatically by Yasm for the standard section names .text, .data and .bss, but may still be
overridden by these qualifiers.
The available qualifiers are:
code or textdata or bsscode. Data sections are marked as readable and writable, but not
executable. data declares an initialized data section,
whereas bss declares an uninitialized data section.rdatainfoinfo-type section called .drectve causes the linker to
interpret the contents of the section as command-line options.align=nOther qualifiers are supported which control specific section flags: discard, cache, page, share, execute, read, write, and base. Each of these sets
the similarly-named section flag, while prefixing them with no clears the corresponding section flag; e.g. nodiscard clears the discard flag.
The defaults assumed by Yasm if you do not specify the above qualifiers are:
section .text code align=16 section .data data align=4 section .rdata rdata align=8 section .rodata rdata align=8 section .rdata$ rdata align=8 section .bss bss align=4 section .drectve info section .comment info
Any other section name is treated by default like .text.