eshlibld.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*!**************************************************************************
  2. *!
  3. *! FILE NAME : eshlibld.h
  4. *!
  5. *! DESCRIPTION: Prototypes for exported shared library functions
  6. *!
  7. *! FUNCTIONS : perform_cris_aout_relocations, shlibmod_fork, shlibmod_exit
  8. *! (EXPORTED)
  9. *!
  10. *!---------------------------------------------------------------------------
  11. *!
  12. *! (C) Copyright 1998, 1999 Axis Communications AB, LUND, SWEDEN
  13. *!
  14. *!**************************************************************************/
  15. /* $Id: eshlibld.h,v 1.2 2001/02/23 13:47:33 bjornw Exp $ */
  16. #ifndef _cris_relocate_h
  17. #define _cris_relocate_h
  18. /* Please note that this file is also compiled into the xsim simulator.
  19. Try to avoid breaking its double use (only works on a little-endian
  20. 32-bit machine such as the i386 anyway).
  21. Use __KERNEL__ when you're about to use kernel functions,
  22. (which you should not do here anyway, since this file is
  23. used by glibc).
  24. Use defined(__KERNEL__) || defined(__elinux__) when doing
  25. things that only makes sense on an elinux system.
  26. Use __CRIS__ when you're about to do (really) CRIS-specific code.
  27. */
  28. /* We have dependencies all over the place for the host system
  29. for xsim being a linux system, so let's not pretend anything
  30. else with #ifdef:s here until fixed. */
  31. #include <linux/limits.h>
  32. /* Maybe do sanity checking if file input. */
  33. #undef SANITYCHECK_RELOC
  34. /* Maybe output debug messages. */
  35. #undef RELOC_DEBUG
  36. /* Maybe we want to share core as well as disk space.
  37. Mainly depends on the config macro CONFIG_SHARE_SHLIB_CORE, but it is
  38. assumed that we want to share code when debugging (exposes more
  39. trouble). */
  40. #ifndef SHARE_LIB_CORE
  41. # if (defined(__KERNEL__) || !defined(RELOC_DEBUG))
  42. # define SHARE_LIB_CORE 0
  43. # else
  44. # define SHARE_LIB_CORE 1
  45. # endif /* __KERNEL__ etc */
  46. #endif /* SHARE_LIB_CORE */
  47. /* Main exported function; supposed to be called when the program a.out
  48. has been read in. */
  49. extern int
  50. perform_cris_aout_relocations(unsigned long text, unsigned long tlength,
  51. unsigned long data, unsigned long dlength,
  52. unsigned long baddr, unsigned long blength,
  53. /* These may be zero when there's "perfect"
  54. position-independent code. */
  55. unsigned char *trel, unsigned long tsrel,
  56. unsigned long dsrel,
  57. /* These will be zero at a first try, to see
  58. if code is statically linked. Else a
  59. second try, with the symbol table and
  60. string table nonzero should be done. */
  61. unsigned char *symbols, unsigned long symlength,
  62. unsigned char *strings, unsigned long stringlength,
  63. /* These will only be used when symbol table
  64. information is present. */
  65. char **env, int envc,
  66. int euid, int is_suid);
  67. #ifdef RELOC_DEBUG
  68. /* Task-specific debug stuff. */
  69. struct task_reloc_debug {
  70. struct memdebug *alloclast;
  71. unsigned long alloc_total;
  72. unsigned long export_total;
  73. };
  74. #endif /* RELOC_DEBUG */
  75. #if SHARE_LIB_CORE
  76. /* When code (and some very specific data) is shared and not just
  77. dynamically linked, we need to export hooks for exec beginning and
  78. end. */
  79. struct shlibdep;
  80. extern void
  81. shlibmod_exit(struct shlibdep **deps);
  82. /* Returns 0 if failure, nonzero for ok. */
  83. extern int
  84. shlibmod_fork(struct shlibdep **deps);
  85. #else /* ! SHARE_LIB_CORE */
  86. # define shlibmod_exit(x)
  87. # define shlibmod_fork(x) 1
  88. #endif /* ! SHARE_LIB_CORE */
  89. #endif _cris_relocate_h
  90. /********************** END OF FILE eshlibld.h *****************************/