Commit Graph

21268 Commits

Author SHA1 Message Date
svenbarth
32c307e9ce * fix for Mantis #34021: if one of the two operators is an array constructor try to use an operator overload for that first before converting it to a set
+ added tests

git-svn-id: trunk@39554 -
2018-08-03 15:24:59 +00:00
pierre
29d524e7e6 Remove abolute path for native linker, ld is in directory /usr/ccs/bin in Oracle Solaris 10 8/11
git-svn-id: trunk@39541 -
2018-08-01 06:44:26 +00:00
nickysn
42432d4ef3 * use sizeuinttype, instead of ptruinttype for the indexdef conversion in
tcgvecnode.pass_generate_code. This avoids a meaningless conversion to 32-bit
  (and using the cwd instruction) on i8086 in the far data memory models.

git-svn-id: trunk@39472 -
2018-07-19 15:27:14 +00:00
michael
f6867cbd63 * Patch by Cyrax to allow creating map file on linux (bug ID 33982)
git-svn-id: trunk@39449 -
2018-07-14 08:12:38 +00:00
florian
93c5eae528 * accept dereferences in generics definitions, resolves #33700 properly
git-svn-id: trunk@39447 -
2018-07-13 21:00:33 +00:00
florian
52846df241 * fixed condition in getbestreal
git-svn-id: trunk@39446 -
2018-07-13 19:53:47 +00:00
florian
0c6cf12fbf + support for the directive $EXCESSPRECISION
git-svn-id: trunk@39443 -
2018-07-12 21:39:50 +00:00
Jeppe Johansen
3e2be29030 Make sure to align at the end of the .text, in case .data bytes will be placed there in flash.
git-svn-id: trunk@39442 -
2018-07-12 18:52:19 +00:00
nickysn
9272bf59b2 + added x86 (i8086, i386 and x86_64) intrinsics fpc_x86_get_cs/ss/ds/es/fs/gs
for getting the value of x86 segment registers

git-svn-id: trunk@39433 -
2018-07-11 14:19:40 +00:00
florian
d4c65cdac4 * better register de-allocation after CWD/CWB
git-svn-id: trunk@39413 -
2018-07-07 21:38:42 +00:00
florian
4f580f7878 + add missing exit as mentioned by J. Gareth Moreton in #33754
git-svn-id: trunk@39408 -
2018-07-07 14:53:56 +00:00
florian
0eea2141f6 * patch by J. Gareth Moreton: clarity in directive conflict error messages, resolves #33754
git-svn-id: trunk@39407 -
2018-07-07 14:46:01 +00:00
florian
96e92527e9 * constant folding of not must check if the deftype is really an orddef, resolves #33696
git-svn-id: trunk@39406 -
2018-07-07 14:17:41 +00:00
pierre
6cab9fd7db Add replacement of $GCSECTIONS for shared libraries
git-svn-id: trunk@39403 -
2018-07-07 07:22:51 +00:00
svenbarth
441fc2fab6 * also parse postfix operators after parsing a _STRING token (required for class functions on type helpers for String)
+ added tests

git-svn-id: trunk@39399 -
2018-07-06 15:57:11 +00:00
marco
2a80eb3fdd * patch from #31920, pass gc-sections to .so's
git-svn-id: trunk@39392 -
2018-07-06 08:17:10 +00:00
nickysn
ff2fff365f + added x86 compiler intrinsics fpc_x86_sti and fpc_x86_cli, which generate the
'sti' and 'cli' instructions

git-svn-id: trunk@39388 -
2018-07-04 16:48:34 +00:00
nickysn
6cd88a24dc * release al/ax/eax immediately after the 'in', before (instead of after) moving
it to the destination imaginary register. This generates better code.

git-svn-id: trunk@39380 -
2018-07-04 13:09:47 +00:00
nickysn
f34710faa0 + use the in and out instructions with immediate constant port number for ports
that are evaluated as a compile-time constant in the range 0..255

git-svn-id: trunk@39365 -
2018-07-03 20:15:20 +00:00
nickysn
fdc896ad0a + inline support for the x86 'in' and 'out' instructions. Currently only enabled
in the i8086-msdos 'ports' unit, but will be enabled on other targets (e.g.
  go32v2) in the future as well. 32-bit 'in' and 'out' not inlined on i8086, but
  will be on i386 and x86_64.

