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