Elf: Allow symbols binding to undefined section
[nasm.git] / rdoff / doc / v1-v2.txt
blob800896bd0cf998bcc999b0a21a962d74ac807e83
1 Differences between RDOFF versions 1 & 2
2 ========================================
4 This document is designed primarily for people maintaining code which
5 uses RDOFF version 1, and would like to upgrade that code to work
6 with version 2.
8 The main changes are summarised here:
10 Overall format
11 ==============
13 The overall format has changed somewhat since version 1, in order
14 to make RDOFF more flexible. After the file type identifier (which
15 has been changed to 'RDOFF2', obviously), there is now a 4 byte
16 integer describing the length of the object module. This allows
17 multiple objects to be concatenated, while the loader can easily
18 build an index of the locations of each object. This isn't as
19 pointless as it sounds; I'm using RDOFF in a microkernel operating
20 system, and this is the ideal way of loading multiple driver modules
21 at boot time.
23 There are also no longer a fixed number of segments; instead there
24 is a list of segments, immediately following the header.
25 Each segment is preceded by a 10 byte header giving information about
26 that segment. This header has the following format:
28 Length  Description
29 2       Type
30 2       Number
31 2       Reserved
32 4       Length
34 'Type' is a number describing what sort of segment it is (eg text, data,
35 comment, debug info). See 'rdoff2.txt' for a list of the segment types.
36 'Number' is the number used to refer to the segment in the header records.
37 Not all segments will be loaded; it is only intended that one code
38 and one data segment will be loaded into memory. It is possible, however,
39 for a loaded segment to contain a reference to an unloaded segment.
40 This is an error, and should be flagged at load time. Or maybe you should
41 load the segment... its up to you, really.
43 The segment's data immediately follows the end of the segment header.
45 HEADER RECORDS
46 ==============
48 All of the header records have changed in this version, but not
49 substantially. Each record type has had a content-length code added,
50 a single byte immediately following the type byte. This contains the
51 length of the rest of the record (excluding the type and length bytes,
52 but including the terminating nulls on any strings in the record).
54 There are two new record types, Segment Relocation (6), and FAR import (7).
55 The record formats are identical to Relocation (1) and import (2). They are
56 only of real use on systems using segmented architectures. Systems using
57 a flat model should treat FAR import (7) exactly the same as an import (2),
58 and should either flag segment relocation as an error, or attempt to figure
59 out whether it is a reference to a code or data symbol, and set the value
60 referenced to the according selector value. I am opting for the former
61 approach, and would recommend that others working on 32 bit flat systems
62 do the same.