Commit Graph

99 Commits

Author SHA1 Message Date
marco
2b9ddf3bee # revisions: 45519,46865,46918
git-svn-id: branches/fixes_3_2@47095 -
2020-10-11 15:53:29 +00:00
Jonas Maebe
76045bfc04 * merged macOS/AArch64 support + revisions these changes depended on
git-svn-id: branches/fixes_3_2@46866 -
2020-09-15 19:40:36 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
Jonas Maebe
cb7730a423 * fixed execution order of implicit finalization and class destructors: first
the latter, then the former

git-svn-id: trunk@38716 -
2018-04-08 15:41:00 +00:00
pierre
34c0898d97 Fix m68k-amiga linking failure for native compiler, due conflict between odd length string and .balignw directive
git-svn-id: trunk@38351 -
2018-02-26 13:06:37 +00:00
Jonas Maebe
c0b0fa9c0b * change the type of the -gt uninitialised result of ansistring functions to
rawbytestring so the compiler does not try to convert it to the declared
    string type of the function result, as this may not be available
    (mantis #32510)

git-svn-id: trunk@37889 -
2018-01-01 18:04:13 +00:00
svenbarth
a301bf75ea * ngenutil.tnodeutils.sym_maybe_initialize: don't use "is" operator, but corresponding is_* functions
git-svn-id: trunk@36617 -
2017-06-29 18:51:35 +00:00
Károly Balogh
dd01b7ca8b fix a typo to hopefully fix the build
git-svn-id: trunk@36312 -
2017-05-23 21:13:00 +00:00
svenbarth
7c9aeda656 * rework InsertInitFinalTable a bit more so that the list of init/fini entries does not need to be generated twice for AVR
git-svn-id: trunk@36310 -
2017-05-23 19:58:39 +00:00
svenbarth
d311881b34 * extract calculation of unit init/fini entries into separate method get_init_final_list() so that it can be used by the AVR code as well
git-svn-id: trunk@36257 -
2017-05-19 16:12:22 +00:00
nickysn
efc5e339d0 * use an enum instead of integer constants to represent inline numbers
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
  their enum name, instead of number

git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
cadf177a93 * fixed bugs in r33737: that revision was supposed to only move
code from one unit to another, but in splitting some methods
    I made a couple of mistakes :/ (causing global variables to be
    initialised three times)

git-svn-id: trunk@35461 -
2017-02-20 22:15:34 +00:00
maciej-izak
9441fb3968 * ngenutil.pas, tnodeutils.sym_maybe_initialize: Ensure that management operator (Initialize) is used also for local variables.
git-svn-id: trunk@35443 -
2017-02-18 19:19:46 +00:00
svenbarth
1a6a8b7c9f + introduce a new potype for the main stub of a package library (which on Windows is simply a DLLMain returning True)
git-svn-id: trunk@35371 -
2017-01-29 22:37:40 +00:00
florian
29a2c433f7 * -Sr option for iso mode: in case no command line parameter is passed, the file name for program parameters is derived from their variable name
git-svn-id: trunk@35257 -
2017-01-07 14:50:58 +00:00
Jonas Maebe
472b5228fe * changed ncgutil.has_alias_name(pd,s) to a method of tprocdef
git-svn-id: trunk@35085 -
2016-12-09 13:39:28 +00:00
nickysn
d28963f434 * emit the heap and stack sizes via Tai_const.Create_int_dataptr, instead of
using create_pint

git-svn-id: trunk@34646 -
2016-10-07 20:58:50 +00:00
nickysn
bacea005fc * emit a sizeint, not a ptruint for TableCount in tnodeutils.InsertRuntimeInitsTablesTable as well
git-svn-id: trunk@34643 -
2016-10-07 17:21:52 +00:00
nickysn
16dfb839d8 * emit a sizeint, not a ptruint for TableCount in tnodeutils.InsertResourceTablesTable
git-svn-id: trunk@34638 -
2016-10-07 13:49:48 +00:00
nickysn
f6356e03e4 * use aluuinttype, instead of sinttype, when emitting TableCount and InitCount
for the InitFinalTable, because they are declared as ALUUInt in the RTL and
  sinttype doesn't always correspond to the ALU size (it differs on platforms
  with the combination of a 64-bit ALU and 32-bit address space)

git-svn-id: trunk@34629 -
2016-10-04 22:57:06 +00:00
Jonas Maebe
473cec9d85 * converted tnodeutils.InsertRuntimeInits() to the high level typed const
builder

git-svn-id: trunk@34443 -
2016-09-07 16:09:06 +00:00
yury
e3d9dbbeef * Removed unused vars.
git-svn-id: trunk@34404 -
2016-09-01 19:55:45 +00:00
Jonas Maebe
18d728eb72 * ensure that local variables and parameters moved to a parentfpstruct aren't
initialised and finalised twice (once at their original location, and once
    when the parentfpstruct is initialised/finalised)

