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