si_dll.inc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2006 by Florian Klaempfl
  4. members of the Free Pascal development team.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY;without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. procedure PASCALMAIN; external name 'PASCALMAIN';
  12. procedure _FPC_shared_lib_start(argc:dword; argv,envp:pointer); cdecl; public name 'FPC_SHARED_LIB_START'; public name '_start';
  13. begin
  14. operatingsystem_parameter_argc:=argc;
  15. operatingsystem_parameter_argv:=argv;
  16. operatingsystem_parameter_envp:=envp;
  17. InitialStkPtr:=get_frame;
  18. PASCALMAIN;
  19. end;
  20. { this routine is only called when the halt() routine of the RTL embedded in
  21. the shared library is called }
  22. procedure _FPC_shared_lib_haltproc(e:longint); cdecl; assembler; nostackframe; public name '_haltproc';
  23. asm
  24. movl e,%edi
  25. movl $231,%eax { exit_group call }
  26. syscall
  27. jmp _FPC_shared_lib_haltproc
  28. end;
  29. { Define a symbol for the first piece of initialized data. }
  30. (* .data
  31. .globl __data_start
  32. __data_start:
  33. .long 0
  34. .weak data_start
  35. data_start = __data_start *)
  36. (* We need this stuff to make gdb behave itself, otherwise
  37. gdb will chokes with SIGILL when trying to debug apps.
  38. Makes ld choke:
  39. .section ".note.ABI-tag", "a"
  40. .align 4
  41. .long 1f - 0f
  42. .long 3f - 2f
  43. .long 1
  44. 0: .asciz "GNU"
  45. 1: .align 4
  46. 2: .long 0
  47. .long 2,4,0
  48. 3: .align 4
  49. *)