2020-09-22 04:52:16 +03:00
|
|
|
/* $NetBSD: link_elf.h,v 1.13 2020/09/22 01:52:16 kamil Exp $ */
|
1999-03-20 01:06:36 +03:00
|
|
|
|
|
|
|
#ifndef _LINK_ELF_H_
|
|
|
|
#define _LINK_ELF_H_
|
1996-12-16 23:37:55 +03:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
2010-10-16 14:27:06 +04:00
|
|
|
#include <sys/exec_elf.h>
|
1998-10-30 08:43:40 +03:00
|
|
|
|
2020-09-21 19:08:57 +03:00
|
|
|
#define R_DEBUG_VERSION 1 /* SVR4 Protocol version */
|
|
|
|
|
2009-11-04 22:28:03 +03:00
|
|
|
typedef struct link_map {
|
1999-03-01 19:40:07 +03:00
|
|
|
caddr_t l_addr; /* Base Address of library */
|
1998-03-25 07:12:32 +03:00
|
|
|
#ifdef __mips__
|
1999-03-01 19:40:07 +03:00
|
|
|
caddr_t l_offs; /* Load Offset of library */
|
1998-03-25 07:12:32 +03:00
|
|
|
#endif
|
1999-03-01 19:40:07 +03:00
|
|
|
const char *l_name; /* Absolute Path to Library */
|
|
|
|
void *l_ld; /* Pointer to .dynamic in memory */
|
2020-09-22 04:52:16 +03:00
|
|
|
struct link_map *l_next; /* linked list of mapped libs */
|
1999-03-01 19:40:07 +03:00
|
|
|
struct link_map *l_prev;
|
2009-11-04 22:28:03 +03:00
|
|
|
} Link_map;
|
1996-12-16 23:37:55 +03:00
|
|
|
|
2010-10-14 11:51:21 +04:00
|
|
|
/*
|
2020-09-21 05:20:27 +03:00
|
|
|
* Debug rendezvous struct. Pointer to this is set up in the
|
|
|
|
* target code pointed by the DT_DEBUG tag. If it is
|
|
|
|
* defined.
|
2010-10-14 11:51:21 +04:00
|
|
|
*/
|
1996-12-16 23:37:55 +03:00
|
|
|
struct r_debug {
|
2020-09-21 05:20:27 +03:00
|
|
|
int r_version; /* protocol version */
|
1999-03-01 19:40:07 +03:00
|
|
|
struct link_map *r_map; /* list of loaded images */
|
2020-09-21 05:20:27 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the address of a function internal to the run-time linker,
|
|
|
|
* that will always be called when the linker begins to map in a
|
|
|
|
* library or unmap it, and again when the mapping change is complete.
|
|
|
|
* The debugger can set a breakpoint at this address if it wants to
|
|
|
|
* notice shared object mapping changes.
|
|
|
|
*/
|
2006-01-12 01:50:35 +03:00
|
|
|
void (*r_brk)(void); /* pointer to break point */
|
1996-12-16 23:37:55 +03:00
|
|
|
enum {
|
2020-09-21 05:20:27 +03:00
|
|
|
/*
|
|
|
|
* This state value describes the mapping change taking place
|
|
|
|
* when the `r_brk' address is called.
|
|
|
|
*/
|
1999-03-01 19:40:07 +03:00
|
|
|
RT_CONSISTENT, /* things are stable */
|
|
|
|
RT_ADD, /* adding a shared library */
|
|
|
|
RT_DELETE /* removing a shared library */
|
|
|
|
} r_state;
|
2020-09-21 19:08:57 +03:00
|
|
|
void *r_ldbase; /* base address of RTLD */
|
1996-12-16 23:37:55 +03:00
|
|
|
};
|
1999-03-01 19:40:07 +03:00
|
|
|
|
2010-10-16 14:27:06 +04:00
|
|
|
struct dl_phdr_info
|
|
|
|
{
|
|
|
|
Elf_Addr dlpi_addr; /* module relocation base */
|
|
|
|
const char *dlpi_name; /* module name */
|
|
|
|
const Elf_Phdr *dlpi_phdr; /* pointer to module's phdr */
|
|
|
|
Elf_Half dlpi_phnum; /* number of entries in phdr */
|
|
|
|
unsigned long long int dlpi_adds; /* total # of loads */
|
|
|
|
unsigned long long int dlpi_subs; /* total # of unloads */
|
|
|
|
size_t dlpi_tls_modid;
|
|
|
|
void *dlpi_tls_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
|
|
|
|
void *);
|
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
1999-03-20 01:06:36 +03:00
|
|
|
#endif /* _LINK_ELF_H_ */
|