summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--segelf.txt72
1 files changed, 71 insertions, 1 deletions
diff --git a/segelf.txt b/segelf.txt
index 2cc81f7..740cd60 100644
--- a/segelf.txt
+++ b/segelf.txt
@@ -261,7 +261,7 @@ symbol. One way to make that happen is to add these as local symbols
with an absolute value of zero, as described in section 1.
-4 Use of relocations
+3. Use of relocations
---------------------
This documentation section uses NASM syntax assembly and assumees the
@@ -327,6 +327,76 @@ R_386_32; when linking PIC or PIE code, R_386_SEG16 is converted to
R_386_SEGRELATIVE just as R_386_32 is converted to R_386_RELATIVE.
+5. Dynamic section tags
+-----------------------
+
+The following dynamic section tags are allocated out of the
+OS-specific range. These are mainly indended to support creation of
+MS-DOS .exe files, but might have other uses; in some applications
+some but not all of these may be present. The program elf2exe included
+with the sample code (see section V) uses these tags.
+
+In equations below, v(tag) refers to the value associated with that
+tag. Unless otherwise stated below, a missing tag value should be
+treated as 0.
+
+
+ 0x6bb31701 DT_E2E_FILESIZE
+
+ The total size on disk (equivalent to p_filesz in a
+ PT_LOAD PHDR.)
+
+ If this is not provided, this should be taken to be
+ MAX(p_paddr + p_filesz) of all PT_LOAD PHDRs.
+
+ 0x6bb31702 DT_E2E_MEMSIZE
+
+ The total size in memory including nobits sections;
+ (equivalent to p_memsz in a PT_LOAD PHDR.)
+
+ If this is not provided, this should be taken to be
+ MAX(p_paddr + p_memsz) of all PT_LOAD PHDRs.
+
+ 0x6bb31703 DT_E2E_ENTSEG
+
+ The segment base for the entry point.
+
+ 0x6bb31704 DT_E2E_STKSEG
+
+ The segment base for the stack pointer.
+
+ 0x6bb31705 DT_E2E_STKBASE
+
+ The base address of the stack.
+
+ 0x6bb31706 DT_E2E_STKSIZE
+
+ The size of the stack.
+
+ 0x6bb31707 DT_E2E_OPTMEM
+
+ The amount of additional memory to request, but not
+ demand, from the operating system.; in the case of
+ MS-DOS, the operating system will allocate at least
+ v(DT_E2E_MEMSIZE) bytes, but no more than
+ v(DT_E2E_MEMSIZE) + v(DT_E2E_OPTMEM) bytes (possibly
+ rounded.)
+
+
+The initial CS:IP is calculated as:
+
+ CS = v(DT_E2E_ENTSEG) >> 4
+ IP = e_entry - v(DT_E2E_ENTSEG)
+
+The initial SS:SP is calculated as:
+
+ SS = v(DT_E2E_STKSEG) >> 4
+ SP = v(DT_E2E_STKBASE) + v(DT_E2E_STKSIZE) - v(DT_E2E_STKSEG)
+
+Note that MS-DOS does not zero nobits sections in the loader; this has
+to be done in the program initialization code.
+
+
V. Sample code
--------------