Commit Graph

99 Commits

Author SHA1 Message Date
nickysn
faa9362b44 + calculate and fill "min extra paragraphs" in the MZ header
git-svn-id: trunk@31403 -
2015-08-24 21:33:26 +00:00
nickysn
2100714ebe + implemented RELOC_SEG and RELOC_SEGREL fixups for a symbol target
* bug fix in the MZ relocation generated for RELOC_DGROUP/RELOC_DGROUPREL
  relocations
* reduced code duplication in TMZExeOutput.DoRelocationFixup a little by using
  nested procedures

git-svn-id: trunk@31401 -
2015-08-24 21:12:26 +00:00
nickysn
0eb1cd157a * don't subtract two from the end of the stack segment when calculating the
initial SP value - seems to be wlink compatible

git-svn-id: trunk@31399 -
2015-08-24 20:22:01 +00:00
nickysn
2431b6e63b * i8086-msdos internal linker: use a different approach for finding the stack
segment - either its class name must be 'STACK' (wlink compatible) or its
  combine type must be scStack (tlink compatible)

git-svn-id: trunk@31398 -
2015-08-24 20:18:44 +00:00
nickysn
d2a47a7c69 + fill the initial stack address in the MZ exe header
git-svn-id: trunk@31396 -
2015-08-24 18:28:00 +00:00
nickysn
18cdc08c26 + prevent certain special omf sections from being smartlinked out
git-svn-id: trunk@31394 -
2015-08-24 18:10:50 +00:00
nickysn
fe69e3324c + implemented RELOC_DGROUP and RELOC_DGROUPREL in TMZExeOutput.DoRelocationFixup
git-svn-id: trunk@31393 -
2015-08-24 17:55:44 +00:00
nickysn
0eda4c954d + handle omf references to a segment with frame method=target
git-svn-id: trunk@31392 -
2015-08-24 17:34:04 +00:00
nickysn
e88dc71983 + import DGROUP omf fixup references
git-svn-id: trunk@31390 -
2015-08-24 16:53:44 +00:00
nickysn
73ea3b7ff1 + implemented fixups targeting a logical segment offset in the omf internal linker
git-svn-id: trunk@31389 -
2015-08-24 15:50:47 +00:00
nickysn
3d3eb6c472 * stop with an error when encountering omf fixups that aren't yet implemented
git-svn-id: trunk@31388 -
2015-08-24 15:20:59 +00:00
nickysn
d7f08866e5 * use the TMZExeOutput.MZFlatContentSection property in TInternalLinkerMsDos.GetTotalSizeForSegmentClass
instead of finding the exe section by name

git-svn-id: trunk@31387 -
2015-08-24 15:09:35 +00:00
nickysn
449506ffb7 + write mz exe section data
+ fill MaxExtraParagraphs in the MZ header with $ffff by default, to prevent DOS
  from loading the program at the highest possible address

git-svn-id: trunk@31386 -
2015-08-24 15:02:37 +00:00
nickysn
fdbfaacec8 + calculate the MZ loadable image size (excluding bss, stack and heap)
+ only write the loadable image size number of bytes to .com files

git-svn-id: trunk@31385 -
2015-08-24 14:42:43 +00:00
nickysn
a7e63581b4 + i8086-msdos internal lniker: find the program entry point and fill it in the
mz exe header; also write it in the linker map file

git-svn-id: trunk@31384 -
2015-08-24 14:22:17 +00:00
nickysn
e0bd25191e + also take into account the frame method when converting the omf start address to a symbol
git-svn-id: trunk@31383 -
2015-08-24 13:46:37 +00:00
nickysn
cff94639d5 * i8086-msdos internal linker: improved handling of the _edata and _end internal
symbols - add them to 'DGROUP' and define them in a section with class 'BSS'

git-svn-id: trunk@31382 -
2015-08-24 12:39:39 +00:00
nickysn
989afc6ecb * show section addresses relative to the segment's MemBasePos in the i8086-msdos
internal linker map file

git-svn-id: trunk@31380 -
2015-08-24 01:31:16 +00:00
nickysn
fa8841d575 + support omf group-relative fixups pointing to external symbol (e.g.
'wrt dgroup' references)
- removed debug code from TMZExeOutput.DoRelocationFixup

git-svn-id: trunk@31378 -
2015-08-24 00:55:56 +00:00
nickysn
173713ce57 * preserve original order (as specified in the link script) of omf sections with
the same name. This ensures that the startup code always comes first, which is
  important for .com files

git-svn-id: trunk@31377 -
2015-08-24 00:30:24 +00:00
nickysn
f08e98bfd0 + partial implementation of DoRelocationFixups for the i8086-msdos internal linker
git-svn-id: trunk@31375 -
2015-08-24 00:23:56 +00:00
nickysn
78cbb1ba2b + implemented writing .com files in the i8086-msdos internal linker
git-svn-id: trunk@31374 -
2015-08-23 22:06:30 +00:00
nickysn
fa9a1f706b + i8086-msdos internal linker: calculate the final segments and groups locations
in memory (incl. segment bases) before DoRelocations; list segments and groups
  in the map file as well

