-/* $OpenBSD: link.h,v 1.1 1996/09/17 18:26:25 pefo Exp $ */
+/* $OpenBSD: link.h,v 1.2 1996/12/11 05:55:35 imp Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
#ifndef _LINK_H
#define _LINK_H 1
-#include <elf.h>
+#include <elf_abi.h>
#include <machine/elf_abi.h>
/*
Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */
};
+/* This symbol refers to the "dynamic structure" in the `.dynamic' section
+ of whatever module refers to `_DYNAMIC'. So, to find its own
+ `struct r_debug', a program could do:
+ for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL)
+ if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr;
+ */
+
+extern Elf32_Dyn _DYNAMIC[];
+
+
+/* Structure describing a loaded shared object. The `l_next' and `l_prev'
+ members form a chain of all the shared objects loaded at startup.
+
+ These data structures exist in space used by the run-time dynamic linker;
+ modifying them may have disastrous results. */
+
+struct link_map
+ {
+ /* These first few members are part of the protocol with the debugger.
+ This is the same format used in SVR4. */
+
+ Elf32_Addr l_addr; /* Base address shared object is loaded at. */
+ Elf32_Addr l_offs; /* Offset */
+ char *l_name; /* Absolute file name object was found in. */
+ Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */
+ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
+
+ /* All following members are internal to the dynamic linker.
+ They may change without notice. */
+
+ const char *l_libname; /* Name requested (before search). */
+
+ /* Indexed pointers to dynamic section. */
+ Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM];
+
+ const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */
+ Elf32_Word l_phnum; /* Number of program header entries. */
+ Elf32_Addr l_entry; /* Entry point location. */
+
+ /* Symbol hash table. */
+ Elf32_Word l_nbuckets;
+ const Elf32_Word *l_buckets, *l_chain;
+
+ unsigned int l_opencount; /* Reference count for dlopen/dlclose. */
+ enum /* Where this object came from. */
+ {
+ lt_executable, /* The main executable program. */
+ lt_interpreter, /* The interpreter: the dynamic linker. */
+ lt_library, /* Library needed by main executable. */
+ lt_loaded, /* Extra run-time loaded shared object. */
+ } l_type:2;
+ unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */
+ unsigned int l_relocated:1; /* Nonzero if object's relocations done. */
+ unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */
+ unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
+ };
+
#endif /* _LINK_H */
-/* $OpenBSD: exec_elf.h,v 1.9 1996/11/06 18:41:52 etheisen Exp $ */
+/* $OpenBSD: exec_elf.h,v 1.10 1996/12/11 05:55:33 imp Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
#define DT_DEBUG 21 /* bugger */
#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
#define DT_JMPREL 23 /* add. of PLT's relocation entries */
+#define DT_NUM 24 /* Number used. */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */