Commit Graph

671 Commits

Author SHA1 Message Date
nickysn
ea5ffd597f * set self to nil in current_module.deflist for registered defs in the
tstoreddef.destroy destructor, instead of doing it after each call to
  x.owner.deletedef(x)

git-svn-id: trunk@49417 -
2021-05-30 21:27:57 +00:00
nickysn
1a71ca4106 * prevention of dangling pointers and use after free after free_unregistered_localsymtable_elements
git-svn-id: trunk@49262 -
2021-04-25 15:58:59 +00:00
pierre
e6045673ee Handle NIL entries in deflist after commit 48986
git-svn-id: trunk@49230 -
2021-04-18 15:44:07 +00:00
florian
d9784412a4 * patch by Cyrax: forbid to use heaptrc and valgrind at the same time, resolves #36529
* load cmem before line* units as they might allocate memory

git-svn-id: trunk@47390 -
2020-11-11 20:55:03 +00:00
Jonas Maebe
e7d1a77f9a * rename the ARM/AArch64-Darwin targets to ARM/AArch64-iOS
* rename the m68k/PowerPC-MacOS targets to m68k/PowerPC-MacOSClassic
  * repurpose the AArch64/Darwin target for AArch64/macOS
   o make AArch64-Darwin default target for a hosted AArch64-Darwin compiler

git-svn-id: trunk@45758 -
2020-07-10 21:52:24 +00:00
svenbarth
40633835dc * Windows on Aarch64 requires a relocation section
git-svn-id: trunk@44918 -
2020-04-21 06:04:37 +00:00
florian
391512546e + initial FreeRTOS RTL support, largely based on the Embedded target, limited to Xtensa so far
git-svn-id: trunk@44400 -
2020-03-29 17:13:45 +00:00
svenbarth
40c11baaac * use a different name for the packages' entry point and use _DLLMainCRTStartup as an alias to avoid problems with the C-prefix
git-svn-id: trunk@43551 -
2019-11-21 21:45:18 +00:00
svenbarth
bb3b1b06a7 * fix condition for including a unit's object files or not when compiling with packages
git-svn-id: trunk@43550 -
2019-11-21 21:45:15 +00:00
florian
13ab35e3ef * fix usage of ppumove generated shared libraries
git-svn-id: trunk@43495 -
2019-11-16 14:07:32 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
svenbarth
ced3885dbb * generate construction function for the attributes used in a unit using a more straight forward approach
ToDo: "collect" attributes of same type and same argument list and generate constructor only once for them

git-svn-id: trunk@42394 -
2019-07-12 22:07:20 +00:00
svenbarth
e296b26e9e - remove unit info and related code again as that will be handled similar, but differently with dynamic packages
git-svn-id: trunk@42369 -
2019-07-12 22:05:47 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
pierre
243c967967 Commit of new debug feature implemented by J. Gareth Moreton
Allows compilation of compiler using -dDEBUG_NODE_XML
  which will generate a NAME-node-dump.xml file for each 
  unit, program or library compiled,
  containing a XML description of the nodes handled during
  compilation of the unit, program or library.

git-svn-id: trunk@42271 -
2019-06-22 14:08:47 +00:00
Jonas Maebe
0cd0e1614b * synchronised with trunk till r42105
git-svn-id: branches/debug_eh@42106 -
2019-05-19 19:24:25 +00:00
Jonas Maebe
aad87820e6 * abstracted registration of library init/fini routines (to be able to add
LLVM support)

git-svn-id: trunk@42104 -
2019-05-19 19:20:47 +00:00
Jonas Maebe
9e9a982bfe * synchronised with trunk till r42095
git-svn-id: branches/debug_eh@42096 -
2019-05-18 18:43:51 +00:00
Jonas Maebe
8ec3cd6390 * append rather than insert the alias symbols for the program/procedure
initialisation/finalisation routines
   o this ensures the procdef's mangled name and its first symbol match,
     which is required for Darwin when generating debug information and
     using ".set" directives to define alias symbols, because a symbol
     defined via ".set" cannot be used in a data relocations (and the DWARF
     debug generator uses the default mangled name, which used to correspond
     to the alias symbol due to the "insert" instead of "append")

git-svn-id: trunk@42094 -
2019-05-18 18:41:33 +00:00
Jonas Maebe
fc60ec2ea4 + support for LLVM LTO: compile units with -CLflto -> when compiling a main
program/library also with -Clflto, all units compiled with that option
    will be linked using their bitcode files and LTO
   o compiling with -CLflto will compile all units twice: once for normal
     (static or smart) linking, and once for LTO. So the result can be
     used both with and without LTO.

git-svn-id: branches/debug_eh@41910 -
2019-04-20 18:56:11 +00:00
Jonas Maebe
0b61b5d4cf * added extra header to ppu inside a subsection, so we won't run into
trouble when the ppu version hits 255
  * also moved several ppu flags to a set inside that section