git-svn-id: trunk@31373 -
2015-08-23 21:36:24 +00:00
nickysn
5dc42404cf * capitalize omf segment class names, as that's how other 16-bit compilers write them
git-svn-id: trunk@31371 -
2015-08-22 19:07:04 +00:00
nickysn
e09ab50724 * capitalize the group name 'DGROUP' in the generated omf object files, because
that's how it is usually written by other 16-bit compilers

git-svn-id: trunk@31369 -
2015-08-22 16:28:36 +00:00
nickysn
70677e3e44 + added a descendant class for omf section groups, which adds base address, size
and a method to calculate these new fields

git-svn-id: trunk@31363 -
2015-08-22 12:23:49 +00:00
nickysn
9aeb94676c + added virtual method to tobjsection for returning a string representation of
the section's base address for the internal linker map file
* implemented it for omf sections to return the address in 'seg:ofs' format

git-svn-id: trunk@31359 -
2015-08-21 16:21:16 +00:00
nickysn
808b5dfb78 * allow gaps between LEDATA records, as nasm seems to produce them. They're
automatically filled with zeros. This fixes reading of the tiny memory model
  startup code object module by the i8086-msdos internal linker.

git-svn-id: trunk@31354 -
2015-08-20 22:57:15 +00:00
nickysn
1b9eeee25d + order omf sections first by classname, then by name
git-svn-id: trunk@31352 -
2015-08-20 21:21:52 +00:00
nickysn
7d586df038 * override DoRelocationFixup in TMZExeOutput - doing nothing for now, but
prevents the "abstract method called" error

git-svn-id: trunk@31350 -
2015-08-20 20:55:24 +00:00
nickysn
0fb92b803b * set the MZ exe section limit to 640k
git-svn-id: trunk@31348 -
2015-08-20 15:01:39 +00:00
nickysn
07fff73527 * fixed the "Incompatible section options" error when using the omf internal linker to produce msdos executables
git-svn-id: trunk@31347 -
2015-08-20 14:50:59 +00:00
nickysn
a4c188ff01 + partial implementation of omf fixup reading
git-svn-id: trunk@31346 -
2015-08-19 15:55:03 +00:00
nickysn
6d6ed840a4 * set the data record start offset of the omf fixup object when reading omf fixups
git-svn-id: trunk@31342 -
2015-08-18 15:18:03 +00:00
nickysn
cbc676e80e * ignore case (i.e. always convert to upper case) in omf segment/class/overlay/group names
git-svn-id: trunk@31340 -
2015-08-18 14:41:29 +00:00
nickysn
d4b0b6f6e6 * use SegmentName+'||'+ClassName for the name of OMF sections when reading OMF
files, because omf segments are (according to the spec) identified by the
  tuple <SegmentName,ClassName,OverlayName> and not just by name (and we ignore
  the overlay name)

git-svn-id: trunk@31339 -
2015-08-18 14:31:59 +00:00
nickysn
9ff0057a94 * return true if TOmfObjInput.ReadObjData is successful
git-svn-id: trunk@31336 -
2015-08-17 12:25:59 +00:00
nickysn
ef207475fd + parse omf modend records and add symbol for module start address
git-svn-id: trunk@31324 -
2015-08-14 15:42:43 +00:00
nickysn
e59c164844 + parse FIXUPP records in the omf object reader (although converting them TOmfRelocation is not yet implemented)
git-svn-id: trunk@31320 -
2015-08-13 13:44:46 +00:00
nickysn
0cd1a88588 * fixed memory leak in TOmfObjInput.ReadExtDef
git-svn-id: trunk@31313 -
2015-08-11 13:39:26 +00:00
nickysn
9fc100574c + added property TObjSymbol.group for use with the omf object format
git-svn-id: trunk@31312 -
2015-08-11 13:38:28 +00:00
nickysn
c50991713c + implemented reading of omf public names
git-svn-id: trunk@31311 -
2015-08-11 13:04:22 +00:00
marco
8d145ce706 * initialize secalign before case statement to avoid warning. Mantis #28326
git-svn-id: trunk@31145 -
2015-06-22 11:48:42 +00:00
nickysn
318874837f + implemented 16-bit dos MZ exe header writer
git-svn-id: trunk@31002 -
2015-06-07 14:31:02 +00:00
nickysn
2c1049b5d4 + read the LEDATA omf records (i.e. the actual section data)
git-svn-id: trunk@30975 -
2015-06-04 23:03:22 +00:00
nickysn
d0d3cef868 + implemented reading of omf extdef (external symbols) records
git-svn-id: trunk@30973 -
2015-06-03 13:07:48 +00:00
nickysn
096743d74d + also read the omf segment size and set objsec.Size
git-svn-id: trunk@30971 -
2015-06-01 23:31:53 +00:00
nickysn
1cae939615 + implemented parsing of omf group definitions as well
git-svn-id: trunk@30970 -
2015-06-01 23:03:48 +00:00
nickysn
5539d6366f + implemented reading of SEGDEF omf records
git-svn-id: trunk@30969 -
2015-06-01 21:28:55 +00:00
nickysn
28f7f16fc7 + implemented reading of the LNAMES omf record
git-svn-id: trunk@30968 -
2015-06-01 14:25:51 +00:00