yasm/modules/objfmts/bin/tests/multisect/multisect4.asm
Peter Johnson 52affeb01a Add NASM-compatible multi-section binary support to bin object format.
This allows for arbitrary load (LMA) and execution (VMA) addresses.

The following new section attributes are supported:
 - start (LMA start address)
 - follows (follow another section's last LMA)
 - align (LMA alignment)
 - vstart (VMA start address)
 - vfollows (follow another section's last VMA)
 - valign (VMA alignment)
In addition, sections can be designed progbits or nobits.

The following special symbols are generated for program use:
 - section.<sectname>.start (LMA start address)
 - section.<sectname>.vstart (VMA start address)
 - section.<sectname>.length (section length)

The ORG directive adjusts the file offset relative to LMA, so that if
ORG=0x100, a section with LMA=0x100 will be at file offset 0.

VMA addresses are the same as LMA addresses unless otherwise specified.

Full map file support is supported via the [MAP] directive.  The map output
filename can be set either as a parameter to the [MAP] directive or on the
command line with --mapfile=<filename>.  MAP options are BRIEF, SECTIONS,
SEGMENTS, SYMBOLS, and ALL (all of the above).  If no filename is specified
either on the command line or in the source file, the map is output to
standard output.

Full documentation will be added to the Yasm manual in the near future.

This implementation supports several configurations NASM does not, for
instance http://osdir.com/ml/lang.nasm.devel/2004-12/msg00032.html .
It is also fully 64-bit aware.

Fixes: #71, #99.

svn path=/trunk/yasm/; revision=2010
2007-11-14 08:33:32 +00:00

31 lines
687 B
NASM

[map all]
; Memory below 0800h is reserved for the BIOS and the MBR
BSS_START equ 0800h
; PXELINUX needs lots of BSS, so it relocates itself on startup
;%if IS_PXELINUX
TEXT_START equ 9000h
;%else
;TEXT_START equ 7C00h
;%endif
;
; The various sections and their relationship
;
org TEXT_START
times 0x100 db 0x3
section .earlybss nobits start=BSS_START
resb 0x100
section .bcopy32 align=16 follows=.data vfollows=.earlybss
times 0x100 db 0x1
section .bss nobits align=256 vfollows=.bcopy32
resb 0x100
section .text start=TEXT_START
section .data align=16 follows=.text
times 0x100 db 0x2
section .latebss nobits align=16 follows=.bcopy32
resb 0x100