Commit Graph

71 Commits

Author SHA1 Message Date
nickysn
778a678956 * use a 4 byte alignment for the dwarf debug sections on i8086 (not sure if
that's correct for 16-bit dwarf, but currently the compiler emits 4-byte
  tai_aligns, so setting the section alignment to 4 avoids problems in the
  internal object writer)

git-svn-id: trunk@30685 -
2015-04-20 13:15:26 +00:00
nickysn
5a1ce6162b * set the bss, rodata and rodata_norel section alignment to 2 bytes for the i8086-msdos target
git-svn-id: trunk@30680 -
2015-04-20 01:27:26 +00:00
nickysn
a6e39edb8f * moved the insertion of fwaits for 8087 from the nasm asm writer to ti8086procinfo.postprocess_code
git-svn-id: trunk@30634 -
2015-04-17 23:27:03 +00:00
nickysn
6a7fff644a * align non-code sections with zeros, instead of nops in the nasm asm output
writer, so they match the behaviour of the internal object writer (so it
  becomes easier to compare to the binary output of the omf object writer)

git-svn-id: trunk@30472 -
2015-04-06 20:30:06 +00:00
nickysn
877a769ac3 + support align directive with a given use_op/fillop in the NASM asm writer
git-svn-id: trunk@30459 -
2015-04-06 01:03:22 +00:00
Jeppe Johansen
e2272c8a7e Added aitconst_gs for AVR pointer references to Flash.
git-svn-id: trunk@30419 -
2015-04-04 10:29:11 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
florian
7c1cf07484 + support section smartlinking with nasm
+ set alignment for smartlinked sections in nasm
* enable section smartlinking for nasm/coff win32

git-svn-id: trunk@29654 -
2015-02-08 12:33:50 +00:00
Károly Balogh
dd67fa8c5c * fixed DFA warnings for i8086
git-svn-id: trunk@28504 -
2014-08-20 15:49:27 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
Jonas Maebe
b0ff41406a * grouped all tai_real* types into a single tai_realconst type,
to free up space for more ait_* types in taitype (can't have
    more than 32 because they have to fit in a small set)
   o factored out writing of floating point numbers as an array of
     byte in the external assemblers

git-svn-id: branches/hlcgllvm@28105 -
2014-07-01 16:29:58 +00:00
nickysn
36d6fb7868 * don't add the stack segment declaration at the beginning of each object file
in the i8086 far data memory models as well

git-svn-id: trunk@28022 -
2014-06-21 10:41:57 +00:00
nickysn
ef88fec688 * nested ifdefs in TX86NasmAssembler.WriteHeader replaced with an 'if defined()'
sequence

git-svn-id: trunk@28019 -
2014-06-21 08:28:15 +00:00
nickysn
40b2d3d562 * don't add the heap segment declaration at the beginning of each object file in
the i8086 far data memory models

git-svn-id: trunk@28018 -
2014-06-21 08:15:18 +00:00
nickysn
7cfd7a66cd + create a special 'heap' segment with reserved space equal to heapsize (i.e.
the value set by -Ch or the second parameter to the $M directive). This is
  equivalent to the heapmin value in Turbo Pascal 7 and ensures that the program
  has at least this amount of heap space available (otherwise DOS will show a
  'not enough memory' error and will refuse to load the program).

git-svn-id: trunk@28002 -
2014-06-19 14:14:01 +00:00
nickysn
22a7dfa231 * stack segment moved outside of dgroup in the i8086 far data memory models, so
it no longer eats from the precious 64kb limit for static data

git-svn-id: trunk@27959 -
2014-06-14 19:34:36 +00:00
nickysn
2dc8839af5 * set class=data to all data segments/sections on i8086
git-svn-id: trunk@27957 -
2014-06-14 16:01:22 +00:00
sergei
c28271ab99 * NASM writer: don't force 'near' size for all non-far branches and calls, it disables NASM's capability to optimize branches into short form where possible, and thus only increases size of generated code.
- LDS and LES instructions do not exist on x86_64.

