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