logo       
Bookmark and Share

follows=, vfollows= and nobits sections: msg#00032

lang.nasm.devel

Subject: follows=, vfollows= and nobits sections

Urk.

I just ran into a *very* real-life problem which shows that some of the assumptions we've made about nobits sections are just plain wrong.

This is an excerpt from my current SYSLINUX development tree:


; 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

section .earlybss nobits start=BSS_START
section .bcopy32 align=16 follows=.data vfollows=.earlybss
section .bss nobits align=256 vfollows=.bcopy32

section .text start=TEXT_START
section .data align=16 follows=.text

section .latebss nobits align=16 follows=.bcopy32


The section .bcopy32 is relocated at runtime, and so has LMA != VMA. There are two different sections following it, quite literally; one after its VMA and one after its LMA.

Anyway, this doesn't currently work; NASM rejects the vfollows= statement on .bss. I'm going to try to fix this, but I haven't groped around too much inside the outbin code.

A few more things: it would be a very useful things to have auto-generated symbols for the vstart as well as the start, and the total length. Although this can be accomplished with carefully positioned symbols, it would be more foolproof if it didn't need it.

Also a thought for people: how hard do you guys think it would be to put a hack in to show the VMA in the list file when using -f bin, instead of the section offset? It would definitely make debugging of NASM-generated code a lot easier, especially when making lots of sections.

Finally, I really think [map] needs to be command-line optionable. It's really awkward for it to be specified inline.

-hpa


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise