fpc/rtl
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
..
amiga + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
arm * Promoted result type of FPC_PCHAR_LENGTH and FPC_PWIDECHAR_LENGTH to SizeInt. 2011-06-13 04:59:17 +00:00
atari
avr * fixed compilation of assembler helpers 2011-02-27 21:11:03 +00:00
beos + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
bsd * fix type of fourth parameter of msgrcv function 2010-11-23 23:44:34 +00:00
darwin + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
embedded * fixes compilation of atmega128 unit 2011-09-04 19:39:39 +00:00
emx * FileExists fixed - wildcards not accepted any longer 2011-08-25 21:34:44 +00:00
freebsd + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
gba + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
go32v2 * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
haiku + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
i386 + is_sse3_cpu, put into cpu unit, so x86-64 and i386 can share source code 2011-08-20 12:01:48 +00:00
inc * use thread var only if the target supports threading 2011-09-04 14:27:23 +00:00
linux 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 + initial implementation of iso style gotos in iso mode 2010-08-05 19:20:46 +00:00
macos + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
mips * don't change the fpu control word in the initialisation code of dynamic 2010-11-14 16:00:25 +00:00
mipsel * more mipsel code 2009-12-06 12:12:15 +00:00
morphos + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
nativent + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
nds + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
netbsd * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
netware + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
netwlibc + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
objpas * Cast HashValue to Longint, otherwise empty strings (which have hash=$FFFFFFFF) cause range check error when RTL is compiled with -Cr. 2011-09-08 19:15:34 +00:00
openbsd * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
os2 * FileExists fixed - wildcards not accepted any longer 2011-08-25 21:34:44 +00:00
palmos * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
powerpc * Promoted result type of FPC_PCHAR_LENGTH and FPC_PWIDECHAR_LENGTH to SizeInt. 2011-06-13 04:59:17 +00:00
powerpc64 * don't overwrite the target value of interlockedcompareexchange*() if the 2010-11-29 12:53:10 +00:00
qnx * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
solaris * use generic first_int_to_real 64 bit values on sparc 2011-09-03 19:58:32 +00:00
sparc + initial implementation of iso style gotos in iso mode 2010-08-05 19:20:46 +00:00
symbian + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
ucmaps
unix * patch by Nikolay Nikolov to support Alt-Tab and Ctrl-Tab on the linux console, resolves #19247 2011-08-16 18:58:50 +00:00
watcom * fixes for FileExists and DirectoryExists 2011-08-28 22:22:29 +00:00
wii + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
win * fixes from Mantis #20194, derived from patch and description by G. Fink. 2011-09-08 20:42:39 +00:00
win32 * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME 2011-09-02 12:51:48 +00:00
win64 + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
wince + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
x86_64 + is_sse3_cpu, put into cpu unit, so x86-64 and i386 can share source code 2011-08-20 12:01:48 +00:00
COPYING.FPC
COPYING.txt
fpmake.inc
fpmake.pp
Makefile + Update all Makefile's modified by 2011-08-16 20:10:19 +00:00
Makefile.fpc * Trunk version to 2.7.1 2011-08-03 13:59:33 +00:00
README.txt

This is the Run-Time Library (RTL) tree for Free Pascal.

To recompile the RTL, edit the main makefile. The makefiles NEED a GNU make
compatible make, they need unix-like 'rm' and 'mv' commands, as well as some
others. You can find these in the gnuutils package on the ftp site.

The main makefile is located ABOVE the RTL tree. It uses the FPC
makefile.fpc to guess reasonable defaults for everything it needs.
(these files can be found in base.zip on the FTP site)

The only variable that you may want to set are
FPC             - What compiler to use. Use an absolute path. 
                  (default is ppc386)
INSTALL_UNITDIR - Where to install the RTL units 
OPT             - any special options you want to set for the compiler.

In principle, you can also descend into the subdirectory of your OS, and
type 'make' there, that should also compile everything.

The tree contains subdirectories for all the supported operating systems,
as well as all processor architectures. The processor directories contain
low-level routines which are required for the system unit (if they are not 
available in high-level language form), as well as optimized versions of
the pascal generic routines (the generic routine source code is localed in
the inc subdirectory).

The following directories are not supported officially and may not work
correctly with FreePascal v1.0:

go32v1 - The DJGPP go32v1 DOS extender (no longer supported)
palmos - The PalmOS directory for the Dragonball (incomplete)


Enjoy.