git-svn-id: trunk@34374 -
2016-08-24 16:41:07 +00:00
Jonas Maebe
a31ca58593 * factored out the loading the function result from the parentfpstruct into
its original location so it can be reused elsewhere too

git-svn-id: trunk@34304 -
2016-08-13 14:47:47 +00:00
svenbarth
6b7f55cc77 * import the class con-/destructor symbol into the *current* unit not into the unit the symbol comes from
git-svn-id: trunk@34251 -
2016-08-05 13:48:27 +00:00
svenbarth
ccb4b23949 * register the start and end symbols of resource strings in the extern assembler list of the program/library
* export the start and end symbols of resource strings from the package

git-svn-id: trunk@34186 -
2016-07-22 16:03:16 +00:00
svenbarth
947c876ba3 * use the indirect start and end symbols for the resource string table (affects both the compiler and the RTL)
git-svn-id: trunk@34185 -
2016-07-22 16:01:39 +00:00
svenbarth
4df4449933 Extend the ttypedconstbuilder's dead_stripe_section handling (get_vectorized_dead_strip_section_symbol() and finalize_vectorized_dead_strip_asmlist()) with the ability to
- register a symbol in the unit's public or extern asm symbol list
 - add an indirect symbol when defining the symbol
 - use an indirect symbol instead of the direct one
This will be needed to correctly handle resourcestrings for packages

git-svn-id: trunk@34182 -
2016-07-22 15:55:14 +00:00
svenbarth
f69b365b77 * declare various symbols as external assembler symbols: RTTI references, parent VMT, FPC_EMPTYMETHOD (all three only if it's used from a different unit), threadvar lists and symbols declared as "external"
git-svn-id: trunk@34176 -
2016-07-22 13:34:38 +00:00
svenbarth
bb72c1c4df * declare various assembler symbols (VMT, RTTI, threadvars) as public assembler symbols
* declare public function alias as public assembler symbols

git-svn-id: trunk@34175 -
2016-07-22 13:11:24 +00:00
Jonas Maebe
a0efde8167 * automatically generate necessary indirect symbols when a new assembler
symbol is defined
   o removed all places where AB_INDIRECT symbols were explicitly generated
   o only generate AB_INDIRECT symbols for AT_DATA on systems_indirect_var_imports
   o for some symbols an indirect symbol is always required (because they are
     dereferenced by code in RTL units) -> use new AT_DATA_FORCEINDIRECT type

git-svn-id: trunk@34165 -
2016-07-20 20:53:03 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
svenbarth
72be688a8c A unit's threadvar list needs to be indirectly referenced by the THREADVARLIST as well.
compiler/ngenutil.pas, tnodeutils:
  * InsertThreadvarTablesTable: reference a unit's (and the program's) threadvar table using a indirect symbol
  * InsertThreadvars: generate an indirect symbol for the threadvar table
rtl/inc/threadvr.inc:
  * TltvInitTablesTable: add an additional indirection for the tables field

git-svn-id: trunk@34043 -
2016-07-01 14:18:28 +00:00
svenbarth
ca07a4f86f Merged revision(s) 32491-32492 from branches/svenbarth/packages:
Adjust non-Windows resources to work with indirect main information as well.

rtl/inc/systemh.inc, TEntryInformation:
  + new cross platform field ResLocation which stores the pointer to the resources
rtl/inc/intres.inc:
  * change the type of ResHeader from PResHdr to PPResHdr (and adjust code that uses it accordingly; Note: the first dereferencing is assumed to be always valid!)
  * adjust declaration of ResHeader depending on whether indirect main information is used or not
rtl/darwin/sysinit.pas & rtl/linux/si_impl.inc:
  * pass the location of the resources through SysInitEntryInformation
rtl/bsd/system.pp & rtl/linux/system.pp:
  + new public variable FPCResLocation which is setup by SysEntry
rtl/win32/sysinit.inc:
  * initialize ResLocation of SysInitEntryInformation as Nil
rtl/win32/system.pp:
  * initialize ResLocation of EntryInformation as Nil
........
For systems that support both internal and external resources (in this case only Darwin ones) we need to generate the FPC_RESLOCATION symbol always, because the SysInit unit is resource type agnostic.

ngenutil.pas, tnodeutils:
  * InsertResourceInfo: generate FPC_RESLOCATION symbol pointing to 0 in case the program is compiled on Darwin with resources set to external ones (-We)