git-svn-id: trunk@41846 -
2019-04-06 21:28:43 +00:00
Jonas Maebe
91d5457b38 * moved around/replaced the following procedures to stop nflw from depending
on pdecsub (node units should not depend on parser units):
   o maybe_add_public_default_java_constructor()
   o handle_calling_convention()
   o create_finalizer_procdef() (replaced with create_outline_procdef())
   o insert_record_hidden_paras()
   o handle_calling_convention()
   o proc_add_definition()
   o build_parentfpstruct()
   o maybe_guarantee_record_typesym()
   o get_first_proc_str()
  * factored out the creation of a procinfo for a nested procdef based on a
    subnodetree of the current procdef into tprocinfo.create_for_outlining()

git-svn-id: trunk@40773 -
2019-01-05 16:26:33 +00:00
Jonas Maebe
28df55fe08 * moved handle_calling_convention() to pparautl
git-svn-id: trunk@40772 -
2019-01-05 16:26:29 +00:00
marco
dd52e79089 * two comment spelling fixes. Mantis #34092 & #34097
git-svn-id: trunk@39593 -
2018-08-08 08:39:20 +00:00
svenbarth
35bddf6fb1 * correctly update the (now unregistered) unit symbol if the unit was found with the help of a default namespace
(this is needed to trigger the correct creation of the namespace symbols)

git-svn-id: trunk@38917 -
2018-05-05 17:18:42 +00:00
svenbarth
c0dcb505e2 * use the module's filename instead of the passed in name (we assume all units added that way don't use the
ability to have a different module name to their filename)

git-svn-id: trunk@38912 -
2018-05-05 17:18:29 +00:00
svenbarth
e59e9e2a0a * extend tunitsym to be created as registered or not (for now all are created as registered)
git-svn-id: trunk@38911 -
2018-05-05 17:18:26 +00:00
florian
8eb885de91 * better error message if a unit is not found
git-svn-id: trunk@37868 -
2017-12-29 17:27:44 +00:00
pierre
5780c608be Also generate FPC_HAS_FEATURE_XXX macros for programs, libraries and packages
git-svn-id: trunk@37732 -
2017-12-14 22:53:32 +00:00
florian
b41cb26727 + write selected features in ppu of the system unit and load them further on
* ppu version update
* -Sf might be used only during system unit compilation
* loadsystemunit factored out so the system unit can be loaded earlier than other units to get features set

git-svn-id: trunk@37708 -
2017-12-10 16:32:56 +00:00
pierre
4c3d8d422a Add _GLOBAL_OFFSET_TABLE_ for sparc64 if -Cg is used
git-svn-id: trunk@36743 -
2017-07-18 12:49:26 +00:00
svenbarth
c90fbe1bf0 * fix for Mantis #31795: append a $ to internal functions init, finalize, init_implicit and finalize_implicit as their section names otherwise look the same as those of user declared functions with the same name
+ added test

git-svn-id: trunk@36194 -
2017-05-12 13:32:37 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
cc42bb8a7a * generate the package stub for all Windows and NativeNT targets
git-svn-id: trunk@35373 -
2017-01-29 22:39:34 +00:00
svenbarth
48bddbbc43 * use new potype_pkgstub instead of gen_fpc_dummy() as the former works on all platforms that needs it
With this dynamic packages are starting to work on x86_64-win64

