Commit Graph

126 Commits

Author SHA1 Message Date
nickysn
e4b77c7aab * accept omf object modules, containing LINNUM and LINNUM32 records in the
i8086-msdos internal linker

git-svn-id: trunk@32382 -
2015-11-20 17:41:35 +00:00
nickysn
30a7875d56 + added hack for supporting linking with .obj files, generated by Borland's
binobj tool with the i8086-msdos internal linker

git-svn-id: trunk@32381 -
2015-11-20 17:40:34 +00:00
nickysn
0d48e5f6c7 + added support to the omf/i8086-msdos internal linker for omf relocation with
location type 3 (fltFarPointer). This isn't generated by nasm, nor by the
  internal object writer (yet), but may be generated by other
  assemblers/compilers - TASM generates it (tested with it), MASM probably also
  does.

git-svn-id: trunk@32346 -
2015-11-16 14:51:05 +00:00
nickysn
b744c83581 + implemented support for omf fixup records with target group other than 'DGROUP' in the i8086-msdos internal linker
git-svn-id: trunk@32294 -
2015-11-12 16:40:17 +00:00
nickysn
7d41d19150 + added an error message when trying to compile a tiny model DOS .COM file with
segment relocations

git-svn-id: trunk@32276 -
2015-11-08 21:13:16 +00:00
Jonas Maebe
5f7b242222 * fixed compilation with -Oodfa/-O3
git-svn-id: trunk@31679 -
2015-09-14 16:10:57 +00:00
Jonas Maebe
991e1f49bd * store a pointer to the used tasminfo record in every assembler writer, so
that we can use assembler writers with different conventions from the
    currently set target_asm (e.g. an x86 assembler writer for inline assembly
    in LLVM IR)

git-svn-id: trunk@31628 -
2015-09-12 23:32:13 +00:00
nickysn
393d86a2e5 + implemented writing proper win16 dll import libraries
git-svn-id: trunk@31532 -
2015-09-05 13:45:23 +00:00
nickysn
1487236f29 + support addr_fardataseg references in the internal asm writer
git-svn-id: trunk@31511 -
2015-09-04 14:33:48 +00:00
nickysn
4a855b140a + support mixing initialized and bss data in the same object section (only in
case the section options contain the new option 'oso_sparse_data') in the
  internal object writer (needed for the huge memory model)

git-svn-id: trunk@31503 -
2015-09-04 13:16:45 +00:00
nickysn
2725b1160b * name the 'FAR_DATA' class segments as module_name+'_DATA'
git-svn-id: trunk@31499 -
2015-09-03 19:00:55 +00:00
nickysn
cfab5d3d3e * the omfbase.omf_segclass const array converted to function in order to be able
to return different names for some sections in the huge memory model

git-svn-id: trunk@31496 -
2015-09-03 17:48:07 +00:00
nickysn
cc2e27b555 * the function which returns the alignment of omf sections moved to unit
omfbase, so it can be used by the nasm asm writer as well

git-svn-id: trunk@31486 -
2015-09-03 12:36:58 +00:00
nickysn
3abfa177c4 * initialization of stack and dwarf debug omf sections moved from
TOmfObjSection.create to TOmfObjData.createsection and is now based on the
  section type (TAsmSectionType) instead of name (string)

git-svn-id: trunk@31485 -
2015-09-03 11:38:51 +00:00
nickysn
efef3882a0 * moved the code for determining whether an omf object section should
belong to group DGROUP to a function in unit omfbase (so it can be used in the
  future by the nasm asm writer as well)

git-svn-id: trunk@31484 -
2015-09-02 16:11:02 +00:00
nickysn
2e6d462ff6 * omf segment class names moved to a const array in omfbase, so they can be used
(in the future) in the nasm asm writer as well

git-svn-id: trunk@31483 -
2015-09-02 14:37:20 +00:00
nickysn
4061628ffb * the i8086-msdos default code segment (in near code memory models) renamed
'_TEXT'. This name is used in object modules, produced by Borland C and Open
  Watcom.

git-svn-id: trunk@31482 -
2015-09-02 13:14:12 +00:00
nickysn
1a8e203bf5 * moved the omf section names constant to the omfbase unit and use it also in
the nasm asm writer when targeting i8086-msdos

git-svn-id: trunk@31481 -
2015-09-02 12:28:46 +00:00
nickysn
919cc8377a + added class type property CObjSymbol to TExeOutput as well
git-svn-id: trunk@31426 -
2015-08-25 16:07:59 +00:00
nickysn
19aab3fd31 + i8086-msdos internal linker: write symbol addresses in segment:offset format in the linker map file
git-svn-id: trunk@31425 -
2015-08-25 14:48:08 +00:00
nickysn
f41692710f - removed bogus comment from TMZExeUnifiedLogicalSegment.CalcMemPos
git-svn-id: trunk@31423 -
2015-08-25 14:04:51 +00:00
nickysn
2467cb34c2 * fixed MemBasePos calculation for segments that go beyond the previous segment base
git-svn-id: trunk@31421 -
2015-08-25 13:06:50 +00:00
nickysn
2c05bcc28f + i8086-msdos internal linker: in the far data memory models, fill
MaxExtraParagraphs in the MZ exe header according to the specified max heap
  size

git-svn-id: trunk@31420 -
2015-08-25 11:40:02 +00:00
nickysn
dad0f015a9 - removed the TOmfObjSectionGroup class, because it is not used
git-svn-id: trunk@31419 -
2015-08-25 11:32:30 +00:00
nickysn
6e20e0fc84 + added checks and error messages in case a 16-bit segment or group exceeds 64k
git-svn-id: trunk@31416 -
2015-08-25 01:01:20 +00:00
nickysn
851ebd9850 * use a normalized MemBasePos (i.e. offset<16) for stack segments
git-svn-id: trunk@31415 -
2015-08-25 00:29:02 +00:00
nickysn
fb1be14337 * yet another fix for the MZ relocation offsets
+ support RELOC_SEG and RELOC_SEGREL relocations pointing to an object section

git-svn-id: trunk@31412 -
2015-08-24 23:40:07 +00:00
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