Commit Graph

119 Commits

Author SHA1 Message Date
nickysn
45337b67fe + when using the i8086 with section based smartlinking, create OMF section
groups, named 'CGROUP' or 'CGROUP_UNITNAME', which include all the code
  sections, that need to be put in the same segment

git-svn-id: trunk@39277 -
2018-06-22 15:02:39 +00:00
nickysn
ab47c8b899 + introduce the omf_section_primary_group function. Use it instead of
section_belongs_to_dgroup, to allow sections to belong to groups, other than
  dgroup.

git-svn-id: trunk@39268 -
2018-06-21 13:21:53 +00:00
nickysn
1631d9ac0a + support segments (sections) with a primary group, other than 'DGROUP' in the
NASM assembler writer

git-svn-id: trunk@39246 -
2018-06-20 16:14:41 +00:00
nickysn
61e6d2afec + introduce asd_omf_linnum_line directives; they will be used for writing LINNUM
entries in the OMF object format

git-svn-id: trunk@39007 -
2018-05-16 17:05:02 +00:00
florian
fa3ee68004 o patch by Dávid Pethes: Fixes for compilation with nasm 2.10 and higher on Win64:
* disable generation of RVA and SECREL32 symbols (according to comment in taiconst_type, they are win32 only)
  * use lowercase cpu names (it was changed from case-insensitive names sometime after 2.10)

git-svn-id: trunk@38579 -
2018-03-20 21:55:01 +00:00
nickysn
1f0e311fdd + allow segment override prefixes to be used as a standalone opcode in the intel
syntax inline assembler; this is TP7 compatible and allows compiling ugly
  code, such as 'seges; db $67,$66; lodsw'

git-svn-id: trunk@38096 -
2018-02-01 17:31:59 +00:00
nickysn
ae92973196 + added support for the retw, retnw, retfw, retd, retnd, retfd, retq, retnq and
retfq x86 instructions. These are variants of the ret instruction with the
  return offset size set explicitly, e.g. retfw is a 16-bit far ret (i.e. pops
  a 16-bit offset and a 16-bit segment), retfd is a 32-bit far ret (pops a
  32-bit offset, followed by a 16-bit segment), etc.

git-svn-id: trunk@37571 -
2017-11-10 16:53:29 +00:00
florian
1556599ad5 * symbols with bind type AB_EXTERNAL_INDIRECT need to be declared as EXTERN for masm/nasm etc.
git-svn-id: trunk@37553 -
2017-11-04 19:10:17 +00:00
nickysn
2af5c9d508 * changed type used for section alignment from byte/shortint to longint, so the
internal object writer and the internal linker support object files with
  sections with alignment >=256

git-svn-id: trunk@37518 -
2017-10-25 15:47:29 +00:00
nickysn
e8bbc4eef9 + support the xlat x86 instruction syntax with a memory operand. This allows
specifying the address size (e.g. xlat byte ptr [bx] or xlat byte ptr [ebx])

git-svn-id: trunk@37478 -
2017-10-17 16:40:06 +00:00
nickysn
4cb1a96ec1 * use get_ref_address_size in the nasm writer, when handling the parameterized
string instructions

git-svn-id: trunk@37471 -
2017-10-16 14:21:03 +00:00
nickysn
acfa199b09 * in the nasm writer, only output a segment prefix for the [si] operand, in
case there's a segment operand, different that DS (the default source
  segment) for parameterized x86 string instructions

git-svn-id: trunk@37459 -
2017-10-14 16:58:15 +00:00
nickysn
4c75b15afe * shortened the names of the is_x86_string_instruction_op,
is_x86_parameterless_string_instruction_op and
  is_x86_parameterized_string_instruction_op by removing 'instruction' from
  their names

git-svn-id: trunk@37451 -
2017-10-12 15:20:22 +00:00
nickysn
e3ca2a3043 + added helper functions get_x86_string_op_si_param and get_x86_string_op_di_param
* use get_x86_string_op_si_param in the nasm writer

git-svn-id: trunk@37450 -
2017-10-12 15:12:40 +00:00
nickysn
2f28768d2d * simplify some code, by using is_x86_parameterized_string_instruction_op
git-svn-id: trunk@37448 -
2017-10-12 13:26:07 +00:00
nickysn
0fb79946a5 + added support for the parameterized versions of the x86 string instructions
(movs, cmps, scas, lods, stos, ins, outs) in the inline asm of the i8086, i386
  and x86_64 targets. Both intel and at&t syntax is supported.
* NEC V20/V30 instruction 'ins' (available only on the i8086 target, because it
  is incompatible with 386+ instructions) renamed 'nec_ins', to avoid conflict
  with the 186+ 'ins' instruction.

git-svn-id: trunk@37446 -
2017-10-12 00:07:02 +00:00
nickysn
c8487c4150 + added individual bits of the x86 flags register as subregisters
git-svn-id: trunk@35955 -
2017-04-26 13:52:52 +00:00
svenbarth
69fa837266 * NASM supports DQ already since version 2.00 (from 10 years ago) and it's already in the ait_const2str array, so use it! (doesn't mean that it works on Win64 however...)
git-svn-id: trunk@35368 -
2017-01-29 17:49:27 +00:00
pierre
40ff777693 * Adapt to TExternCain move to aasmcpu unit
+ Make sure that a lone reference to DGROUP also generates a 'GROUP DGROUP' statement
  + Add %LINE support
  + Add $DEBUG for i8086 nasm