git-svn-id: trunk@27932 -
2014-06-11 12:32:21 +00:00
nickysn
73d7f2aa18 * let the compiler generate the stack segment in i8086 near data memory models
as well. Even though, in these models, the stack is dynamically allocated
  (because it goes on top of the heap, but the heap is variable size), there are
  still benefits:
  1) the program will run on a larger stack during initialization, before the
     actual stack (and heap) are ready
  2) in cases, when the system is extremely low on memory, DOS will reject to
     load the program if there's not enough memory for the stack the program
     requires. This way the startup code can be further simplified by omitting
     the 'not enough memory' check in the future (when we add the minimum heap
     size to the executable reserved space as well).

git-svn-id: trunk@27903 -
2014-06-08 21:14:57 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows
  setting the stack size in these models with the -Cs option.

git-svn-id: trunk@27820 -
2014-05-27 23:29:50 +00:00
nickysn
efb3cfcbc7 - don't write the default unit code section in the beginning of each asm file,
when using {$hugecode on}, to avoid bogus nasm warnings

git-svn-id: trunk@27623 -
2014-04-21 01:02:21 +00:00
nickysn
597f110eb9 + added support for units with code larger than 64kb in the far code i8086
memory models. Enabled by the new directive {$hugecode on}. The directive is
  ignored in the near code memory models. When enabled, it forces each procedure
  to be in a separate segment and disables mixing near and far procedures (so
  'near' and {$F-} are ignored in this mode). Note that {$hugecode on} does not
  count as a different memory model, because you can freely link modules (units)
  compiled with {$hugecode on} and {$hugecode off}.

git-svn-id: trunk@27615 -
2014-04-20 19:03:14 +00:00
florian
6fd98d604a * compilation fixed
git-svn-id: trunk@27565 -
2014-04-13 19:21:57 +00:00
pierre
816dfa69c1 Avoid new line after lock prefix for nasm
git-svn-id: trunk@27511 -
2014-04-10 14:56:30 +00:00
pierre
e0744b9759 Fix section output for user section in smart mode
git-svn-id: trunk@27510 -
2014-04-10 14:18:48 +00:00
nickysn
17a8c03e41 * declare the group dgroup even in i8086 far data memory models
git-svn-id: trunk@27348 -
2014-03-29 19:35:54 +00:00
Jonas Maebe
80863a8361 * fixed warning/compilation
git-svn-id: trunk@27166 -
2014-03-16 19:46:10 +00:00
sergei
9c54cdc85d * x86: Cleaned out addr_far,addr_far_ref used to encode far calls/jumps. NASM (and FPC x86 assembler based on it) already have opsize=S_FAR for this purpose.
git-svn-id: trunk@27037 -
2014-03-08 22:54:43 +00:00
sergei
f69e6ec389 * Some fixes to NASM writer:
* Correctly output names of sec_user sections and sec_threadvar on Windows targets
  * Use ALIGNB directive to align without warnings in bss and alike sections.
  * Do not output 'begin/end asmlist x' for empty asmlists.

git-svn-id: trunk@26898 -
2014-02-27 13:37:03 +00:00
nickysn
c00b56ae49 * added the -w-orphan-labels parameter to all tasminfo instances for nasm.
The -w-oprhan-labels option prevents the 'label alone on a line without a
  colon might be in error' warning.

git-svn-id: trunk@26889 -
2014-02-26 20:54:38 +00:00
pierre
045f161012 Separate out nasm assembler for i8086, i386 and x86_64 cpus, also separte based on target object format
git-svn-id: trunk@26547 -
2014-01-21 00:26:08 +00:00
nickysn
39c54bf077 * handle ait_varloc in the nasm writer. This allows compiling the system unit
for i8086 with regvars and -sr for debugging purposes.