git-svn-id: trunk@39362 -
2018-07-03 17:01:42 +00:00
florian
b70fc52874 * patch by Ondrej Pokorny: the stored property modifier does not delete the inherited default value anymore, resolves #33564
git-svn-id: trunk@39357 -
2018-07-01 20:11:13 +00:00
florian
eb61923762 * patch by Ondrej Pokorny: The nodefault is now inherited from parent class, resolves #33563
git-svn-id: trunk@39356 -
2018-07-01 19:01:41 +00:00
florian
5782acc32d * patch by J. Gareth Moreton to fix 33909
git-svn-id: trunk@39353 -
2018-07-01 12:54:30 +00:00
Károly Balogh
e7025b6759 another fix for the new warning introduced in r39347, hopefully it fixes win32 build
git-svn-id: trunk@39352 -
2018-06-30 16:51:41 +00:00
florian
6a2cb0bbbd * more compilation fixes
git-svn-id: trunk@39350 -
2018-06-30 12:48:54 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
florian
9af9658fa7 * first parameter of SetLength must be valid, as it is read
git-svn-id: trunk@39347 -
2018-06-30 11:25:43 +00:00
nickysn
e813a11e85 + support TP7-compatible @proc^ (as in FillChar(@proc^,...))
git-svn-id: trunk@39343 -
2018-06-29 14:16:35 +00:00
pierre
c654739db9 Change default settings for i8086 compiler when compiled for go32v2 OS, to avoid use of Watcom tools
git-svn-id: trunk@39340 -
2018-06-29 09:41:38 +00:00
nickysn
88d9dd23ae * the 'again' parameter of factor_read_id() changed to 'out' instead of 'var'
git-svn-id: trunk@39317 -
2018-06-27 15:59:40 +00:00
nickysn
a38e9ff12e * if an include file name ends in dot, and the file is not found, also search
for the file name without the dot. So, for example, if the code contains
  {$I MPAL256.} and 'MPAL256.' is not found, search also for 'MPAL256'

git-svn-id: trunk@39316 -
2018-06-27 14:41:06 +00:00
nickysn
966564aade - removed 'if assigned(code)' before calling code.free in tcgprocinfo.destroy,
since .free already checks for <>nil

git-svn-id: trunk@39312 -
2018-06-27 12:38:58 +00:00
florian
78943ea843 + patch by J. Gareth Moreton: x86 optimisations for Jcc and SETcc, resolves #33899
* optimization also added for i386

git-svn-id: trunk@39307 -
2018-06-25 20:40:05 +00:00
florian
af37ca8563 - remove SetccMovbLeaveRet2SetccLeaveRet optimization, this type of code is not generated anymore for years
git-svn-id: trunk@39306 -
2018-06-25 20:40:04 +00:00
florian
1472a81768 * patch by J. Gareth Moreton to unify the x86 assembler optimizer method headers, resolves #33908
git-svn-id: trunk@39305 -
2018-06-25 20:13:34 +00:00
florian
4aa0ad6735 * use vmov.xx to load float constants if possible
git-svn-id: trunk@39298 -
2018-06-24 12:40:00 +00:00
florian
4f5f3c4a09 + support for vmov.xx vreg,#imm on arm
git-svn-id: trunk@39297 -
2018-06-24 12:39:59 +00:00
svenbarth
a2b58b842b + add support for threadvars in records
+ added tests

git-svn-id: trunk@39289 -
2018-06-23 13:49:16 +00:00
svenbarth
c3ca96279a + add support for threadvars inside classes
+ added tests

git-svn-id: trunk@39288 -
2018-06-23 13:49:12 +00:00
svenbarth
019ebe598a * regenerate msg*.inc files after addition of the message about threadvars inside classes/records without
"class" specifier

git-svn-id: trunk@39287 -
2018-06-23 13:49:08 +00:00
svenbarth
0a45d7a774 + add a message that is used when a threadvar section is started inside a class or record without the "class"
specifier

git-svn-id: trunk@39286 -
2018-06-23 13:49:05 +00:00
svenbarth
89f42fcdae * handle vd_threadvar inside read_record_fields()
git-svn-id: trunk@39285 -
2018-06-23 13:49:01 +00:00
svenbarth
ff407c56d9 * extend scanning of $modeswitch to support not only + and -, but also ON and OFF like other switches
+ added tests

