fpc/rtl/linux
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
..
arm 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. 2011-09-08 21:17:35 +00:00
i386 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. 2011-09-08 21:17:35 +00:00
m68k - Revert micro-exe mode for now. 2010-10-15 16:49:48 +00:00
mips 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. 2011-09-08 21:17:35 +00:00
mipsel 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. 2011-09-08 21:17:35 +00:00
powerpc 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. 2011-09-08 21:17:35 +00:00
powerpc64 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. 2011-09-08 21:17:35 +00:00
sparc 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. 2011-09-08 21:17:35 +00:00
x86_64 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. 2011-09-08 21:17:35 +00:00
buildrtl.lpi * .lpi version update 2010-01-02 15:54:39 +00:00
buildrtl.pp * .lpi version update 2010-01-02 15:54:39 +00:00
bunxsysc.inc + Add modify_ldt to linux unit 2010-07-18 21:53:26 +00:00
errno.inc
errnostr.inc * Ales Katona's errors patch 2006-01-07 18:41:15 +00:00
fpcylix.pp + MAX_PATH 2005-09-25 15:44:26 +00:00
fpmake.inc + Initial check-in 2005-08-29 07:38:56 +00:00
gpm.pp * socket ->fpsocket 2009-08-09 10:30:15 +00:00
ipccall.inc + semtimedop() for Linux, marked as "platform" (last part of patch from 2010-11-13 18:37:43 +00:00
ipcsys.inc + semtimedop() for Linux, marked as "platform" (last part of patch from 2010-11-13 18:37:43 +00:00
linux.pp * fixed FPC_USE_LIBC building for Linux and exception handling (mantis #13450) 2011-07-31 23:36:17 +00:00
linuxvcs.pp * disable iochecking when opening terminal (to avoid RTE of #11376). 2008-07-26 10:48:36 +00:00
Makefile + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
Makefile.fpc + cpu unit for x86-64 containing a CAS128 implementation 2010-11-01 08:20:31 +00:00
oldlinux.pp * Fixed spell error revealed by lintian. 2010-10-06 20:33:57 +00:00
osdefs.inc * Patch from Henry Vermaak to fix EABI kernel API for arm. 2009-08-20 08:00:50 +00:00
osmacro.inc * Linux 64-bit FS patch from neli for FPC_USE_LIBC 2007-02-16 22:16:54 +00:00
ossysc.inc * fixed signal return trampolines for ARM EABI (mantis #15803) 2010-02-18 20:53:28 +00:00
ostypes.inc o fixed several Linux ipc bugs, based on patch by Ruben Chaer/ 2010-11-13 16:58:23 +00:00
pthread.inc * Fixed compilation on Linux after r15557 2010-07-12 21:38:55 +00:00
ptypes.inc * moves the alias "TTime = time_t" from ptypes.inc to unixtype.pp. 2010-01-09 16:05:42 +00:00
si_c21.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_c21g.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_c.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_dll.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_g.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_intf.inc * Fix smartlinking for linux. 2006-11-10 10:19:15 +00:00
si_prc.pp + add linux/i386 start units 2006-11-02 17:49:36 +00:00
si_uc.pp + add i386-linux uclibc process startup code 2007-09-30 14:53:54 +00:00
signal.inc * fixed FPC_USE_LIBC building for Linux and exception handling (mantis #13450) 2011-07-31 23:36:17 +00:00
suuid.inc * Fixed file handle leak when creating GUIDs 2008-05-29 12:42:42 +00:00
sysos.inc * fixed i386/linux rtl compilation and functionality when compiled 2008-05-21 15:20:13 +00:00
sysosh.inc * fix incompatiblity in signess between 64 and 32, make tthreadid=ptruint 2007-05-28 14:25:59 +00:00
system.pp * use generic first_int_to_real 64 bit values on sparc 2011-09-03 19:58:32 +00:00
termio.pp * various bugfixes 2006-02-02 08:22:35 +00:00
termios.inc * yet another fix for 10292, mea culpa. (identifiers were added for the wrong architecture) 2008-09-26 19:32:39 +00:00
termiosproc.inc * Prevent range check errors on powerpc-linux 2007-07-22 09:53:21 +00:00
unixsock.inc * Patch from Henry Vermaak to fix EABI kernel API for arm. 2009-08-20 08:00:50 +00:00
unixsockets.inc * add preliminary UnixSockets with linux implementation 2007-08-19 13:35:43 +00:00
unixsocketsh.inc * add preliminary UnixSockets with linux implementation 2007-08-19 13:35:43 +00:00
unxconst.inc * fixed TCGETS ioctl call constant for ppc/ppc64 (from do_isdevice) 2006-07-16 10:19:21 +00:00
unxfunc.inc fix compilation for {$T+} linux/win 2006-10-04 20:43:55 +00:00
unxsockh.inc * add UDP and TCP setsockopt constants (linux) 2008-05-31 21:10:18 +00:00
unxsysc.inc * move fdatasync to linux unit 2008-11-15 20:44:44 +00:00
unxsysch.inc * move fdatasync to linux unit 2008-11-15 20:44:44 +00:00