Commit Graph

19 Commits

Author SHA1 Message Date
pierre
1d5c714ff2 Fix error in assembly startup code for sparc linux
git-svn-id: trunk@45836 -
2020-07-23 20:59:03 +00:00
sergei
62a5ba14a3 + SPARC: support finalization routine supplied by dynamic linker.
+ Added "stack not executable" marker.

git-svn-id: trunk@26287 -
2013-12-26 09:09:23 +00:00
Jonas Maebe
81597bf171 * updated address of FSF (mantis #24646, patch by Alexey Svistunov)
git-svn-id: trunk@24986 -
2013-06-27 14:01:18 +00:00
pierre
20c9d19764 Add PIC specific code
git-svn-id: trunk@22484 -
2012-09-27 15:50:31 +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
Jonas Maebe
f8b40e90dc * exit -> exit_group to exit so unterminated threads are killed too
git-svn-id: trunk@7474 -
2007-05-25 17:48:24 +00:00
Jonas Maebe
cc03eacd2a * fixed program exitcode after change of operatingsystem_result from
word to longint

git-svn-id: trunk@7473 -
2007-05-25 13:07:23 +00:00
peter
94f2b1d941 * add initialstkptr to get the stackpointer at startup before
PASCALMAIN is called so the main body framepointer is seen as
    a valid pointer with backtracing

git-svn-id: trunk@2266 -
2006-01-12 09:29:57 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
florian
2337996715 * remade makefile (too old fpcmake)
* fixed sparc startup code
2004-07-05 21:07:37 +00:00
daniel
a1229ff8fe * Modified bootstrap code so separate prt0.as/prt0_10.as files are no
longer necessary
2004-07-03 21:50:30 +00:00
peter
79d45deec7 * startup argc,argv,envp fix
* stat fixed
2004-05-27 23:15:02 +00:00
peter
6b5f84117b * use ldsh to load exitcode 2004-05-17 20:56:56 +00:00
mazen
703f4f29d0 + _haltproc definition for linux/sparc 2004-03-16 10:19:11 +00:00
mazen
13d509cde4 *making init and fini symbols compatible FPC code by
changing  _init ==> fpc_initialize
 and _fini ==> fpc_finalize
2003-06-02 22:03:37 +00:00
mazen
98a1b248e6 * start code of gcc adapted for FPC 2002-11-18 19:03:46 +00:00
mazen
10c5331beb * inserted from gcc cvs 2002-11-17 21:30:35 +00:00
mazen
1817fc98e4 + SPARC support added based on PowerPc sources 2002-11-15 12:08:37 +00:00