eshlibld.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. && !defined(CONFIG_SHARE_SHLIB_CORE)
  43. # define SHARE_LIB_CORE 0
  44. # else
  45. # define SHARE_LIB_CORE 1
  46. # endif /* __KERNEL__ etc */
  47. #endif /* SHARE_LIB_CORE */
  48. /* Main exported function; supposed to be called when the program a.out
  49. has been read in. */
  50. extern int
  51. perform_cris_aout_relocations(unsigned long text, unsigned long tlength,
  52. unsigned long data, unsigned long dlength,
  53. unsigned long baddr, unsigned long blength,
  54. /* These may be zero when there's "perfect"
  55. position-independent code. */
  56. unsigned char *trel, unsigned long tsrel,
  57. unsigned long dsrel,
  58. /* These will be zero at a first try, to see
  59. if code is statically linked. Else a
  60. second try, with the symbol table and
  61. string table nonzero should be done. */
  62. unsigned char *symbols, unsigned long symlength,
  63. unsigned char *strings, unsigned long stringlength,
  64. /* These will only be used when symbol table
  65. information is present. */
  66. char **env, int envc,
  67. int euid, int is_suid);
  68. #ifdef RELOC_DEBUG
  69. /* Task-specific debug stuff. */
  70. struct task_reloc_debug {
  71. struct memdebug *alloclast;
  72. unsigned long alloc_total;
  73. unsigned long export_total;
  74. };
  75. #endif /* RELOC_DEBUG */
  76. #if SHARE_LIB_CORE
  77. /* When code (and some very specific data) is shared and not just
  78. dynamically linked, we need to export hooks for exec beginning and
  79. end. */
  80. struct shlibdep;
  81. extern void
  82. shlibmod_exit(struct shlibdep **deps);
  83. /* Returns 0 if failure, nonzero for ok. */
  84. extern int
  85. shlibmod_fork(struct shlibdep **deps);
  86. #else /* ! SHARE_LIB_CORE */
  87. # define shlibmod_exit(x)
  88. # define shlibmod_fork(x) 1
  89. #endif /* ! SHARE_LIB_CORE */
  90. #endif _cris_relocate_h
  91. /********************** END OF FILE eshlibld.h *****************************/