git-svn-id: trunk@26271 -
2013-12-23 13:27:22 +00:00
nickysn
2d45ea43af * use the 'wait' prefix (on the same line as the instruction), instead of
'db 09bh' (on the previous line) for the fwait prefixed 8087 instructions in
  the nasm assembly output, because it looks prettier this way :)

git-svn-id: trunk@26185 -
2013-12-05 21:31:16 +00:00
nickysn
0020a2ed10 + when targeting the i8087, emit FWAIT prefix manually for the 8087 instructions
that require it in the NASM asm writer, since NASM doesn't do it itself.

git-svn-id: trunk@26107 -
2013-11-19 01:26:57 +00:00
nickysn
9f979eb5c6 * put the i8086-msdos dwarf debug sections in USE32 class=DWARF segments because
wlink wants them this way

git-svn-id: trunk@25873 -
2013-10-27 20:28:43 +00:00
nickysn
e6a4435330 + support the aitconst_XXbit_unaligned const types in the NASM asm writer. This
fixes DWARF support when using NASM.

git-svn-id: trunk@25866 -
2013-10-27 15:21:30 +00:00
nickysn
661e11ecb8 * on i8086 added section .fpc to the group 'dgroup'. This fixes a bug that caused the bss section to not be left out from the executable in tiny model, which caused, ironically, tiny model executables to be larger than the small model executables
git-svn-id: trunk@25525 -
2013-09-21 11:28:01 +00:00
nickysn
f9d0caa7c7 * pass the option -w-orphan-labels to nasm to avoid the spurious warnings about labels without a trailing colon and without an instruction on the same line
git-svn-id: trunk@25358 -
2013-08-23 23:40:24 +00:00
nickysn
511b1f37c1 * write the segment of aitconst_farptr on a separate line to avoid long symbol truncation, due to line length limit; this fixes compilation of sysutils in the medium memory model
git-svn-id: trunk@24879 -
2013-06-12 01:32:18 +00:00
nickysn
9dbbffba61 + added trefaddr.addr_seg for referencing the segment of a symbol
git-svn-id: trunk@24859 -
2013-06-10 01:16:37 +00:00
nickysn
e4a1230356 + added support for far pointer constants in the assembly output
git-svn-id: trunk@24854 -
2013-06-09 22:01:04 +00:00
nickysn
604b7c9deb + added cg.a_call_ref_near and a_call_ref_far
git-svn-id: trunk@24853 -
2013-06-09 20:22:47 +00:00
nickysn
3631198b34 + declare the text segment with class=code in the nasm header for far code memory models also
git-svn-id: trunk@24834 -
2013-06-09 13:01:40 +00:00
nickysn
9a6c242f97 + emit proper far calls/jmps for addr_far in the nasm assembly output
git-svn-id: trunk@24833 -
2013-06-09 12:59:44 +00:00
nickysn
3280514d2b * in i8086 far code models, put the code in a section called module_name+'_TEXT', so each unit gets a separate code segment
git-svn-id: trunk@24831 -
2013-06-09 12:26:33 +00:00
nickysn
b74af9fda0 * declare the text segment with class=code on i8086-msdos
git-svn-id: trunk@24830 -
2013-06-09 12:13:52 +00:00
nickysn
2279e51a95 + added trefaddr.addr_far for emitting far calls
git-svn-id: trunk@24826 -
2013-06-09 10:24:06 +00:00
nickysn
b409d600ee + implemented the tiny memory model for i8086-msdos; we now produce working dos .com files as well
git-svn-id: trunk@24793 -
2013-06-02 23:02:10 +00:00
nickysn
e243b6b869 * never use the 66h prefix when pushing/popping segment registers on i8086, as the stack is aligned on 2 bytes there
git-svn-id: trunk@24729 -
2013-06-01 16:03:14 +00:00
nickysn
c2e3fb5918 + emit proper interrupt procedure entry/exit code on i8086
git-svn-id: trunk@24728 -
2013-06-01 15:50:11 +00:00