Commit Graph

138 Commits

Author SHA1 Message Date
sergei
2efa348b19 - Cleaned out more assembler hacks around ExitCode variable
git-svn-id: trunk@29560 -
2015-01-26 20:08:11 +00:00
sergei
d6f5bcee45 - Cleaned out assembler hacks around ExitCode variable
git-svn-id: trunk@29559 -
2015-01-26 19:55:58 +00:00
pierre
3a9abf75a9 Reset FPU state in SignalToRunError for SIGFPE, fixes tw12214 failure
git-svn-id: trunk@29551 -
2015-01-26 09:00:32 +00:00
yury
c40960466a * More correctly scan Elf Auxiliary Vector. Fixes possible crash when the first vector entry is AT_NULL. Issue #26973.
git-svn-id: trunk@29065 -
2014-11-12 14:52:56 +00:00
sergei
ead8d0c1d4 * Clean up i386-Linux startup code for shared libraries:
* The initialization code is a normal function called by runtime linker, stack layout at process startup is irrelevant.
  * Stack pointer can be replaced by frame pointer, they are just a few bytes away.
  * IsLibrary is set to true in fpc_libinitializeunits and therefore assigning it here is redundant.
  * The exitcode is passed as argument to haltproc, so messing with PIC is not necessary.

git-svn-id: trunk@26759 -
2014-02-13 04:54:21 +00:00
sergei
a3364a4b80 - RTL, Linux/FreeBSD shared library startup: removed FPC_SHARED_LIB_EXIT label, it is a leftover from times when library startup code was erroneously halting owning process on exit.
git-svn-id: trunk@25737 -
2013-10-10 13:14:56 +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
sergei
f9dbcbd0c3 - Removed duplicate file header
git-svn-id: trunk@23199 -
2012-12-21 09:16:23 +00:00
Jonas Maebe
20a6b7fa3d * fixed compilation after introduction of nostackframe checks
git-svn-id: trunk@22767 -
2012-10-19 14:43:00 +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
pierre
f0aa48b083 * Remove use of direct U_UNIT_NAME or TC_UNIT_NAME
symbols in assembler sources.
  Added to corresponding system variables or typed constants a
  public name 'operatingsystem_XXX' alias and used that alias in assembler
  source.