git-svn-id: trunk@35372 -
2017-01-29 22:39:06 +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
Jonas Maebe
048666a25c * when freeing a procdef that hasn't been registered for writing to the ppu
at the end of compiling a unit, also remove it from its owning procsym
    in case the procsym does get written to the ppu (possible because you
    can have extra overloads in the implementation) (mantis #25283)
   o also fixes webtbf/tw4103 on the platforms where this still failed
     (on the platforms where it worked, it worked by accedent since the
      compiler was accessing memory of a freed procdef)

git-svn-id: trunk@35309 -
2017-01-15 17:41:27 +00:00
florian
42cde51805 * ignore warnings caused by boolean expression simplification
git-svn-id: trunk@35231 -
2017-01-04 16:33:31 +00:00
svenbarth
246de84ef3 * ensure that a finalization section is parsed before the generation of specializations as otherwise specializations in such sections would result in unresolved forward declarations
git-svn-id: trunk@34582 -
2016-09-30 15:41:35 +00:00
svenbarth
da5bc92ae0 * pmodules.finish_unit: fix condition that would lead to no implicit initialization code being generated if no explicit one is available, but an implicit one would be required
git-svn-id: trunk@34581 -
2016-09-30 15:11:16 +00:00
pierre
4d09dfca95 Remember usage of checkpointer (-gc) option:
Use new cs_checkpointer_called moduleswitches set element.
     Use new uf_checkpointer_called PPU flag (reusing obsolete uf_local_browser flag value)
     Emit warning if compiled library/program has any code using checkpointer.
  
 * ppu.pas: New constant: uf_checkpointer_called
 * globtype.pas: New constant: cs_checkpointer_called
 * fppu.pas: Set uf_checkpointer_called flag if cs_checkpointer_called is set in current_settings.module_switches
 * i8086/n8086mem.pas: Include cs_checkpointer_called in current_settings.moduleswitches
 *  ncgmem.pas: Likewise.
 * msg/errore.msg: Add new message saying that -gc and -Ur options are incompatible
   Add description to -gc option, saying it is experimental.
   Add warning at link time for program/library if checkpointer is used in any unit or main code.
 * options.pas: if -gc and -Ur options are used, never enable checkpointer code,
   instead output a warning that release is incompatible with -gc option.
 * pmodules.pas: proc_program: Check all modules for uf_checkpointer_called flag,
   emit a warning if checkpointer is used.
 * utils/ppuutils/ppudump.pp: Add code for uf_codepointer_called option.

git-svn-id: trunk@34567 -
2016-09-27 14:46:09 +00:00
pierre
3a9f2f55f4 -gc or {$CHECKPOINTER ON} requires heaptrc unit loading even for units
git-svn-id: trunk@34261 -
2016-08-10 09:44:01 +00:00
svenbarth
296b7dbaf5 * explicitely load the system unit if we have at least one required package (as one of those *must* contain the system unit); but don't add it to the used units of the package module as otherwise we'd detect the package to contain the system unit as well
git-svn-id: trunk@34254 -
2016-08-05 14:45:40 +00:00
svenbarth
839d82d9c6 - remove generation of the _FPCDummy symbol; for now this leads to more trouble than it has uses (namely none so far)
git-svn-id: trunk@34230 -
2016-07-29 16:06:35 +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
Jonas Maebe
3c446c8605 * fixed crash when compiling libraries on non-Darwin after r34134
git-svn-id: trunk@34140 -
2016-07-16 14:13:33 +00:00
Jonas Maebe
88a736c95a * moved the code generated for library init/fini to the al_pure_assembler
list, so that the assembler directives generated for Darwin are emitted
    correctly for LLVM
   o extracted the library init code generation from hlcgobj to pmodules so
     we don't add things to another list than what's passed to
     gen_proc_symbol_end(), and so it's done where we generate the init
     routine for libraries (rather then checking for every routine whether
     it's the init routine for a library)
   o removed the llvm-specific gen_proc_symbol_end() because the regular one
     now does the same

git-svn-id: trunk@34134 -
2016-07-15 14:34:11 +00:00
svenbarth
f27ce0b159 Rework the way the method bodies for specializations are generated: instead of walking the global and local symboltable all pending specializations are kept in a list of the current module which is (for now) walked at the end of a unit/program to generate the method bodies as before.
fmodule.pas, tmodule:
  + new list pendingspecializations which keeps track of all pending specializations of the current module
psub.pas:
  * move generate_specialization_procs and related routines to pgenutil
  + new procedure read_proc_body to read a routine's body, cause generate_specialization_procs needs it (unlike the already existing overload in the implementation section, this one can only handle bodies of non-nested routines) 
pgenutil.pas:
  * generate_specialization_phase2: add the newly specialized generic to the current module's pending specializations
  * generate_specialization_procs: reworked so that it uses the new pendingspecializations field instead of walking the global and local symboltable of the current unit
pmodules.pas:
  + add pgenutil to uses due to the moved generate_specialization_procs

+ added test

git-svn-id: trunk@33826 -
2016-05-26 18:56:16 +00:00
svenbarth
1824a945cf Merged revision(s) 32515, 32573, 32575, 32579 from branches/svenbarth/packages:
Report a warning if a unit is used from an indirectly used package. We are doing this only for the units used in contained units though as in the "contains" section there can't be such units anyway (and just checking all loaded units would lead to false positives).

pkgutil.pas:
  + new procedure check_for_indirect_package_usages() which walks a TLinkedList of used units and warns on every unit that is from an indirectly imported package
pmodules.pas, proc_package:
  * when checking all loaded units whether they are from a package or not also check for indirect package usages using the new procedure

........
pkgutil.pas, exportprocsym:
  * use a temporary variable for the procdef
  * restructure the if-expression a bit to make it better readable

........
pmodules.pas, finish_unit:
  * also release the generated proc symbol if the init function isn't needed

........
pkgutil.pas, add_package_libs:
  * fix exit condition (on Linux it probably worked by accident :/ )
........

git-svn-id: trunk@33518 -
2016-04-15 14:47:51 +00:00
svenbarth
e8ede4c3e2 Merged revision(s) 32508-32510, 32512 from branches/svenbarth/packages:
Keep track whether a package was added directly through a requires section (or the command line) or indirectly.

fpkg.pas, tpackageentry:
  + new field "direct"
pkgutil.pas:
  + add_package: new parameter "direct" which sets the "direct" field of the new package entry
options.pas:
  * TOption.interpret_option & read_arguments: adjust call to add_package()
pmodules.pas:
  * proc_package: adjust call to add_package()

........
Also load all packages that are required by packages, but that are not part of the directly used packages.

pkgutil.pas, load_packages:
  * check the list of required packages for packages that are not yet part of the package list and add these as indirect packages
  * establish the links to loaded packages in the required packages once all packages were loaded

........
fpcp.pas, tpcppackage:
  + new method add_required_package() to add a required package while ignoring duplicates

........
pmodules.pas, proc_package:
  * add all packages of loaded units as required packages

........

git-svn-id: trunk@33517 -
2016-04-15 14:42:24 +00:00