Commit Graph

74 Commits

Author SHA1 Message Date
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
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +00:00
svenbarth
529677cc79 ncal.pas:
* extend tcallnode with the ability to pass a tspecializationcontext so that tcallcandidates can do a final specialization
  * the final procdef is registered at the end of tcallnode.pass_typecheck

git-svn-id: trunk@31763 -
2015-09-18 14:48:54 +00:00
Jonas Maebe
f8d9e70ec2 * converted tnodeutils.InsertMemorySizes() to the high level typed constant
builder and activated it for llvm

git-svn-id: trunk@31678 -
2015-09-14 16:10:54 +00:00
Jonas Maebe
381270bf30 * changed the threadvars table count back from
tai_const.create_32bit_unaligned() into tai_const.create_32bit() after
    r31649 (Lazarus autocompletion...) (fixes webtbs/tw3540.pp regression)

git-svn-id: trunk@31661 -
2015-09-13 07:56:12 +00:00
Jonas Maebe
faf4a9cb38 * moved the generation of the "main" stub for libc-based platforms from
hlcgobj to pmodules/symcreat/ngenutil, so that it also works for llvm

git-svn-id: trunk@31658 -
2015-09-12 23:34:01 +00:00
Jonas Maebe
4b92083006 * converted tnodeutils.InsertRuntimeInitsTablesTable to the high level typed
const builder
   o enabled the routines that use this one for LLVM

git-svn-id: trunk@31652 -
2015-09-12 23:33:38 +00:00
Jonas Maebe
a4ee982269 * converted tnodeutils.InsertInitFinalTable to the high level typed const
builder and enabled it for LLVM

git-svn-id: trunk@31651 -
2015-09-12 23:33:35 +00:00
Jonas Maebe
a1c676cc51 * converted tnodeutils.InsertThreadvarTablesTable to the high level typed
constant builder

git-svn-id: trunk@31649 -
2015-09-12 23:33:28 +00:00
Jonas Maebe
f49d6e5f26 * converted tnodeutils.InsertThreadvars to the high level typed constant
builder

git-svn-id: trunk@31647 -
2015-09-12 23:33:21 +00:00
svenbarth
65c37df999 + extend tprocdef with the possiblity to create it as unregistered
* for now all procdefs are created as registered
Note: an additional parameter instead of an overload is used for tprocdef.create as otherwise both constructors would need to be overridden in potential descendant CPU-specific classes...

git-svn-id: trunk@31593 -
2015-09-11 13:36:00 +00:00
Jonas Maebe
1941e64488 + added a hook to insert object-global information into the asmlists (will
be used to insert type definitions for llvm)

git-svn-id: trunk@30674 -
2015-04-19 21:37:43 +00:00
Jonas Maebe
640efba580 * fixed warnings after r30449/r30450
git-svn-id: trunk@30466 -
2015-04-06 14:24:09 +00:00
florian
9ab9e03650 * limit number of possible units with initialization/finalization for a certain architecture to high(aint)
+ give an error if the number of possible units is exceeded

git-svn-id: trunk@30450 -
2015-04-05 21:06:58 +00:00
Jonas Maebe
bd203a5b57 * synchronised with trunk till r30240
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
Jeppe Johansen
155998fe89 Support .set and .weak in internal assembler.
Fix problem with fpc_initialHeap getting put in .data instead of .bss.

git-svn-id: trunk@30233 -
2015-03-15 12:10:54 +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
8de49997ea * align compiler generated constants according to constant aligment settings
git-svn-id: trunk@29652 -
2015-02-08 11:23:01 +00:00
florian
632f43c490 * fix assembling with masm according to #25858
git-svn-id: trunk@29635 -
2015-02-05 21:22:39 +00:00
sergei
a67478e033 * Simplified, removed redundant asmlist and duplicate call to maybe_new_object_file.
git-svn-id: trunk@29509 -
2015-01-20 07:52:11 +00:00
svenbarth
b38fb606cc Fix for Mantis #27185.
ngenutil.pas:
  * AddToStructInits: also process the class constructors/destructors of nested types

+ added test

git-svn-id: trunk@29308 -
2014-12-21 14:01:32 +00:00
Jonas Maebe
37009c917b * pass alignment to tnodeutils.insertbsssym()
git-svn-id: branches/hlcgllvm@28751 -
2014-10-06 20:53:14 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
svenbarth
4a0d27ebfe Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym:
    check for vo_is_default_var flag and don't consider such as trashable

+ added test

git-svn-id: trunk@27872 -
2014-06-06 13:59:52 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00