Commit Graph

61 Commits

Author SHA1 Message Date
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
Jonas Maebe
0758aa1143 FPU exception mask: generlised system unit interface 2022-10-17 19:43:01 +00:00
florian
b00fe0e4e4 * all references to libc_csu_ cleaned, should resolve #39295 2022-01-05 21:42:17 +01:00
florian
abee68df92 * powerpc64-linux: libc_csu_* are not available anymore in newer glibc,
make them dummy calls, x86_64-linux does the same for years
2022-01-05 21:33:32 +01:00
florian
0b2a58027c * powerpc64-linux: unused assembler loader files removed 2022-01-05 21:01:39 +01:00
florian
b2a67d4656 * fixed comments in sysnr.inc files
git-svn-id: trunk@47426 -
2020-11-15 19:30:19 +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
pierre
4888c379c4 Use same field type and name as in /ust/include/sys/stat.h
git-svn-id: trunk@44878 -
2020-04-20 09:37:55 +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
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
Jonas Maebe
e5a1231931 * updated FSF address (mantis #30198, patch by Paul Gevers)
git-svn-id: trunk@34598 -
2016-10-02 12:56:59 +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
9e3c7f175f * load the address of envp before storing it, so we don't overwrite argv
with envp (fixes bug in fix from r32528, mantis #29587 for FPC 3.0.x
    -- FPC 3.1.1+ uses si_*.inc instead, which already works correctly)

git-svn-id: trunk@33045 -
2016-02-04 11:37:29 +00:00
Jonas Maebe
f65cb5d933 * equivalent of r32525/32526 for the assembler version of the startup code
git-svn-id: trunk@32528 -
2015-11-25 00:10:26 +00:00
Jonas Maebe
2249d95ddb * call external routines via their TOC entry instead of directly
(mantis #29004)

git-svn-id: trunk@32527 -
2015-11-25 00:10:23 +00:00
Jonas Maebe
740f8532df * fixed saving the stack pointer in r32525
git-svn-id: trunk@32526 -
2015-11-25 00:10:19 +00:00
Jonas Maebe
816c66107e * fixed dynamic startup of programs that don't link against libc (they get
argc/argv/envp in r3/r4/r5)

git-svn-id: trunk@32525 -
2015-11-24 23:34:30 +00:00
Jonas Maebe
82d92dbf50 * call seterrno instead of manually handling the setting setting the errno
threadvar (and having to deal with differences between the ELFv1 and ELFv2
    ABIs regarding indirect function calls, + future ability to have the
    compiler generate PIC for those routines)
   o includes workaround for lack of linkage area size allocation in current
     released PPC64 versions, remove after 3.0.2 has been released

git-svn-id: trunk@30213 -
2015-03-14 18:36:17 +00:00
Jonas Maebe
3ab62dcfed * switched Linux/PowerPC64 to Pascal startup code so that we can used ifdefs
to detect whether we're compiling for ELFv1/SYSV or ELFv2

git-svn-id: trunk@30210 -
2015-03-14 18:36:08 +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
pierre
bba4932ef9 * Fix commit 23220, by moving declaration from syscallh.inc to syscall.inc
git-svn-id: trunk@23221 -
2012-12-25 22:54:49 +00:00
pierre
70a29668a4 Try to fix simply the fpc_threadvar_relocate_proc problem
git-svn-id: trunk@23220 -
2012-12-24 16:23:30 +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
4b743a7a61 * IsLibrary is a byte-sized boolean, thus use stb instruction to set value
git-svn-id: trunk@19022 -
2011-09-07 21:57:37 +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
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
tom_at_work
5f3aaf1e60 * minor changes to the startup code: use exit_group syscall to exit, minor cleanup
* add _haltproc symbol to shared library startup code

git-svn-id: trunk@16258 -
2010-10-29 19:58:51 +00:00
tom_at_work
9a969c18cd Startup files fixes for ppc/ppc64
* startup code in c/g/prt0.as does not contain .text references anymore
* fixed shared library startup code for ppc64: startup and shutdown code is properly called, making the tlibrary2 test succeed now

git-svn-id: trunk@16199 -
2010-10-22 23:19:23 +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
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
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
341cec908d * update linux syscall numbers (merge powerpc64 to powerpc)
git-svn-id: trunk@12106 -
2008-11-15 15:42:12 +00:00
florian
065b187c26 * properties set
git-svn-id: trunk@8209 -
2007-08-02 07:38:09 +00:00
marco
a123ec0d14 * More deprecated.
git-svn-id: trunk@7566 -
2007-06-03 18:55:36 +00:00
tom_at_work
25ad38ec50 * updated stat record
git-svn-id: trunk@5235 -
2006-11-05 10:22:24 +00:00
tom_at_work
2b8d704238 * fixed syscall helpers: threadvar index now correctly loaded as dword, helpers are now TOC and environment pointer aware, one-parameter helper was bugged and general cleanup; solves random crashes in these functions in particular with -O2 and threads.
git-svn-id: trunk@4236 -
2006-07-16 19:22:31 +00:00
tom_at_work
a9df7aa81a * forgot to commit ppc64 gprt0.as used for gprof support
* fixed ppc64 exception mask stuff (same as 3136 for ppc32)

git-svn-id: trunk@3298 -
2006-04-20 11:55:06 +00:00
tom_at_work
9b150ce30e - Syscall number update for Kernel 2.6.15
git-svn-id: trunk@3076 -
2006-03-29 21:42:44 +00:00
tom_at_work
a0bc256b8f * added syscall_nr_pwrite/read64 aliases for build
git-svn-id: trunk@2737 -
2006-03-04 18:40:17 +00:00
marco
05bb11b2ba * syscalls regenerated by Neli.
git-svn-id: trunk@2552 -
2006-02-12 21:45:34 +00:00
peter
94f2b1d941 * add initialstkptr to get the stackpointer at startup before
PASCALMAIN is called so the main body framepointer is seen as
    a valid pointer with backtracing

git-svn-id: trunk@2266 -
2006-01-12 09:29:57 +00:00
tom_at_work
651f34e27c * ppc64: with -Or the compiler now also generates calls to helper functions in the function prolog/epilog instead of multiple stores/loads
* ppc64: moved function prolog/epilog helper code into startup code
* ppc64: added FPU configuration code in math unit (fixes tw3161)

git-svn-id: trunk@1786 -
2005-11-20 01:20:55 +00:00
tom_at_work
268050b0c1 * added ptrgl helper to cprt0 startup code as well
git-svn-id: trunk@1779 -
2005-11-17 21:35:47 +00:00
tom_at_work
3bf1152a9c * ppc64/linux: fixed and enabled some more assembly routines in the RTL
* ppc64/linux: cleaned up several files (mainly proper comments)

git-svn-id: trunk@1757 -
2005-11-15 17:30:15 +00:00
tom_at_work
47258d61a6 * some cleanup, typo fixes
git-svn-id: trunk@1723 -
2005-11-11 12:37:28 +00:00
tom_at_work
940f953e8b * cleanup, removing debug code removed and fixing file headers
* cprt0 updates

git-svn-id: trunk@1713 -
2005-11-10 15:08:41 +00:00
tom_at_work
c5f89d7efd * release old stack pointer register on ppc64 after method prolog
* threading fixes for ppc64
* fixed a_param_ref to respect the size parameter on ppc64
* better stack size calculation for ppc64

git-svn-id: trunk@1599 -
2005-10-26 19:50:17 +00:00
tom_at_work
5520442fc4 * call by register now also takes care of the TOC and environment pointer
* first "optimize for size"-optimization

git-svn-id: trunk@1593 -
2005-10-25 20:12:21 +00:00