git-svn-id: trunk@18943 -
2011-09-02 12:51:48 +00:00
florian
b5ebe6307f * fix got loading si_c32, resolves #19520 (still uses the call/pop approach because it is faster on modern CPUs)
git-svn-id: trunk@18224 -
2011-08-16 18:45:39 +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
1f61b5b30c * reverted the rtl patches from r14184, because they cause an endless
loop when attempting to terminate a process via the RTL compiled into
    a Linux shared library  (mantis #17383)
  * call FPC_LIB_EXIT (the internal/generic RTL finalisation routine) instead
    of FPC_SHARED_LIB_EXIT (the Linux-specific "process exit" code for shared
    libraries) as "fini" routine (fixes #14958 again after reverting r14184)

git-svn-id: trunk@16418 -
2010-11-24 15:33:29 +00:00
daniel
3307d98c40 - Revert micro-exe mode for now.
git-svn-id: trunk@16170 -
2010-10-15 16:49:48 +00:00
daniel
2139a229d3 + If no unit is used, no symbol inside the system unit is used,
and no language features requiring initialization are used,
    do not initialize units, but just configure the fpu and
    signal handlers.

git-svn-id: trunk@16124 -
2010-10-10 17:40:39 +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
florian
7dc4b6ecc1 + adds mcount calls to syscall assembler helpers for i386 and x86-64, resolves #17140
git-svn-id: trunk@15812 -
2010-08-15 09:11:06 +00:00
micha
87ef559542 * rtl: fix i386-linux uclibc atexit functionality (call exit instead of _exit)
git-svn-id: trunk@15110 -
2010-04-03 13:18:10 +00:00
Jonas Maebe
38c09952a3 * don't exit the program in the exit code of shared libraries under Linux
(mantis #14958)

git-svn-id: trunk@14184 -
2009-11-15 13:50:14 +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
f6d452c2c0 * remove the RTL's installed signal handlers at the end of the system
unit's initialization code in case we're in a library
  + implemented InquireSignal(), AbandonSignalHandler(), HookSignal() and
    UnhookSignal() in the sysutils unit
  * for Kylix compatibility, these routines support operating on
    SIGINT and SIGQUIT as well, although they are not hooked by default
    by FPC. The run time errors/exception codes for these signals are
    resp. 217 and 233 (same as in Kylix; I changed ENoWideStringSupport
    to 234).
  * changed the BSD syscall version of fpsigaction to use pointer
    rather than "var" arguments (compatible with other targets, and
    required to be able to pass nil arguments inside the system unit)
  -> together fixes mantis #12704

git-svn-id: trunk@13077 -
2009-05-02 09:40:44 +00:00
Jonas Maebe
d20080c3d6 * fixed order of parameter pushing to gmon_monstartup
git-svn-id: trunk@12778 -
2009-02-23 18:03:49 +00:00
Jonas Maebe
3216e8c7bc * mark produced object files as "does not require executable stack" by
default for Linux (overridable using -WX switch) (mantis #11563)

git-svn-id: trunk@12356 -
2008-12-12 16:26:25 +00:00
micha
04d8ad3f17 * fix linux syscall numbers naming consistency #2 (overlooked some)
git-svn-id: trunk@12154 -
2008-11-17 21:48:02 +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
Jonas Maebe
3eec0569be * fixed shared library initialisation for FPC-compiled libraries
when linked to FPC-compiled programs under linux/i386 which
    do not use libc + test (mantis #8730). Programs which do use
    libc and other linux targets have to be fixed in a similar
    way until we properly fix everything by not exporting
    any symbols at all from shared libraries by default (and
    only those appearing in the "exports" section).

    Finalisation does not work yet either for FPC-compiled
    programs on linux/anything.

git-svn-id: trunk@10495 -
2008-03-15 23:28:09 +00:00
micha
7d5d4ba706 + add i386-linux uclibc process startup code
git-svn-id: trunk@8694 -
2007-09-30 14:53:54 +00:00
Almindor
a42b134a81 * fix sysenter variable duplication
git-svn-id: trunk@8406 -
2007-09-08 14:21:35 +00:00
Almindor
6fd901181a * update sysnr.inc for x86 and x86_64 to latest kernel
* add splice syscall to linux unit for x86 and x86_64

git-svn-id: trunk@8364 -
2007-09-02 22:06:04 +00:00
micha
68dbca040e * fix floating point signal and exception handling, for linux/i386, test tfpu2 regression
git-svn-id: trunk@8152 -
2007-07-23 15:36:02 +00:00
micha
0e64718cb2 * call HandleErrorAddrFrame on return of signal handler, reduces amount of code called within signal handler (for linux/i386)
git-svn-id: trunk@8092 -
2007-07-18 20:11:07 +00:00
Almindor
389ea20704 * fix FPC_USES_LIBC cycling, by fixing libc stat records (both 32 and 64 bit)
git-svn-id: trunk@8018 -
2007-07-11 20:55:09 +00:00
Jonas Maebe
f32621610f * fixed sse detection
git-svn-id: trunk@7554 -
2007-06-02 19:58:18 +00:00
florian
80d55022e9 * tried to fix SSE OS support detection
git-svn-id: trunk@7553 -
2007-06-02 19:26:06 +00:00
marco
eaaefc0f64 * deprecated here and there even though compiler doesn't seem to show
git-svn-id: trunk@7481 -
2007-05-26 13:56:21 +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
florian
2894267806 * fixed profiler startup code to link again, resolves #8551
git-svn-id: trunk@7053 -
2007-04-01 16:20:01 +00:00
Almindor
c626740043 * adds support for sysenter syscall style for i386 on 2.6 kernels
git-svn-id: trunk@6992 -
2007-03-25 10:06:23 +00:00
daniel
d030103742 + Restore "stat" data structure in backward compatible state
git-svn-id: trunk@6963 -
2007-03-23 22:23:24 +00:00
ivost
e7fb4e6a32 * changed i386 syscall from oldfpccall to register calling convention
git-svn-id: trunk@6776 -
2007-03-10 18:09:13 +00:00
ivost
240938a6ed * fixed syscall6 (still experimental, but so far it worked here!)
git-svn-id: trunk@6705 -
2007-03-03 21:38:20 +00:00
peter
d1d7c59244 * fixed compile after exitcode size change
git-svn-id: trunk@6559 -
2007-02-19 16:11:01 +00:00
marco
57cfd89fbd * Linux 64-bit FS patch from neli for FPC_USE_LIBC
git-svn-id: trunk@6517 -
2007-02-16 22:16:54 +00:00
florian
31c9a91af0 + edsp detection for arm-linux
git-svn-id: trunk@6429 -
2007-02-11 16:21:04 +00:00
florian
bcf65051e3 * detect sse properly on linux, fixes tmask*.pp in the testsuite with -Cfsse2
git-svn-id: trunk@6277 -
2007-01-31 21:51:47 +00:00
florian
74c9eefc99 * fixed bootstrapping with 2.0.4
git-svn-id: trunk@5837 -
2007-01-07 10:19:10 +00:00
florian
c59c9cdfae * don't build .as with 2.1.1 on i386
* first fix to library entry code

git-svn-id: trunk@5836 -
2007-01-07 10:04:19 +00:00