Commit Graph

19 Commits

Author SHA1 Message Date
svenbarth
359bb64aed * if the Linux target is compiled with FPC_USE_LIBC the initialization of TLS is not required (according to one comment by Florian), so disable all related code in that case (as for example the syscall numbers are not available then)
git-svn-id: trunk@48120 -
2021-01-09 15:58:13 +00:00
svenbarth
48cc5250f9 * fpc_geteipasebx and fpc_geteipasecx are used as procedures, not functions, so declare them as such
git-svn-id: trunk@45980 -
2020-08-01 17:26:34 +00:00
florian
56d91b4ca7 + support tls threadvars with the internal assembler
git-svn-id: trunk@43070 -
2019-09-25 21:19:03 +00:00
florian
bd35c02257 * cosmetics: indention
git-svn-id: trunk@43010 -
2019-09-15 17:17:30 +00:00
florian
32121de8ae * do not call InitTLS when a compiler is used which does not include the abi tag section
git-svn-id: trunk@40468 -
2018-12-04 21:25:48 +00:00
florian
72416edcc4 + support for tlsm_general on i386-linux
git-svn-id: trunk@40281 -
2018-11-11 17:32:20 +00:00
florian
063415fa72 + i386-linux support for tls-based threadvars
git-svn-id: trunk@40272 -
2018-11-07 22:03:02 +00:00
svenbarth
266eccde9f Merge revision(s) 32484 from branches/svenbarth/packages
Move PascalMain external from the si_*.inc files to a new include file si_impl.inc that's included in the implementation sections of the si_*.pp units

git-svn-id: trunk@33970 -
2016-06-12 16:49:56 +00:00
sergei
2efa348b19 - Cleaned out more assembler hacks around ExitCode variable
git-svn-id: trunk@29560 -
2015-01-26 20:08:11 +00:00
Jonas Maebe
0ad1a26c61 * adjusted startup code so it guarantees 16 byte stack alignment on program
startup for Linux/i386 (since the code generator won't keep the 16 byte
    alignment (yet?) for that platform, it won't make much difference in
    practice)

git-svn-id: trunk@22383 -
2012-09-13 14:47:05 +00:00
tom_at_work
9ce34c63c9 Fix shared library loading and unloading for Linux platforms. Shared library initialization and finalization are now called correctly at program startup for compile-time linked dynamic libraries on powerpc-/powerpc64-/arm-/i386- and x86_64-linux.
Every startup code must now provide an additional entry point called "_dynamic_start" that is set as new the entry point if the program links to a Pascal shared library. Its purpose is to set up an exit hook usually passed via a register, which should be called during program finalization if non-nil.

We use this additional entry point because this register only has meaningful content when there are any compile-time linked shared libraries, otherwise it often contains random garbage. The difference between the _dynamic_start and the original code is minimal; actually in all implementations the _dynamic_start code passes on control to the old startup code, so we use an additional entry point instead of an additional startup file.

Detailed changes and fixes list:
compiler:
  always link to the dynamic loader (ld.so) when compiling shared libraries. Fixes crashes in the loader during shared library finalization on some Linuxes
  remove additional ENTRY() section in arm linker script
  select either _dynamic_start or _start as entry point depending on whether this is a static or dynamic executable
powerpc*:
  do not set System.isLibrary in startup code, it will be set during library initialization anyway
  trap in case of reaching code locations that should not be reached instead of looping (possibly endlessly)
powerpc:
  register atexit() function pointer if supplied to the executable and call it during shutdown
  correctly set argc/argv/envp in shared library code and return correctly to the caller after initialization
  pass on exitcode in shared library haltproc
  use the more recent exit_group system call if available for shutdown
powerpc64
  fix .ptrgl stub, do not set the environment register to the value of the GOT entry in the function descriptor
arm
  do not set System.isLibrary in startup code, it will be set during library initialization anyway
  reload exitcode to pass to shutdown
mips,mipsel,sparc
  added stubs to allow correct linking

git-svn-id: trunk@19036 -
2011-09-08 21:17:35 +00:00
marco
f411f08629 * declared external fpc_geteipasebx , with local suffix to avoid clashes.
Still not the whole potatoe though.
 

git-svn-id: trunk@17682 -
2011-06-07 15:12:31 +00:00
marco
cdb4975530 * killed fpc_geteipbasebx in the startup code, mantis #19504
git-svn-id: trunk@17680 -
2011-06-06 20:26:22 +00:00
Jonas Maebe
84cc38f4af * moved {$asmmode att} to top of file (mantis #17377)
git-svn-id: trunk@15961 -
2010-09-09 19:46:59 +00:00
Jonas Maebe
92ff07deaf * several fixes by Pierre Pede (parts of his patch to mantis #12492)
o fixed gprof under linux/i386
    o fixed pic-compilation of the linux/i386 rtl
    o initialisation of linux shared libraries is now possible with pic-code

git-svn-id: trunk@13703 -
2009-09-12 21:57:41 +00:00
Jonas Maebe
7901625134 * call finalization routine of dynamic linker before exiting (forgot to
commit earlier)

git-svn-id: trunk@10663 -
2008-04-14 12:00:48 +00:00
mazen
0f73d54ac8 + Added ATT assmebler mode directive to override any default in fpc.cfg. Otherwise we need to override it in makefile.
git-svn-id: trunk@7258 -
2007-05-04 10:59:30 +00:00
peter
d1d7c59244 * fixed compile after exitcode size change
git-svn-id: trunk@6559 -
2007-02-19 16:11:01 +00:00
micha
6bfff9702e + add linux/i386 start units
git-svn-id: trunk@5183 -
2006-11-02 17:49:36 +00:00