git-svn-id: trunk@39280 -
2018-06-22 21:29:08 +00:00
nickysn
f036e67d8f * fixed the reading of OMF groups by the internal linker. Previously, it only
worked, when the files had only one group, called 'DGROUP'.

git-svn-id: trunk@39279 -
2018-06-22 17:00:23 +00:00
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
f07658d3dc * get rid of TOmfRelocation.GetGroupIndex; instead, read the index property of
the group object. This adds support for groups, other than DGROUP, when
  writing omf relocations.

git-svn-id: trunk@39276 -
2018-06-22 14:29:09 +00:00
nickysn
c8fc7c84c8 * avoid adding a section to a group twice in TOmfObjData.createsection
* add all sections, belonging to a group directly inside TOmfObjOutput.AddGroup,
  based on the TObjSectionsGroup.members array

git-svn-id: trunk@39275 -
2018-06-21 21:14:54 +00:00
nickysn
8a34bd22b8 * pass a TObjSectionGroup object as parameter to TOmfObjOutput.AddGroup, instead
of the group name

git-svn-id: trunk@39273 -
2018-06-21 20:45:52 +00:00
nickysn
d3db9e101a * don't check for the presence of the group in TOmfObjOutput.AddSegmentToGroup,
because, it is no longer possible for it to not be present (all the groups
  are added beforehand now)

git-svn-id: trunk@39272 -
2018-06-21 20:33:24 +00:00
nickysn
9a0eca52cb * changed the type of TOmfObjSection.PrimaryGroup from string to
TObjSectionGroup, so instead of holding the group's name, it now points to the
  TObjSectionGroup object, from which you can retrieve its name or any of the
  other fields and properties it contains

git-svn-id: trunk@39271 -
2018-06-21 16:28:06 +00:00
nickysn
42f06acaeb + also create the primary section group and add the newly created section to it
in TOmfObjData.createsection

git-svn-id: trunk@39270 -
2018-06-21 16:14:42 +00:00
nickysn
f4e26f382f + added an 'index' field to TObjSectionGroup, specifying the index of the group
in the object file (similar to TObjSection.index, but for groups, instead of
  sections). Set the new index field, when writing .obj files with the internal
  omf object writer.

git-svn-id: trunk@39269 -
2018-06-21 15:51:58 +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
svenbarth
3f96c0baed * use reverse_longword() instead of reverse_byte(); fixes the management operators of records inside classes on big endian systems
git-svn-id: trunk@39265 -
2018-06-20 21:11:19 +00:00
svenbarth
af6f094420 + add reverse_longword() function that reverses the bit pattern for a longword, just like reverse_byte() and reverse_word() do for Byte and Word respectively
git-svn-id: trunk@39264 -
2018-06-20 21:10:19 +00:00
svenbarth
fa0765d131 * regenerate msg*.inc files after addition of the warning for array operators
git-svn-id: trunk@39262 -
2018-06-20 19:54:02 +00:00
svenbarth
fa78bb0e89 * warn if the compiler hides an eventual "+" operator overload if modeswitch ArrayOperators is active
git-svn-id: trunk@39261 -
2018-06-20 19:53:56 +00:00
svenbarth
7522a34a67 + add a message that can be used if an internal operator hides an existing operator overload
git-svn-id: trunk@39260 -
2018-06-20 19:53:50 +00:00
svenbarth
97acf24290 + add a new modeswitch ArrayOperators which is set by default in Delphi modes that enables the internal array operators (currently only "+")
git-svn-id: trunk@39259 -
2018-06-20 19:53:43 +00:00
svenbarth
9b45f58c0b + add flags that allow checking for overloads with isbinaryoverloaded() and isunaryoverloaded() without modifying the passed in node or even checking for normally non-overloadable operators
git-svn-id: trunk@39258 -
2018-06-20 19:53:34 +00:00
svenbarth
8536abce8a * as the management operator feature is not platform specific using a specific define for it aside from a
version check is unnecessary, thus remove the FPC_HAS_MANAGEMENT_OPERATOR define and instead check for VER3_0

git-svn-id: trunk@39257 -
2018-06-20 19:00:24 +00:00
svenbarth
ac0322c323 + add a flags field to the record init RTTI which declares whether
a) the current record contains a field with non-trivial initialization
    b) and of the parents contains such a field (only relevant for objects and classes)

git-svn-id: trunk@39255 -
2018-06-20 19:00:17 +00:00
svenbarth
61bde67082 + add method has_non_trivial_init_child() to tdef which provides access to the symtable's
sto_has_non_trivial_init flag

