Commit Graph

117 Commits

Author SHA1 Message Date
florian
654d75b777 * fix bootstrapping with with 3.2.2 and -dFPC_USE_LIBC 2024-01-15 21:56:09 +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
3e3b96e088 * fix of Erroneous reading of the value of the StackLength variable at program start based on issue report by Sergey Larin, resolves #40211 2023-03-21 22:37:40 +01:00
florian
35a7490ae1 * provide __libc_csu_init and __libc_csu_fini as weak symbols 2022-04-09 21:12:28 +02:00
florian
644263277f * clean up of assembler files not used anymore 2022-01-05 20:52:35 +01:00
florian
baa28faa19 * pic'fied startup code 2021-10-25 21:39:24 +02:00
florian
91586331b5 * x86_64-linux: assembler helpers syscalls do not need a stackframe
git-svn-id: trunk@48512 -
2021-02-04 20:57:11 +00: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
1a2b99bc09 * correctly reset fpu on x86_64-linux after a floating point exception, resolves second part of #37468
git-svn-id: trunk@46992 -
2020-09-28 20:50:25 +00:00
florian
7281ea7a2c * floating point division by zero should throw run time error 208, fixed
git-svn-id: trunk@46210 -
2020-08-03 19:42:16 +00:00
florian
b60ac4c2db * @PLT is needed for calls to link it properly with pic code
git-svn-id: trunk@46209 -
2020-08-03 19:42:14 +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
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
f6667a5143 * we have to use __tls_get_addr from the dyn. linker lib else tls on programs with pure pascal dyn. libraries fail
git-svn-id: trunk@43069 -
2019-09-25 21:19:01 +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
21860480ad * use trampoline on x86-64/linux to convert signals properly in exceptions for psabieh
git-svn-id: branches/debug_eh@41566 -
2019-03-02 23:05:26 +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
597a23d278 + tls support for x86_64-linux (not yet enabled by default)
git-svn-id: trunk@41081 -
2019-01-27 09:37:25 +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
florian
b24eb3cce7 * x86_64-linux uses now pascal init code
git-svn-id: trunk@38409 -
2018-03-04 18:22:04 +00:00
florian
05a92d55e4 * partly reverted #38320, the code was correct
git-svn-id: trunk@38402 -
2018-03-03 16:41:52 +00:00
florian
c6af4e42c0 * ensure that the stack is aligned after haltproc, should resolve #33311
git-svn-id: trunk@38400 -
2018-03-03 16:14:51 +00:00
florian
92776e1864 * keep stack aligned when using profiler stubs
git-svn-id: trunk@38320 -
2018-02-23 19:35:20 +00:00
pierre
a706c3900f Fix loading of argc field (longint type) of TEntryInformation.OS record
git-svn-id: trunk@37329 -
2017-09-26 21:02:45 +00:00
svenbarth
0f9451fbb7 * switch x86_64-linux to indirect entry, essentially allowing for the use of dynamic packages on that target
git-svn-id: trunk@36690 -
2017-07-08 20:39:36 +00:00
svenbarth
7f5352280d Fix si_g.inc for x86_64-linux:
* it's 'atexit' and not '__libc_atexit'
* initialstkptr is a global symbol so it needs to be loaded using GOTPCREL

git-svn-id: trunk@34235 -
2016-07-29 22:03:54 +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
Jonas Maebe
36c6a190a8 * execute the real libc init/fini routines instead of dummies
(patch by Edmund Grimley Evans)

git-svn-id: trunk@31976 -
2015-10-08 18:40:31 +00:00
florian
c1091e1724 * added more asmmode directives to make compilation more robust in case the asmmode is changed by configuration files, resolves #27255
git-svn-id: trunk@29589 -
2015-01-31 10:37:48 +00:00
sergei
50639d89e7 * x86_64-linux startup: use ABI tag from abitag.o, cleaned out inlined versions.
git-svn-id: trunk@29578 -
2015-01-29 17:07:45 +00:00
sergei
e2eb6dffbb + x86_64-linux: build ABI tag separately, the purpose it twofold: 1) it is the only part of startup that cannot be yet handled directly by compiler, 2) it provides a single point to modify whenever necessary.
git-svn-id: trunk@29558 -
2015-01-26 17:15:48 +00:00
sergei
3a3f7859f7 * x86_64-linux: ExitCode is passed as parameter to _haltproc, so assembler hacking with global variable is not necessary.
git-svn-id: trunk@29542 -
2015-01-24 15:28:00 +00:00
sergei
eb30da60a6 * x86_64-linux: fixed existing Pascal startup code (syntax only, operation not tested yet) and added missing files.
git-svn-id: trunk@27414 -
2014-03-31 15:57:11 +00:00
sergei
7ba4e67564 * Fixed Linux FPU exception mapping for x86_64 and MIPS, might be still incomplete, but at least operations yielding NaNs no longer produce EAccessViolation.
git-svn-id: trunk@27194 -
2014-03-20 01:59:06 +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
Jonas Maebe
78f94ab035 * made calls to seterrno position-independent
git-svn-id: trunk@24640 -
2013-05-30 12:23:50 +00:00
sergei
393f1d58ed * Fixed register rsi being overwritten. It is used to pass argc into libc_start_main.
git-svn-id: trunk@22043 -
2012-08-09 07:34:49 +00:00
sergei
12dc48afbf * Set errno using a call to seterrno, like it is done for i386 target. This removes most of assembler code together with PIC hacks and makes this part independent of threadvar implementation details.
git-svn-id: trunk@22042 -
2012-08-09 06:34:00 +00:00
sergei
31f9a9d420 * Fixed label name in .globl and .type directives, was causing every library to contain an unwanted dynamic reference to "_start".
git-svn-id: trunk@21854 -
2012-07-10 17:12:34 +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
Jonas Maebe
0da9d36116 * fixed internal assembler for x86-64 so that it correctly handles
relocations for addr_pic_no_got references (do not go via the GOT)
  * fixed code generator so that it generates addr_pic_no_got references
    also for platforms that use the internal assembler (this will break linking
    of some tests that check static data > 2GB on Linux/x86-64, but they were
    already broken before as well because we don't use the "huge" x86-64
    execution model)
  * fixed x86-64 Linux syscall code to not expect GOT-based relocations for
    the system unit's errno variable (it's an implementation-only variable)

git-svn-id: trunk@16717 -
2011-01-06 09:28:25 +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