git-svn-id: trunk@33952 -
2016-06-12 09:08:17 +00:00
nickysn
c78f406d99 + implemented proper stack checking for the i8086
git-svn-id: trunk@33787 -
2016-05-24 23:57:47 +00:00
pierre
4ff01e1f41 Modify tnodeutils.insertbsssym method to generate indirect symbol only if flags contains tf_supports_packages
git-svn-id: trunk@33762 -
2016-05-23 15:31:18 +00:00
Jonas Maebe
fe5cf94e10 * moved generation of initialisation/finalisation nodes from the code
generator to psub and ngenutil
   o removed dependence of hlcgobj on pass_1

git-svn-id: trunk@33737 -
2016-05-21 14:48:34 +00:00
svenbarth
86478fa781 Fix the handling of imports of the init and finalize functions now that the symbols are correctly registered
ngenutil.pas, tnodeutils:
  * InsertInitFinalTable: the init and finalize functions are in the *local* symboltable not the global one
  * InsertInitFinalTable.add_initfinal_import: reenable the internal error

git-svn-id: trunk@33508 -
2016-04-14 21:32:53 +00:00
svenbarth
e2b1f70ac6 Local symbols and defs that are needed for packages need to be registered as well => register the symbols and defs for the init and finalize functions.
pmodules.pas:
  * create_main_proc: register the proc's symbol
ngenutil.pas, tnodeutils:
  * create_main_procdef: register the proc's def

git-svn-id: trunk@33507 -
2016-04-14 21:30:36 +00:00
svenbarth
bd82059f0e Fix cycling.
ngenutil.pas, tnodeutils.InsertInitFinalTable:
  * add_initfinal_import: disable the internal error until I've found out why the INIT$ function isn't there

git-svn-id: trunk@33504 -
2016-04-14 20:51:06 +00:00
svenbarth
35809b58f8 Merged revision(s) 28856 from branches/svenbarth/packages:
Also add the initialization/finalization sections and the class constructors/destructors to the imported symbols of the current program/library.

ngenutil.pas, tnodeutils.InsertInitFinalTable:
  + new function add_initfinal_import to find the procsym for the initialization/finalization code and to add it to the imported unit symbols
  * write_struct_inits: import the found class constructor/destructor symbols if they are not in the program/library unit
  * use add_initfinal_import for the initialization and finalization sections of all used units beside the program/library unit
........

git-svn-id: trunk@33501 -
2016-04-14 19:47:19 +00:00
svenbarth
6722c611cf Generate indirect symbols for global variables and (typed) constants.
Note: It needs to be checked what adjustments will need to be done for JVM and LLVM

Note 2: The indirect symbols will always be generated even if the target won't use them so that assembler code can be consistent among the targets (e.g. i386-win32 needs them while i386-linux does not)

ptconst.pas, read_typed_const:
  * generate the indirect symbol in a read only data section
ngenutil.pas, tnodeutils:
  * insertbsssym: generate the indirect symbol in a read only data section

git-svn-id: trunk@33279 -
2016-03-18 21:40:11 +00:00
Jonas Maebe
0e97811b50 + initialise managed string function results with an error string when
compiling with -gt (mantis #28948)

git-svn-id: trunk@33198 -
2016-03-06 17:22:11 +00:00
Jonas Maebe
5f14029e74 * if a function result has been migrated to the parentfpstruct because it is
accessed by a nested routine, assign it back to the original funcretsym
    at the end because the code generator is hardcoded to use funcretsym.
    We can't replace funcretsym with an absolutevarsym that redirects to
    the parentfpstruct field, because the code generator can only handle
    simple variables

git-svn-id: trunk@32687 -
2015-12-20 20:56:08 +00:00
yury
17358aa3ed * Removed unused local vars.
git-svn-id: trunk@32537 -
2015-11-26 17:15:04 +00:00
Jonas Maebe
eefcbaff69 * converted tnodeutils.InsertResourceInfo to the high level typed constant
builder and enabled it for llvm

git-svn-id: trunk@32532 -
2015-11-25 22:25:48 +00:00
Jonas Maebe
416894f206 * converted tnodeutils.InsertResourceTablesTable() to the high level typed
const builder
   o also put the resourcestring tables table in rodata instead of in data,
     since it doesn't change at run time (unlike the individual resourcestring
     tables)

git-svn-id: trunk@32397 -
2015-11-21 12:36:16 +00:00
Jonas Maebe
96b529072a * factored out generating the start and end of a vectorized dead strippable
section to the high level typed const builder, and use this functionality
    for the resource strings (generating items: todo)
  * fixed dead stripping unused resource strings (all string data was put in the
    same section since r30342)

git-svn-id: trunk@32394 -
2015-11-21 12:36:06 +00:00
Jonas Maebe
964f8c9f9b * factored out the creation of start/end symbols of vectorized dead strippable
sections such as the resourcestring data

git-svn-id: trunk@32391 -
2015-11-21 12:35:56 +00:00