git-svn-id: trunk@39253 -
2018-06-20 19:00:11 +00:00
svenbarth
cc153176f3 + add a new symtable option sto_has_non_trivial_init that is true if the symtable contains a symbol with an
Initialize() operator (like sto_needs_init_final this flag is calculated on demand)
* increase PPU version

git-svn-id: trunk@39252 -
2018-06-20 19:00:08 +00:00
svenbarth
80ed66f349 * move calculation of sto_needs_init_final to a separate method do_init_final_check()
git-svn-id: trunk@39251 -
2018-06-20 19:00:05 +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
5eb69edf9e + support segments (sections) with a primary group, other than 'DGROUP' in the
OMF internal object writer

git-svn-id: trunk@39245 -
2018-06-20 14:57:20 +00:00
florian
0d168796d7 * patch by J. Gareth Moreton: More Peephole optimizations for AND and MOV
git-svn-id: trunk@39242 -
2018-06-18 20:50:08 +00:00
nickysn
7fcec8460f + parse OMF COMENT records when reading object files and produce error messages
for the records that are not supported, but are important for the executable
  being produced (such as weak/lazy externals, etc.)

git-svn-id: trunk@39241 -
2018-06-18 14:48:04 +00:00
florian
a0b343a787 * patch by J. Gareth Moreton for less invasive DEBUG_AOPTCPU
git-svn-id: trunk@39239 -
2018-06-17 14:56:19 +00:00
nickysn
3aff9d6735 * set MemPos to 0 for each debug .MZ section. This fixes all references within
the debug sections themselves.

git-svn-id: trunk@39235 -
2018-06-15 14:49:43 +00:00
svenbarth
22a5e5e4ee * the symbol parsed for "specialize" does not need to be a type; it could be a procsym or some other type (e.g. a constant of the same name in a third unit)
git-svn-id: trunk@39233 -
2018-06-15 13:49:26 +00:00
svenbarth
598ac21791 * if the generic dummy symbol is a procsym (with procdefs added) then this is the symbol that should be resolved to
git-svn-id: trunk@39232 -
2018-06-15 13:49:21 +00:00
svenbarth
8423fd7632 * also process procsyms when adding a symtable as they may be generic dummy symbols as well
git-svn-id: trunk@39231 -
2018-06-15 13:49:16 +00:00
svenbarth
5510b13975 * ensure that sto_has_generic is set when a generic routine has been parsed
git-svn-id: trunk@39230 -
2018-06-15 13:49:03 +00:00
nickysn
84b5265312 + append a TIS trailer after the debug ELF (this helps the watcom debugger find
the beginning of the ELF debug image)

git-svn-id: trunk@39229 -
2018-06-15 13:41:40 +00:00
nickysn
480eedac9f * fix/pretty print the segment and group list with too long segment/group/class
names in the linker map file, produced by the i8086 internal linker

git-svn-id: trunk@39228 -
2018-06-15 00:03:58 +00:00
nickysn
8af56ad6c8 * fixed silly (caused by copy/paste) bug when writing elf section contents in the dwarf debug binary, produced by TMZExeOutput.writeDebugElf
git-svn-id: trunk@39227 -
2018-06-14 16:29:25 +00:00
nickysn
11cf2a6996 * emit a warning, when encountering an omf reference to a section, that has been
removed due to smartlinking

git-svn-id: trunk@39226 -
2018-06-14 16:22:47 +00:00
nickysn
c41f736958 + allow MemPos_EndExeSection to be called with an empty section name
git-svn-id: trunk@39225 -
2018-06-14 16:17:00 +00:00
nickysn
97365abbcf + set the oso_debug flag to dwarf MZ exe sections
git-svn-id: trunk@39224 -
2018-06-14 16:15:11 +00:00
nickysn
239fb25179 + assign an MZExeUnifiedLogicalSegment object to the OMF dwarf sections, so that
OMF relocations work on them too

git-svn-id: trunk@39223 -
2018-06-14 16:03:05 +00:00
nickysn
7103e3cb5c + set the oso_debug section flags when reading an OMF section, which belongs to
the 'DWARF' class

git-svn-id: trunk@39222 -
2018-06-14 15:27:08 +00:00
nickysn
b7bfac11cb + enable using the i8086 internal linker with debug info, if the compiler is
compiled with -di8086_link_intern_debuginfo

