Home | History | Annotate | Line # | Download | only in include
link_elf.h revision 1.11
      1 /*	$NetBSD: link_elf.h,v 1.11 2020/09/21 02:20:27 kamil Exp $	*/
      2 
      3 #ifndef _LINK_ELF_H_
      4 #define	_LINK_ELF_H_
      5 
      6 #include <sys/types.h>
      7 #include <sys/exec_elf.h>
      8 
      9 typedef struct link_map {
     10 	caddr_t		 l_addr;	/* Base Address of library */
     11 #ifdef __mips__
     12 	caddr_t		 l_offs;	/* Load Offset of library */
     13 #endif
     14 	const char	*l_name;	/* Absolute Path to Library */
     15 	void		*l_ld;		/* Pointer to .dynamic in memory */
     16 	struct link_map	*l_next;	/* linked list of of mapped libs */
     17 	struct link_map *l_prev;
     18 } Link_map;
     19 
     20 /*
     21  * Debug rendezvous struct. Pointer to this is set up in the
     22  * target code pointed by the DT_DEBUG tag. If it is
     23  * defined.
     24  */
     25 struct r_debug {
     26 	int r_version;			/* protocol version */
     27 	struct link_map *r_map;		/* list of loaded images */
     28 
     29 	/*
     30 	 * This is the address of a function internal to the run-time linker,
     31 	 * that will always be called when the linker begins to map in a
     32 	 * library or unmap it, and again when the mapping change is complete.
     33 	 * The debugger can set a breakpoint at this address if it wants to
     34 	 * notice shared object mapping changes.
     35 	 */
     36 	void (*r_brk)(void);		/* pointer to break point */
     37 	enum {
     38 		/*
     39 		 * This state value describes the mapping change taking place
     40 		 * when the `r_brk' address is called.
     41 		 */
     42 		RT_CONSISTENT,		/* things are stable */
     43 		RT_ADD,			/* adding a shared library */
     44 		RT_DELETE		/* removing a shared library */
     45 	} r_state;
     46 };
     47 
     48 struct dl_phdr_info
     49 {
     50 	Elf_Addr dlpi_addr;			/* module relocation base */
     51 	const char *dlpi_name;			/* module name */
     52 	const Elf_Phdr *dlpi_phdr;		/* pointer to module's phdr */
     53 	Elf_Half dlpi_phnum;			/* number of entries in phdr */
     54 	unsigned long long int dlpi_adds;	/* total # of loads */
     55 	unsigned long long int dlpi_subs;	/* total # of unloads */
     56 	size_t dlpi_tls_modid;
     57 	void *dlpi_tls_data;
     58 };
     59 
     60 __BEGIN_DECLS
     61 
     62 int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
     63     void *);
     64 
     65 __END_DECLS
     66 
     67 #endif	/* _LINK_ELF_H_ */
     68