aboutsummaryrefslogtreecommitdiff
path: root/include/link.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-03-01 06:18:49 +0000
committerRoland McGrath <roland@gnu.org>2006-03-01 06:18:49 +0000
commitd78efd9f369a8fc46229fc9224e10e3781eecc43 (patch)
tree2ab775602fdf94ce710efb518002de4a93bfab0e /include/link.h
parent0b890d59bd75cb8ab9232ab72ed8674054e11fa3 (diff)
downloadglibc-d78efd9f369a8fc46229fc9224e10e3781eecc43.zip
glibc-d78efd9f369a8fc46229fc9224e10e3781eecc43.tar.gz
glibc-d78efd9f369a8fc46229fc9224e10e3781eecc43.tar.bz2
* elf/tst-tls-dlinfo.c: New file.
* elf/Makefile (tests): Add it. ($(objpfx)tst-tls-dlinfo): Depend on $(libdl). ($(objpfx)tst-tls-dlinfo.out): Depend on $(objpfx)tst-tlsmod2.so. * dlfcn/dlfcn.h (RTLD_DI_PROFILENAME, RTLD_DI_PROFILEOUT): New enum values, reserve unsupported requested names used on Solaris. (RTLD_DI_TLS_MODID, RTLD_DI_TLS_DATA): New enum values. (RTLD_DI_MAX): Likewise. * dlfcn/dlinfo.c (dlinfo_doit): Handle RTLD_DI_TLS_MODID and RTLD_DI_TLS_DATA. * elf/dl-tls.c (_dl_tls_get_addr_soft): New function. * sysdeps/generic/ldsodefs.h: Declare it. * elf/Versions (ld: GLIBC_PRIVATE): Add it. * elf/link.h (struct dl_phdr_info): New members dlpi_tls_modid, dlpi_tls_data. * elf/dl-iteratephdr.c (__dl_iterate_phdr): Fill them in. * include/link.h: Don't copy contents from elf/link.h. Instead, #include it while #define'ing around link_map. * elf/dl-debug.c (_dl_debug_initialize): Add a cast. Add bogus extern decl to verify link_map members. * elf/loadtest.c (MAPS): New macro, cast _r_debug._r_map. (OUT, main): Use it in place of _r_debug._r_map. * elf/unload.c: Likewise. * elf/unload2.c: Likewise. * elf/neededtest.c (check_loaded_objects): Likewise. * elf/neededtest2.c (check_loaded_objects): Likewise. * elf/neededtest3.c (check_loaded_objects): Likewise. * elf/neededtest4.c (check_loaded_objects): Likewise. * elf/circleload1.c (check_loaded_objects): Likewise.
Diffstat (limited to 'include/link.h')
-rw-r--r--include/link.h130
1 files changed, 21 insertions, 109 deletions
diff --git a/include/link.h b/include/link.h
index 0c35264..3079ae8 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,67 +18,32 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _LINK_H
-#define _LINK_H 1
+#ifndef _PRIVATE_LINK_H
+#define _PRIVATE_LINK_H 1
-#include <elf.h>
-#include <dlfcn.h>
-#include <stddef.h>
-#include <sys/types.h>
+#ifdef _LINK_H
+# error this should be impossible
+#endif
+
+/* Get most of the contents from the public header, but we define a
+ different `struct link_map' type for private use. The la_objopen
+ prototype uses the type, so we have to declare it separately. */
+#define link_map link_map_public
+#define la_objopen la_objopen_wrongproto
+#include <elf/link.h>
+#undef link_map
+#undef la_objopen
+
+struct link_map;
+extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid,
+ uintptr_t *__cookie);
-/* We use this macro to refer to ELF types independent of the native wordsize.
- `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
-#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
-#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
-#define _ElfW_1(e,w,t) e##w##t
-#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
-#include <bits/link.h>
+#include <stddef.h>
#include <bits/linkmap.h>
#include <dl-lookupcfg.h>
#include <tls.h> /* Defines USE_TLS. */
-/* Rendezvous structure used by the run-time dynamic linker to communicate
- details of shared object loading to the debugger. If the executable's
- dynamic section has a DT_DEBUG element, the run-time linker sets that
- element's value to the address where this structure can be found. */
-
-struct r_debug
- {
- int r_version; /* Version number for this protocol. */
-
- struct link_map *r_map; /* Head of the chain of loaded objects. */
-
- /* 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. */
- ElfW(Addr) r_brk;
- enum
- {
- /* This state value describes the mapping change taking place when
- the `r_brk' address is called. */
- RT_CONSISTENT, /* Mapping change is complete. */
- RT_ADD, /* Beginning to add a new object. */
- RT_DELETE /* Beginning to remove an object mapping. */
- } r_state;
-
- ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */
- };
-
-/* This is the instance of that structure used by the dynamic linker. */
-extern struct r_debug _r_debug;
-
-/* 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; ++dyn)
- if (dyn->d_tag == DT_DEBUG)
- r_debug = (struct r_debug *) dyn->d_un.d_ptr;
- */
-extern ElfW(Dyn) _DYNAMIC[];
-
/* Some internal data structures of the dynamic linker used in the
linker map. We only provide forward declarations. */
@@ -316,45 +281,6 @@ struct link_map
} l_audit[0];
};
-/* Version numbers for la_version handshake interface. */
-#define LAV_CURRENT 1
-
-/* Activity types signaled through la_activity. */
-enum
- {
- LA_ACT_CONSISTENT,
- LA_ACT_ADD,
- LA_ACT_DELETE
- };
-
-/* Values representing origin of name for dynamic loading. */
-enum
- {
- LA_SER_ORIG = 0x01, /* Original name. */
- LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */
- LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */
- LA_SER_CONFIG = 0x08, /* Found through ldconfig. */
- LA_SER_DEFAULT = 0x40, /* Default directory. */
- LA_SER_SECURE = 0x80 /* Unused. */
- };
-
-/* Values for la_objopen return value. */
-enum
- {
- LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */
- LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */
- };
-
-/* Values for la_symbind flags parameter. */
-enum
- {
- LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */
- LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */
- LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */
- LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */
- LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous
- la_symbind call. */
- };
#if __ELF_NATIVE_CLASS == 32
# define symbind symbind32
@@ -364,22 +290,8 @@ enum
# error "__ELF_NATIVE_CLASS must be defined"
#endif
-struct dl_phdr_info
- {
- ElfW(Addr) dlpi_addr;
- const char *dlpi_name;
- const ElfW(Phdr) *dlpi_phdr;
- ElfW(Half) dlpi_phnum;
-
- unsigned long long int dlpi_adds;
- unsigned long long int dlpi_subs;
- };
-
-extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
- size_t size, void *data),
- void *data);
extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
size_t size, void *data),
void *data);
-#endif /* link.h */
+#endif /* include/link.h */