si_dll.inc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. {$asmmode gas}
  12. procedure PASCALMAIN; external name 'PASCALMAIN';
  13. procedure _FPC_shared_lib_start(argc:dword; argv,envp:pointer); cdecl; public name 'FPC_SHARED_LIB_START'; public name '_start';
  14. begin
  15. operatingsystem_parameter_argc:=argc;
  16. operatingsystem_parameter_argv:=argv;
  17. operatingsystem_parameter_envp:=envp;
  18. InitialStkPtr:=get_frame;
  19. PASCALMAIN;
  20. end;
  21. { this routine is only called when the halt() routine of the RTL embedded in
  22. the shared library is called }
  23. procedure _FPC_shared_lib_haltproc(e:longint); cdecl; assembler; nostackframe; public name '_haltproc';
  24. asm
  25. movl e,%edi
  26. movl $231,%eax { exit_group call }
  27. syscall
  28. jmp _FPC_shared_lib_haltproc
  29. end;
  30. { Define a symbol for the first piece of initialized data. }
  31. (* .data
  32. .globl __data_start
  33. __data_start:
  34. .long 0
  35. .weak data_start
  36. data_start = __data_start *)
  37. (* We need this stuff to make gdb behave itself, otherwise
  38. gdb will chokes with SIGILL when trying to debug apps.
  39. Makes ld choke:
  40. .section ".note.ABI-tag", "a"
  41. .align 4
  42. .long 1f - 0f
  43. .long 3f - 2f
  44. .long 1
  45. 0: .asciz "GNU"
  46. 1: .align 4
  47. 2: .long 0
  48. .long 2,4,0
  49. 3: .align 4
  50. *)