Commit Graph

98 Commits

Author SHA1 Message Date
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
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
florian
ac51f535ae * support of data > 2 GB on x86_64-linux with PIC by picifing the startup code, resolves #17236
* fixed some small issues in the startup files

git-svn-id: trunk@15907 -
2010-08-25 19:43:29 +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
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
micha
176f545c3b * fix linux syscall numbers naming consistency (fixes x86_64 unit linux build)
git-svn-id: trunk@12153 -
2008-11-17 21:46:34 +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
florian
065b187c26 * properties set
git-svn-id: trunk@8209 -
2007-08-02 07:38:09 +00:00
Almindor
279422cdde * add comment about stat.h source
git-svn-id: trunk@8022 -
2007-07-11 21:10:27 +00:00
Almindor
b0fde4700f * fix the stupid pascal names in x86_64 linux stat
git-svn-id: trunk@8020 -
2007-07-11 21:02:34 +00:00
Almindor
5c1296e87b * preliminary x86_64 stat for FPC_USE_LIBC
git-svn-id: trunk@8019 -
2007-07-11 21:00:03 +00:00
marco
a123ec0d14 * More deprecated.
git-svn-id: trunk@7566 -
2007-06-03 18:55:36 +00:00
michael
3399c88af7 * More typo fixes
git-svn-id: trunk@6981 -
2007-03-24 21:35:08 +00:00
michael
c8ea0b0344 * Fixed compilation
git-svn-id: trunk@6978 -
2007-03-24 21:28:49 +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
florian
20dfbaee59 * proper initialization of library
git-svn-id: trunk@5832 -
2007-01-06 23:38:37 +00:00
florian
7cc3d3d532 * made it working
git-svn-id: trunk@5826 -
2007-01-06 18:37:48 +00:00