git-svn-id: trunk@34080 -
2016-07-06 07:00:13 +00:00
nickysn
c2305809dc + added an i8086-embedded target support to the compiler (RTL and makefile
support are not done yet)

git-svn-id: trunk@33999 -
2016-06-17 19:15:24 +00:00
florian
90b284e169 + generate .debug_aranges sections for dwarf debug info: enables faster address to debug info translation
git-svn-id: trunk@33454 -
2016-04-08 20:19:59 +00:00
nickysn
5f87ac5d47 + added 486 to the list of supported CPUs on the i8086 and i386 targets
git-svn-id: trunk@33317 -
2016-03-23 15:07:56 +00:00
nickysn
843aee8f4a * base the CPU name, written in the beginning of each NASM assembler file on the
nasm_cpu_name const array, which is used by the asd_cpu directive as well.
+ also enable writing this directive on i386 and x86_64 as well.

git-svn-id: trunk@33140 -
2016-03-01 00:45:51 +00:00
nickysn
ca868b0bc6 * fixed indentation in TX86NasmAssembler.WriteHeader
git-svn-id: trunk@33139 -
2016-03-01 00:40:35 +00:00
nickysn
d0d940f119 * also declare Intel Nehalem and newer CPUs as 'IA64' in the NASM's 'CPU'
directive, because NASM still doesn't support anything newer than 'PRESCOTT'
  for its CPU directive, and 'IA64' is considered (internally by NASM) to be the
  highest CPU level.

git-svn-id: trunk@33137 -
2016-02-29 21:49:28 +00:00
nickysn
1a56a1a026 * make the asd_cpu directive (which is currently only implemented in the NASM
asm writer), when used with a cpu_none parameter, indicate no restrictions for
  the CPU type. Under NASM, this is achieved by specifying 'IA64' as the
  CPU type, since that's the highest CPU, supported by NASM's 'CPU' directive.

git-svn-id: trunk@33136 -
2016-02-29 21:44:55 +00:00
nickysn
178dab45d3 + added new asm directive 'asd_cpu' (specifies the CPU's instruction set) in the
compiler's internal assembly representation. It is not yet generated by the
  compiler and is only implemented properly in the NASM writer (but will
  eventually be implemented in the other assembler writers as well, including
  the internal assembler). In the future, it is intended to allow:
  1) catching instructions, generated by the compiler and not supported by the
     target CPU, due to a bug in the code generator
  2) allowing a different instruction set to be used in inline asm blocks (I'm
     planning a new directive for that - {$asmcpu XXX}), because the code
     generator will be able to switch target CPU in the middle of the asm output
     stream

git-svn-id: trunk@33121 -
2016-02-25 21:47:13 +00:00
Jeppe Johansen
1c0c944311 Added x86_64-embedded target. Patch from Benjamin Rosseaux
git-svn-id: trunk@33097 -
2016-02-14 10:57:00 +00:00
nickysn
995ca4fb12 + implemented the 'SEG @DATA' inline assembler directive for i8086
git-svn-id: trunk@32280 -
2015-11-10 17:26:21 +00:00
nickysn
44b04e250e + implemented support for aitconst_seg (emits a 'DW SEG symbol') in the nasm assembler writer for i8086
git-svn-id: trunk@32250 -
2015-11-05 16:05:22 +00:00
yury
e04a3b4ac6 * Removed unused vars for x86 compiler.
git-svn-id: trunk@31743 -
2015-09-17 15:20:15 +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
Jonas Maebe
b3d0197f98 * factored out the output file handling (mostly writing data) from the
external assembler writer, so we can reuse the archtecture-specific
    writers to write inline assembly in LLVM IR files

git-svn-id: trunk@31625 -
2015-09-12 23:32:01 +00:00
nickysn
e323a08b20 + also write the omf special segment attributes in the nasm writer for the win16 target
+ enabled the internal omf obj writer for the win16 target

git-svn-id: trunk@31576 -
2015-09-07 22:26:14 +00:00
nickysn
1835c075e6 + added win16 to the nasm's supported targets
git-svn-id: trunk@31568 -
2015-09-07 19:00:41 +00:00
nickysn
0fdc62e0f7 + initialize DS with the current unit's data segment in the function entry code
generated in the huge memory model

git-svn-id: trunk@31500 -
2015-09-03 21:44:16 +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
cf144a7fb7 * use a dummy non-nil pointer in FSectionsUsed and FSectionsInDGROUP, because
TFPHashList refuses to add an item with nil pointer data

git-svn-id: trunk@31494 -
2015-09-03 15:14:00 +00:00
nickysn
3b36e3d0b5 * declare segments as use16 or use32 in the nasm asm writer
git-svn-id: trunk@31493 -
2015-09-03 13:57:36 +00:00
nickysn
672ff1d863 * fixed memleak after r31487
git-svn-id: trunk@31492 -
2015-09-03 13:40:00 +00:00
nickysn
314b5e5eac * fixed class name in comment
git-svn-id: trunk@31491 -
2015-09-03 13:36:12 +00:00
nickysn
92c831c3dd * writing of omf section attributes in the NASM asm writer rewritten to use the
new functions in unit omfbase (also used by the internal asm)

git-svn-id: trunk@31487 -
2015-09-03 13:32:17 +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
Jonas Maebe
0d74e4f719 * changed paratargetdbg from a global variable into a field of toption
git-svn-id: trunk@31443 -
2015-08-28 22:31:17 +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
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