Commit Graph

172 Commits

Author SHA1 Message Date
Pierre Muller
7c9cf75418 Fix syscall unit compilation for i386-linux using -dFPC_USE_LIBC 2024-01-06 17:06:51 +01:00
Pierre Muller
0f0454a092 Modify references to old syslinux unit in comments 2023-09-19 21:53:26 +00:00
Michael VAN CANNEYT
4c2b54ee0d * Char -> AnsiChar 2023-07-14 17:26:09 +02:00
florian
cb2704dfb2 * some more use of __libc_csu_* removed 2022-03-31 22:32:28 +02:00
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
florian
b2a67d4656 * fixed comments in sysnr.inc files
git-svn-id: trunk@47426 -
2020-11-15 19:30:19 +00:00
florian
91fe098eb4 * check first for x86 exception and only for sse if no x87 exceptions is thrown, clear all exception afterwards
* throw rte 206 instead of rte 216 for denormal on m68k-linux as well

git-svn-id: trunk@47117 -
2020-10-16 19:44:25 +00:00
florian
15695b317c * denormalized value floating point exception has to result in an rte 206, resolves part of #37926
git-svn-id: trunk@47114 -
2020-10-15 19:52:57 +00:00
florian
4c2c540b29 * fixed resetting of state, broken in r45995
+ debugging output
  * check magic properly
  * cosmetics

git-svn-id: trunk@46208 -
2020-08-03 19:42:13 +00:00
florian
893225770c * updated tfpstate
git-svn-id: trunk@46207 -
2020-08-03 19:42:13 +00:00
florian
eac6675cba * reset exception flags, resolves #37468 on x86_64
git-svn-id: trunk@45995 -
2020-08-02 21:23:29 +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
svenbarth
04cbf32b1b * rename local import of fpc_geteipasebx
git-svn-id: trunk@45979 -
2020-08-01 17:26:29 +00:00
marco
3053f8c2e8 * many syscallh header files had GPL license instead of modified. I owned the copyright, or in one case, Thomas did, but it was a full copy of mine. -> changed to modified
* removed the remark about calling convention from several implementations. Oldfpccall no longer used.

git-svn-id: trunk@43962 -
2020-01-17 12:07:50 +00:00
florian
295041e523 * updated linux syscall numbers
git-svn-id: trunk@43835 -
2020-01-02 11:08:40 +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
719ff5fb4c * converted _FPC_libc21_haltproc into a pascal subroutine so stack alignment is kept
git-svn-id: trunk@43013 -
2019-09-15 17:17:32 +00:00
florian
bd35c02257 * cosmetics: indention
git-svn-id: trunk@43010 -
2019-09-15 17:17:30 +00:00
Jonas Maebe
3a1fb45315 * synchronised with trunk till r41976
git-svn-id: branches/debug_eh@41977 -
2019-05-02 19:44:41 +00:00
pierre
66401652fd * Update syscall list for i386 and x86_64 cpus,
based on values found on gcc121 machine,
     CentOS Linux release 7.6.1810 (Core)
   * Commented out values not accepted by GNU C compiler.
     For i386: madvise1(219), security(223),set_zone_reclaim(251)
     New last number: 382(pkey_free).
     For x86_64: 331(pkey_free).

git-svn-id: trunk@41929 -
2019-04-25 06:23:37 +00:00
florian
62f890efa3 * improved floating point signal handling on x86/linux
git-svn-id: branches/debug_eh@41451 -
2019-02-24 20:03:02 +00:00
florian
8db9b211d5 * fixed unwinding from signal handlers, the approach used now is very simple and clean
git-svn-id: branches/debug_eh@41414 -
2019-02-22 22:01:45 +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
eeadf618b8 + abi tag for i386
* arm abi tag moved into pascal file

git-svn-id: trunk@40454 -
2018-12-02 22:56:12 +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
marco
bffbff73e1 * remove deprecated parts linux stat records (FPC 1.0 leftovers)
git-svn-id: trunk@39644 -
2018-08-19 15:10:22 +00:00
Károly Balogh
a3a7285df4 linux: an attempt to clean up and fix syscall calling conventions for ftruncate64, pread64 and pwrite64 on platforms which use aligned register pairs to pass the 64bit parameters
git-svn-id: trunk@37719 -
2017-12-12 02:39:45 +00:00
yury
dbf482d62b * Fixed version of FpSysCall() with 6 params for Linux with PIC.
git-svn-id: trunk@37479 -
2017-10-17 18:03:29 +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
77285b63eb * i386-linux: reworked and cleaned up libc-related startup code:
* Don't replace intended initialization routines with dummy ones, so libc can properly initialize itself.
  * Profiling support (si_c21g.pp) only needs to contain the __gmon_start__ procedure, so it can reuse the entire si_c21.inc, and separate si_21g.inc file is no longer needed.

git-svn-id: trunk@32984 -
2016-01-22 17:11:08 +00:00
sergei
53d7018482 * removed 'nostackframe' attribute, since on i386 assembler procedures reference non-register parameters relative to ebp.
git-svn-id: trunk@32981 -
2016-01-22 16:35:20 +00:00
sergei
7381c66161 - i386-linux RTL: removed assembler startup files, which are unused since version 2.0.x.
git-svn-id: trunk@32972 -
2016-01-21 15:11:31 +00:00
sergei
903ddf8403 - Cleaned out some more assembler PIC hacks around ExitCode variable
git-svn-id: trunk@32680 -
2015-12-18 11:49:20 +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
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