git-svn-id: trunk@39221 -
2018-06-14 15:24:39 +00:00
nickysn
5b47bad32a * use uppercase object section names in the OMF linker script for matching the
dwarf debug sections. This is because they are converted to upper case when
  reading (so that we treat omf section names as case-insensitive)

git-svn-id: trunk@39220 -
2018-06-14 15:19:11 +00:00
nickysn
c56ebad183 + implemented writing of dwarf debug info (by calling writeDebugElf) in
TMZExeOutput.writeData. Note that writing i8086 debug info with the internal
  linker is still disabled (i.e. it switches to external linking) in 
  options.TOption.checkoptionscompatibility

git-svn-id: trunk@39219 -
2018-06-14 14:30:59 +00:00
nickysn
29b3ec3fdb * call MaybeSwapHeader and MaybeSwapSecHeader in TMZExeOutput.writeDebugElf, so
the debug ELF file is generated with the correct endianness

git-svn-id: trunk@39218 -
2018-06-14 13:02:54 +00:00
nickysn
b34ab6b279 * The MaybeSwapXXXHeader functions moved from ogelf to the elfbase unit, so they
can be used by TMZExeOutput.writeDebugElf as well

git-svn-id: trunk@39217 -
2018-06-14 13:01:08 +00:00
nickysn
daa47f4b7f + completed the internal debug ELF writer in TMZExeOutput.writeDebugElf (not
enabled yet)

git-svn-id: trunk@39216 -
2018-06-13 16:08:54 +00:00
svenbarth
be0d51d64c * allow $MinEnumSize, $PackSet and $PackRecords to be used with $Push and $Pop
+ added tests

git-svn-id: trunk@39215 -
2018-06-12 19:40:45 +00:00
svenbarth
da672d1344 * instead of using separate booleans use a set to keep track of pending changes for popped settings
git-svn-id: trunk@39214 -
2018-06-12 19:40:41 +00:00
nickysn
b3e4ace4e3 * fixed compilation of .com files in the i8086 tiny memory model, when used with
section based smartlinking

git-svn-id: trunk@39213 -
2018-06-12 00:38:51 +00:00
nickysn
420a57ddc6 * use upper case OMF section names when using i8086 section-based smart linking
git-svn-id: trunk@39212 -
2018-06-12 00:14:08 +00:00
nickysn
b9ab9e5782 + initial (experimental) implementation of section-based smartlinking for i8086.
Use -dI8086_SMARTLINK_SECTIONS to enable.

git-svn-id: trunk@39211 -
2018-06-11 16:56:33 +00:00
nickysn
bfdd75eabf + support AB_LOCAL symbols in OMF object files, by implementing support for
LPUBDEF/LPUBDEF32 OMF records

git-svn-id: trunk@39210 -
2018-06-11 15:29:23 +00:00
nickysn
188e9ff64a * only read the first OMF record in TOmfLibObjectWriter.closefile, since we no
longer copy the entire file there, so we parse the file only to get the module
  name, and the THEADR record should always be the first record in the OMF file.

git-svn-id: trunk@39198 -
2018-06-08 14:21:18 +00:00
nickysn
3f5577077a * automatically create omf libraries with the smallest page size possible. This
greatly reduces the size of i8086 snapshots by keeping the amount of padding
  in the library files to the minimum.

git-svn-id: trunk@39195 -
2018-06-07 22:27:47 +00:00
nickysn
345713c1fa * refactored omf library writing, so that the whole library is written in
TOmfLibObjectWrite.WriteLib, after determining the page size (currently still
  fixed to 512 bytes). Prerequisite for OMF lib page size optimization.

git-svn-id: trunk@39194 -
2018-06-07 22:11:03 +00:00
nickysn
00c6826896 * moved the PageNum property of TOmfLibObjectWriter.TOmfLibDictionaryEntry to
TOmfLibObjectWriter.TOmfLibObjectModule. Instead, store the module index (in
  FObjectModules) in TOmfLibDictionaryEntry. This is a prerequisite for
  implementing OMF library page size optimization.

git-svn-id: trunk@39193 -
2018-06-07 18:32:50 +00:00
nickysn
4bcfe8dbb2 * refactored TOmfLibObjectWriter, so it keeps all object modules in a
TFPObjectList. This will allow implementing omf library page size optimization
  later.

git-svn-id: trunk@39192 -
2018-06-07 15:03:05 +00:00