xref: /illumos-gate/usr/src/cmd/sgs/include/rtld.h (revision 6a604193b70017bd933cd973200b3f13803674b2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_RTLD_H
28 #define	_RTLD_H
29 
30 /*
31  * Global include file for the runtime linker.
32  */
33 #include <time.h>
34 #include <sgs.h>
35 #include <thread.h>
36 #include <synch.h>
37 #include <link.h>
38 #include <sys/avl.h>
39 #include <alist.h>
40 #include <libc_int.h>
41 
42 #ifdef	_SYSCALL32
43 #include <inttypes.h>
44 #endif
45 
46 #ifdef	__cplusplus
47 extern "C" {
48 #endif
49 
50 
51 /*
52  * Linked list of directories or filenames (built from colon separated string).
53  */
54 typedef struct pnode {
55 	const char	*p_name;
56 	const char	*p_oname;
57 	size_t		p_len;
58 	uint_t		p_orig;
59 	void		*p_info;
60 	struct pnode	*p_next;
61 } Pnode;
62 
63 typedef struct rt_map	Rt_map;
64 
65 /*
66  * A binding descriptor.  Establishes the binding relationship between two
67  * objects, the caller (originator) and the dependency (destination).
68  */
69 typedef struct {
70 	Rt_map		*b_caller;	/* caller (originator) of a binding */
71 	Rt_map		*b_depend;	/* dependency (destination) of a */
72 					/*	binding */
73 	uint_t		b_flags;	/* relationship of caller to the */
74 					/*	dependency */
75 } Bnd_desc;
76 
77 #define	BND_NEEDED	0x0001		/* caller NEEDED the dependency */
78 #define	BND_REFER	0x0002		/* caller relocation references the */
79 					/*	dependency */
80 #define	BND_FILTER	0x0004		/* pseudo binding to identify filter */
81 
82 /*
83  * Private structure for communication between rtld_db and rtld.
84  *
85  * We must bump the version number when ever an update in one of the
86  * structures/fields that rtld_db reads is updated.  This hopefully permits
87  * rtld_db implementations of the future to recognize core files produced on
88  * older systems and deal with these core files accordingly.
89  *
90  * As of version 'RTLD_DB_VERSION <= 2' the following fields were valid for core
91  * file examination (basically the public Link_map):
92  *
93  *		ADDR()
94  *		NAME()
95  *		DYN()
96  *		NEXT()
97  *		PREV()
98  *
99  * Valid fields for RTLD_DB_VERSION3
100  *
101  *		PATHNAME()
102  *		PADSTART()
103  *		PADIMLEN()
104  *		MSIZE()
105  *		FLAGS()
106  *		FLAGS1()
107  *
108  * Valid fields for RTLD_DB_VERSION4
109  *
110  *		TLSMODID()
111  *
112  * Valid fields for RTLD_DB_VERSION5
113  *
114  *		Added rtld_flags & FLG_RT_RELOCED to stable flags range
115  *
116  */
117 #define	R_RTLDDB_VERSION1	1	/* base version level - used for core */
118 					/*	file examination */
119 #define	R_RTLDDB_VERSION2	2	/* minor revision - not relevant for */
120 					/*	core files */
121 #define	R_RTLDDB_VERSION3	3
122 #define	R_RTLDDB_VERSION4	4
123 #define	R_RTLDDB_VERSION5	5
124 #define	R_RTLDDB_VERSION	R_RTLDDB_VERSION5	/* current version */
125 
126 typedef struct rtld_db_priv {
127 	struct r_debug	rtd_rdebug;	/* original r_debug structure */
128 	Word		rtd_version;	/* version no. */
129 	size_t		rtd_objpad;	/* padding around mmap()ed objects */
130 	List *		rtd_dynlmlst;	/* pointer to Dynlm_list */
131 } Rtld_db_priv;
132 
133 #ifdef _SYSCALL32
134 typedef struct rtld_db_priv32 {
135 	struct r_debug32 rtd_rdebug;	/* original r_debug structure */
136 	Elf32_Word	rtd_version;	/* version no. */
137 	Elf32_Word	rtd_objpad;	/* padding around mmap()ed objects */
138 	Elf32_Addr	rtd_dynlmlst;	/* pointer to Dynlm_list */
139 } Rtld_db_priv32;
140 #endif	/* _SYSCALL32 */
141 
142 /*
143  * External function definitions.  ld.so.1 must convey information to libc in
144  * regards to threading.  libc also provides routines for atexit() and message
145  * localization.  libc provides the necessary interfaces via its RTLDINFO
146  * structure and/or later _ld_libc() calls.
147  *
148  * These external functions are maintained for each link-map list, and used
149  * where appropriate.  The functions are associated with the object that
150  * provided them, so that should the object be deleted (say, from an alternative
151  * link-map), the functions can be removed.
152  */
153 typedef struct {
154 	Rt_map	*lc_lmp;			/* function provider */
155 	union {
156 		int		(*lc_func)();	/* external function pointer */
157 		uintptr_t	lc_val;		/* external value */
158 		char    	*lc_ptr;	/* external character pointer */
159 	} lc_un;
160 } Lc_desc;
161 
162 /*
163  * Link map list definition.  Link-maps are used to describe each loaded object.
164  * Lists of these link-maps describe the various namespaces within a process.
165  * The process executable and its dependencies are maintained on the lml_main
166  * list.  The runtime linker, and its dependencies are maintained on the
167  * lml_rtld list.  Additional lists can be created (see dlmopen()) for such
168  * things as auditors and their dependencies.
169  *
170  * Each link-map list maintains an Alist of one, or more, linked lists of
171  * link-maps.  For backward compatibility, the lm_head/lm_tail elements are
172  * initialized to the first linked-list of link-maps:
173  *
174  *      Lm_list
175  *    ----------
176  *   | lm_tail  | ------------------------------------
177  *   | lm_head  | --------------------                |
178  *   |          |                     |     Rt_map    |     Rt_map
179  *   |          |                     |     ------    |     ------
180  *   |          |          Alist       --> |      |   |--> |      |
181  *   |          |        ---------    |    |      | --     |      |
182  *   | lm_lists | ----> |         |   |    |      |    --> |      |
183  *   |          |       |---------|   |    |      |   |    |      |
184  *   |          |       | lc_head | --      ------    |     ------
185  *   |          |       | lc_tail | ------------------
186  *   |          |       |---------|
187  *                      | lc_head |
188  *                      | lc_tail |
189  *                      |---------|
190  *
191  * Multiple link-map lists exist to support the addition of lazy loaded
192  * families, filtee families, and dlopen() families.  The intent of these
193  * lists is to insure that a family of objects that are to be loaded are
194  * fully relocatable, and hence usable, before they become part of the main
195  * (al_data[0]) link-map control list.  This main link-map control list is
196  * the only list in existence when control is transferred to user code.
197  *
198  * During process initialization, the dynamic executable and its non-lazy
199  * dependencies are maintained on al_data[0].  If a new object is loaded, then
200  * this object is added to the next available control list [1], typically
201  * al_data[1].  Any dependencies of this object that have not already been
202  * loaded are added to the same control list.  Once all of the objects on the
203  * new control list have been successfully relocated, the objects are moved from
204  * the new control list to the highest control list to which objects of the new
205  * control list bound to, typically al_data[1] to al_data[0].
206  *
207  * Each loading scenario can be broken down as follows:
208  *
209  *  setup() - only the initial link-map control list is used:
210  *   i.	  create al_data[0]
211  *   ii.  add new link-map for main on al_data[0]
212  *   iii. analyze al_data[0] to add all non-lazy dependencies
213  *   iv.  relocate al_data[0] dependencies.
214  *
215  *  dlopen() - the initiator can only be the initial link-map control list:
216  *   i.   create al_data[1] from caller al_data[0]
217  *   ii.  add new link-map for the dlopen'ed object on al_data[1]
218  *   iii. analyze al_data[1] to add all non-lazy dependencies
219  *   iv.  relocate al_data[1] dependencies, and move to al_data[0].
220  *
221  *  filtee and lazy loading processing - the initiator can be any link-map
222  *  control list that is being relocated:
223  *   i.   create al_data[y] from caller al_data[x]
224  *   ii.  add new link-map for the new object on al_data[y]
225  *   iii. analyze al_data[y] to add all non-lazy dependencies
226  *   iv.  relocate al_data[y] dependencies, and move to al_data[x].
227  *
228  * This Alist therefore maintains a stack of link-map control lists.  The newest
229  * link-map control list can locate symbols within any of the former lists,
230  * however, control is not passed to a former list until the newest lists
231  * processing is complete.  Thus, objects can't bind to new objects until they
232  * have been fully analyzed and relocated.
233  *
234  * [1]  Note, additional link-map control list creation occurs after the head
235  * link-map object (typically the dynamic executable) has been relocated.  This
236  * staging is required to satisfy the binding requirements of copy relocations.
237  * Copy relocations, effectively, transfer the bindings of the copied data
238  * (say _iob in libc.so.1) to the copy location (_iob in the application).
239  * Thus an object that might bind to the original copy data must be redirected
240  * to the copy reference.  As the knowledge of a copy relocation having taken
241  * place is only known after relocating the application, link-map control list
242  * additions are suspended until after this relocation has completed.
243  */
244 typedef struct {
245 	Rt_map		*lc_head;
246 	Rt_map		*lc_tail;
247 	APlist		*lc_now;	/* pending promoted bind-now objects */
248 	uint_t		lc_flags;
249 } Lm_cntl;
250 
251 #define	LMC_FLG_ANALYZING	0x01	/* control list is being analyzed */
252 #define	LMC_FLG_RELOCATING	0x02	/* control list is being relocated */
253 #define	LMC_FLG_REANALYZE	0x04	/* repeat analysis (established when */
254 					/*	interposers are added */
255 
256 struct lm_list {
257 	/*
258 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
259 	 */
260 	Rt_map		*lm_head;	/* linked list pointers to active */
261 	Rt_map		*lm_tail;	/*	link-map list */
262 	APlist		*lm_handle;	/* not used by rtld_db - but spacing */
263 					/*	is required for flags */
264 	Word		lm_flags;
265 	/*
266 	 * END: Exposed to rtld_db - don't move, don't delete
267 	 */
268 	Alist		*lm_rti;	/* list of RTLDINFO tables */
269 	Audit_list	*lm_alp;	/* audit list descriptor */
270 	avl_tree_t	*lm_fpavl;	/* avl tree of objects loaded */
271 	Alist		*lm_lists;	/* active and pending link-map lists */
272 	char		***lm_environ;	/* pointer to environment array */
273 	Word		lm_tflags;	/* transferable flags */
274 	uint_t		lm_obj;		/* total number of objs on link-map */
275 	uint_t		lm_init;	/* new obj since last init processing */
276 	uint_t		lm_lazy;	/* obj with pending lazy dependencies */
277 	uint_t		lm_tls;		/* new obj that require TLS */
278 	uint_t		lm_lmid;	/* unique link-map list identifier, */
279 	char		*lm_lmidstr;	/* and associated diagnostic string */
280 	APlist		*lm_actaudit;	/* list of pending audit activity */
281 	Lc_desc		lm_lcs[CI_MAX];	/* external libc functions */
282 };
283 
284 #ifdef	_SYSCALL32
285 struct lm_list32 {
286 	/*
287 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
288 	 */
289 	Elf32_Addr	lm_head;
290 	Elf32_Addr	lm_tail;
291 	Elf32_Addr	lm_handle;
292 	Elf32_Word	lm_flags;
293 	/*
294 	 * END: Exposed to rtld_db - don't move, don't delete
295 	 */
296 	Elf32_Addr	lm_rti;
297 	Elf32_Addr	lm_fpavl;
298 	Elf32_Addr	lm_lists;
299 	Elf32_Addr	lm_environ;
300 	Elf32_Word	lm_tflags;
301 	uint_t		lm_obj;
302 	uint_t		lm_init;
303 	uint_t		lm_lazy;
304 	uint_t		lm_tls;
305 	uint_t		lm_lmid;
306 	Elf32_Addr	lm_lmidstr;
307 	Elf32_Addr	lm_actaudit;
308 	Elf32_Addr	lm_lcs[CI_MAX];
309 };
310 #endif /* _SYSCALL32 */
311 
312 /*
313  * Possible Link_map list flags (Lm_list.lm_flags)
314  */
315 /*
316  * BEGIN: Exposed to rtld_db - don't move, don't delete
317  */
318 #define	LML_FLG_BASELM		0x00000001	/* primary link-map */
319 #define	LML_FLG_RTLDLM		0x00000002	/* rtld link-map */
320 /*
321  * END: Exposed to rtld_db - don't move, don't delete
322  */
323 #define	LML_FLG_NOAUDIT		0x00000004	/* symbol auditing disabled */
324 #define	LML_FLG_PLTREL		0x00000008	/* deferred plt relocation */
325 						/* 	initialization */
326 						/*	(ld.so.1 only) */
327 #define	LML_FLG_HOLDLOCK	0x00000010	/* hold the rtld mutex lock */
328 #define	LML_FLG_ENVIRON		0x00000020	/* environ var initialized */
329 #define	LML_FLG_INTRPOSE	0x00000040	/* interposing objs on list */
330 #define	LML_FLG_LOCAUDIT	0x00000080	/* local auditors exists for */
331 						/*	this link-map list */
332 #define	LML_FLG_LOADAVAIL	0x00000100	/* load anything available */
333 #define	LML_FLG_IGNRELERR	0x00000200	/* ignore relocation errors - */
334 						/*	internal for crle(1) */
335 #define	LML_FLG_DBNOTIF		0x00000400	/* binding activity going on */
336 #define	LML_FLG_STARTREL	0x00000800	/* relocation started */
337 #define	LML_FLG_ATEXIT		0x00001000	/* atexit processing */
338 #define	LML_FLG_OBJADDED	0x00002000	/* object(s) added */
339 #define	LML_FLG_OBJDELETED	0x00004000	/* object(s) deleted */
340 #define	LML_FLG_OBJREEVAL	0x00008000	/* existing object(s) needs */
341 						/*	tsort reevaluation */
342 #define	LML_FLG_NOPENDGLBLAZY	0x00010000	/* no pending, global, lazy */
343 						/*	dependencies remain */
344 #define	LML_FLG_INTRPOSETSORT	0x00020000	/* interpose tsorting done */
345 #define	LML_FLG_AUDITNOTIFY	0x00040000	/* audit consistent required */
346 #define	LML_FLG_GROUPSEXIST	0x00080000	/* local groups exist */
347 
348 #define	LML_FLG_TRC_LDDSTUB	0x00100000	/* identify lddstub */
349 #define	LML_FLG_TRC_ENABLE	0x00200000	/* tracing enabled (ldd) */
350 #define	LML_FLG_TRC_WARN	0x00400000	/* print warnings for undefs */
351 #define	LML_FLG_TRC_VERBOSE	0x00800000	/* verbose (versioning) trace */
352 #define	LML_FLG_TRC_SEARCH	0x01000000	/* trace search paths */
353 #define	LML_FLG_TRC_UNREF	0x02000000	/* trace unreferenced */
354 						/*	dependencies */
355 #define	LML_FLG_TRC_UNUSED	0x04000000	/* trace unused dependencies */
356 #define	LML_FLG_TRC_INIT	0x08000000	/* print .init order */
357 #define	LML_FLG_TRC_NOUNRESWEAK	0x10000000	/* unresolved weak references */
358 						/*	are not allowed */
359 #define	LML_FLG_TRC_NOPAREXT	0x20000000	/* unresolved PARENT/EXTERN */
360 						/*	references are not */
361 						/*	allowed */
362 #define	LML_MSK_TRC		0xfff00000	/* tracing mask */
363 
364 /*
365  * Possible Link_map transferable flags (Lm_list.lm_tflags), i.e., link-map
366  * list flags that can be propagated to any new link-map list created.
367  */
368 #define	LML_TFLG_NOLAZYLD	0x00000001	/* lazy loading disabled */
369 #define	LML_TFLG_NODIRECT	0x00000002	/* direct bindings disabled */
370 
371 #define	LML_TFLG_LOADFLTR	0x00000008	/* trigger filtee loading */
372 
373 #define	LML_TFLG_AUD_PREINIT	0x00100000	/* preinit (audit) exists */
374 #define	LML_TFLG_AUD_OBJSEARCH	0x00200000	/* objsearch (audit) exists */
375 #define	LML_TFLG_AUD_OBJOPEN	0x00400000	/* objopen (audit) exists */
376 #define	LML_TFLG_AUD_OBJFILTER	0x00800000	/* objfilter (audit) exists */
377 #define	LML_TFLG_AUD_OBJCLOSE	0x01000000	/* objclose (audit) exists */
378 #define	LML_TFLG_AUD_SYMBIND	0x02000000	/* symbind (audit) exists */
379 #define	LML_TFLG_AUD_PLTENTER	0x04000000	/* pltenter (audit) exists */
380 #define	LML_TFLG_AUD_PLTEXIT	0x08000000	/* pltexit (audit) exists */
381 #define	LML_TFLG_AUD_ACTIVITY	0x10000000	/* activity (audit) exists */
382 
383 /*
384  * NOTE: Audit flags have duplicated FLAGS1() values.  If more audit flags are
385  * added, update the FLAGS1() reservation FL1_AUD_RS_STR to FL1_AUD_RS_END
386  * defined later.
387  */
388 #define	LML_TFLG_AUD_MASK	0xfff00000	/* audit interfaces mask */
389 
390 /*
391  * Define a Group Handle.
392  *
393  * The capability of ld.so.1 to associate a group of objects, look for symbols
394  * within that group, ensure that groups are isolated from one another (with
395  * regard to relocations), and to unload a group, centers around a handle.  This
396  * data structure is tracked from the link-map HANDLE(), and is the structure
397  * returned from dlopen(), and similar object loading capabilities such as
398  * filter/filtee processing.
399  *
400  * A handle keeps track of all the dependencies of the associated object.
401  * These dependencies may be added as objects are lazily loaded.  The core
402  * dependencies on the handle are the ldd(1) list of the associated object.
403  * The object assigned the handle, and the parent (or caller) who requested the
404  * handle are also maintained as dependencies on the handle.
405  *
406  * Presently, an object may have two handles, one requested with RTLD_FIRST
407  * and one without.
408  *
409  * A handle may be referenced by any number of parents (callers).  A reference
410  * count tracks the number.  A dlclose() operation drops the reference count,
411  * and when the count is zero, the handle is used to determine the family of
412  * objects to unload.  As bindings may occur to objects on the handle from
413  * other handles, it may not be possible to remove a complete family of
414  * objects or that handle itself.  Handles in this state are moved to an orphan
415  * list.  A handle on the orphan list is taken off the orphan list if the
416  * associated object is reopened.  Otherwise, the handle remains on the orphan
417  * list for the duration of the process.  The orphan list is inspected any time
418  * objects are unloaded, to determine if the orphaned objects can also be
419  * unloaded.
420  *
421  * Objects can be dlopened using RTLD_NOW.  This attribute requires that all
422  * relocations of the object, and its dependencies are processed immediately,
423  * before return to the caller.  Typically, an object is loaded without
424  * RTLD_NOW, and procedure linkage relocations are satisfied when their
425  * associated function is first called.  If an object is already loaded, and an
426  * RTLD_NOW request is made, then the object, and its dependencies, most undergo
427  * additional relocation processing.   This promotion from lazy binding to
428  * immediate binding is carried out using handles, as the handle defines the
429  * dependencies that must be processed.  A temporary handle is created for this
430  * purpose, and is discarded immediately after the promotion operation has been
431  * completed.
432  */
433 typedef struct {
434 	Alist		*gh_depends;	/* handle dependency list */
435 	Rt_map		*gh_ownlmp;	/* handle owners link-map */
436 	Lm_list		*gh_ownlml;	/* handle owners link-map list */
437 	uint_t		gh_refcnt;	/* handle reference count */
438 	uint_t		gh_flags;	/* handle flags (GPH_ values) */
439 } Grp_hdl;
440 
441 #define	GPH_ZERO	0x0001		/* special handle for dlopen(0) */
442 #define	GPH_LDSO	0x0002		/* special handle for ld.so.1 */
443 #define	GPH_FIRST	0x0004		/* dlsym() can only use originating */
444 					/*	dependency */
445 #define	GPH_FILTEE	0x0008		/* handle used to specify a filtee */
446 #define	GPH_INITIAL	0x0010		/* handle is initialized */
447 #define	GPH_NOPENDLAZY	0x0020		/* no pending lazy dependencies */
448 					/*	remain for this handle */
449 
450 /*
451  * Define a Group Descriptor.
452  *
453  * Each dependency associated with a group handle is maintained by a group
454  * descriptor.  The descriptor defines the associated dependency together with
455  * flags that indicate how the dependency can be used.
456  */
457 typedef struct {
458 	Rt_map *	gd_depend;	/* dependency */
459 	uint_t		gd_flags;	/* dependency flags (GPD_ values) */
460 } Grp_desc;
461 
462 #define	GPD_DLSYM	0x0001		/* dependency available to dlsym() */
463 #define	GPD_RELOC	0x0002		/* dependency available to satisfy */
464 					/*	relocation binding */
465 #define	GPD_ADDEPS	0x0004		/* dependencies of this dependency */
466 					/*	should be added to handle */
467 #define	GPD_PARENT	0x0008		/* dependency is a parent */
468 #define	GPD_FILTER	0x0010		/* dependency is our filter */
469 #define	GPD_PROMOTE	0x0020		/* dependency is our RTLD_NOW */
470 					/*	promoter */
471 #define	GPD_REMOVE	0x1000		/* descriptor is a candidate for */
472 					/*	removal from the group */
473 
474 /*
475  * Define threading structures.  For compatibility with libthread (T1_VERSION 1
476  * and TI_VERSION 2) our locking structure is sufficient to hold a mutex or a
477  * readers/writers lock.
478  */
479 typedef struct {
480 	union {
481 		mutex_t		l_mutex;
482 		rwlock_t	l_rwlock;
483 	} u;
484 } Rt_lock;
485 
486 typedef	cond_t	Rt_cond;
487 
488 /*
489  * Define a dynamic section information descriptor.  This parallels the entries
490  * in the .dynamic section and holds auxiliary information to implement lazy
491  * loading and filtee processing.
492  */
493 typedef struct {
494 	uint_t	di_flags;
495 	void	*di_info;
496 } Dyninfo;
497 
498 #define	FLG_DI_STDFLTR	0x00001		/* .dynamic entry for DT_FILTER */
499 #define	FLG_DI_AUXFLTR	0x00002		/* .dynamic entry for DT_AUXILIARY */
500 #define	FLG_DI_SYMFLTR	0x00004		/* .dynamic entry for DT_SYMFILTER */
501 					/*	and DT_SYMAUXILIARY */
502 #define	MSK_DI_FILTER	0x0000f		/* mask for all filter possibilities */
503 
504 #define	FLG_DI_POSFLAG1	0x00010		/* .dynamic entry for DT_POSFLAG_1 */
505 #define	FLG_DI_NEEDED	0x00020		/* .dynamic entry for DT_NEEDED */
506 #define	FLG_DI_LAZY	0x00100		/* lazy needed entry - preceded by */
507 					/*    DF_P1_LAZYLOAD (DT_POSFLAG_1) */
508 #define	FLG_DI_GROUP	0x00200		/* group needed entry - preceded by */
509 					/*    DF_P1_GROUPPERM (DT_POSFLAG_1) */
510 
511 #define	FLG_DI_LDD_DONE	0x01000		/* entry has been processed (ldd) */
512 #define	FLG_DI_LAZYFAIL	0x02000		/* the lazy loading of this entry */
513 					/*    failed */
514 /*
515  * Data structure to track AVL tree of pathnames.  This structure provides the
516  * basis of both the "not-found" node tree, and the "full-path" node tree.  Both
517  * of these trees persist for the life of a process, although the "not-found"
518  * tree may be moved aside during a dlopen() or dlsym() fall back operation.
519  */
520 typedef struct {
521 	const char	*pn_name;	/* path name */
522 	avl_node_t	pn_avl;		/* avl book-keeping (see SGSOFFSETOF) */
523 	uint_t		pn_hash;	/* path name hash value */
524 } PathNode;
525 
526 /*
527  * Data structure to track AVL tree for full path names of objects that are
528  * loaded into memory.
529  */
530 typedef struct {
531 	PathNode	fpn_node;	/* path node */
532 	Rt_map		*fpn_lmp;	/* object link-map */
533 } FullPathNode;
534 
535 /*
536  * Define a mapping structure, which is maintained to describe each mapping
537  * of an object, ie. the text segment, data segment, bss segment, etc.
538  */
539 typedef struct {
540 	caddr_t		m_vaddr;	/* mapping address */
541 	size_t		m_fsize;	/* backing file size */
542 	size_t		m_msize;	/* mapping size */
543 	int		m_perm;		/* mapping permissions */
544 } Mmap;
545 
546 /*
547  * A given link-map can hold either a supplier or receiver copy
548  * relocation list, but not both. This union is used to overlap
549  * the space used for the two lists.
550  */
551 typedef union {
552 	Alist	*rtc_r;		/* receiver list (Rel_copy) */
553 	APlist	*rtc_s;		/* supplier list (Rt_map *) */
554 } Rt_map_copy;
555 
556 
557 /*
558  * Link-map definition.
559  */
560 struct rt_map {
561 	/*
562 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
563 	 */
564 	Link_map	rt_public;	/* public data */
565 	char		*rt_pathname;	/* full pathname of loaded object */
566 	ulong_t		rt_padstart;	/* start of image (including padding) */
567 	ulong_t		rt_padimlen;	/* size of image (including padding */
568 	ulong_t		rt_msize;	/* total memory mapped */
569 	uint_t		rt_flags;	/* state flags, see FLG below */
570 	uint_t		rt_flags1;	/* state flags1, see FL1 below */
571 	ulong_t		rt_tlsmodid;	/* TLS module id */
572 	/*
573 	 * END: Exposed to rtld_db - don't move, don't delete
574 	 */
575 	APlist		*rt_alias;	/* list of linked file names */
576 	APlist		*rt_fpnode;	/* list of FullpathNode AVL nodes */
577 	void		(*rt_init)();	/* address of _init */
578 	void		(*rt_fini)();	/* address of _fini */
579 	char		*rt_runpath;	/* LD_RUN_PATH and its equivalent */
580 	Pnode		*rt_runlist;	/*	Pnode structures */
581 	APlist		*rt_depends;	/* list of dependencies */
582 	APlist		*rt_callers;	/* list of callers */
583 	APlist		*rt_handles;	/* dlopen handles */
584 	APlist		*rt_groups;	/* groups we're a member of */
585 	ulong_t		rt_etext;	/* etext address */
586 	struct fct	*rt_fct;	/* file class table for this object */
587 	Sym		*(*rt_symintp)(); /* link map symbol interpreter */
588 	void		*rt_priv;	/* private data, object type specific */
589 	Lm_list		*rt_list;	/* link map list we belong to */
590 	uint_t		rt_objfltrndx;	/* object filtees .dynamic index */
591 	uint_t		rt_symsfltrcnt;	/* number of standard symbol filtees */
592 	uint_t		rt_symafltrcnt;	/* number of auxiliary symbol filtees */
593 	int		rt_mode;	/* usage mode, see RTLD mode flags */
594 	int		rt_sortval;	/* temporary buffer to traverse graph */
595 	uint_t		rt_cycgroup;	/* cyclic group */
596 	dev_t		rt_stdev;	/* device id and inode number for .so */
597 	ino_t		rt_stino;	/*	multiple inclusion checks */
598 	char		*rt_origname;	/* original pathname of loaded object */
599 	size_t		rt_dirsz;	/*	and its size */
600 	Rt_map_copy	rt_copy;	/* list of copy relocations */
601 	Audit_desc	*rt_auditors;	/* audit descriptor array */
602 	Audit_info	*rt_audinfo;	/* audit information descriptor */
603 	Syminfo		*rt_syminfo;	/* elf .syminfo section - here */
604 					/*	because it is checked in */
605 					/*	common code */
606 	Addr		*rt_initarray;	/* .initarray table */
607 	Addr		*rt_finiarray;	/* .finiarray table */
608 	Addr		*rt_preinitarray; /* .preinitarray table */
609 	Mmap		*rt_mmaps;	/* array of mapping information */
610 	uint_t		rt_mmapcnt;	/*	and associated number */
611 	uint_t		rt_initarraysz;	/* size of .initarray table */
612 	uint_t		rt_finiarraysz;	/* size of .finiarray table */
613 	uint_t		rt_preinitarraysz; /* size of .preinitarray table */
614 	Dyninfo		*rt_dyninfo;	/* .dynamic information descriptors */
615 	uint_t		rt_dyninfocnt;	/* count of dyninfo entries */
616 	uint_t		rt_relacount;	/* no. of RELATIVE relocations */
617 	uint_t		rt_idx;		/* hold index within linkmap list */
618 	uint_t		rt_lazy;	/* lazy dependencies pending */
619 	Rt_cond		*rt_condvar;	/*	variables */
620 	Xword		rt_hwcap;	/* hardware capabilities */
621 	Xword		rt_sfcap;	/* software capabilities */
622 	thread_t	rt_threadid;	/* thread init/fini synchronization */
623 	uint_t		rt_cntl;	/* link-map control list we belong to */
624 	uint_t		rt_flags2;	/* state flags2, see FL2 below */
625 };
626 
627 
628 #ifdef _SYSCALL32
629 /*
630  * Structure to allow 64-bit rtld_db to read 32-bit processes out of procfs.
631  */
632 typedef union {
633 	uint32_t	rtc_r;
634 	uint32_t	rtc_s;
635 } Rt_map_copy32;
636 
637 typedef struct rt_map32 {
638 	/*
639 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
640 	 */
641 	Link_map32	rt_public;
642 	uint32_t	rt_pathname;
643 	uint32_t	rt_padstart;
644 	uint32_t	rt_padimlen;
645 	uint32_t	rt_msize;
646 	uint32_t	rt_flags;
647 	uint32_t	rt_flags1;
648 	uint32_t	rt_tlsmodid;
649 	/*
650 	 * END: Exposed to rtld_db - don't move, don't delete
651 	 */
652 	uint32_t	rt_alias;
653 	uint32_t	rt_fpnode;
654 	uint32_t 	rt_init;
655 	uint32_t	rt_fini;
656 	uint32_t	rt_runpath;
657 	uint32_t	rt_runlist;
658 	uint32_t	rt_depends;
659 	uint32_t	rt_callers;
660 	uint32_t	rt_handles;
661 	uint32_t	rt_groups;
662 	uint32_t	rt_etext;
663 	uint32_t	rt_fct;
664 	uint32_t	rt_symintp;
665 	uint32_t	rt_priv;
666 	uint32_t 	rt_list;
667 	uint32_t 	rt_objfltrndx;
668 	uint32_t 	rt_symsfltrcnt;
669 	uint32_t 	rt_symafltrcnt;
670 	int32_t		rt_mode;
671 	int32_t		rt_sortval;
672 	uint32_t	rt_cycgroup;
673 	uint32_t	rt_stdev;
674 	uint32_t	rt_stino;
675 	uint32_t	rt_origname;
676 	uint32_t	rt_dirsz;
677 	Rt_map_copy32	rt_copy;
678 	uint32_t 	rt_auditors;
679 	uint32_t 	rt_audinfo;
680 	uint32_t	rt_syminfo;
681 	uint32_t	rt_initarray;
682 	uint32_t	rt_finiarray;
683 	uint32_t	rt_preinitarray;
684 	uint32_t	rt_mmaps;
685 	uint32_t	rt_mmapcnt;
686 	uint32_t	rt_initarraysz;
687 	uint32_t	rt_finiarraysz;
688 	uint32_t	rt_preinitarraysz;
689 	uint32_t 	rt_dyninfo;
690 	uint32_t 	rt_dyninfocnt;
691 	uint32_t	rt_relacount;
692 	uint32_t	rt_idx;
693 	uint32_t	rt_lazy;
694 	uint32_t	rt_condvar;
695 	uint32_t	rt_hwcap;
696 	uint32_t	rt_sfcap;
697 	uint32_t	rt_threadid;
698 	uint32_t	rt_cntl;
699 	uint32_t	rt_flags2;
700 } Rt_map32;
701 
702 #endif	/* _SYSCALL32 */
703 
704 /*
705  * Link map state flags.
706  */
707 /*
708  * BEGIN: Exposed to rtld_db - don't move, don't delete
709  */
710 #define	FLG_RT_ISMAIN	0x00000001	/* object represents main executable */
711 #define	FLG_RT_IMGALLOC	0x00000002	/* image is allocated (not mmap'ed) */
712 	/*
713 	 * Available for r_debug version >= RTLD_DB_VERSION5
714 	 */
715 #define	FLG_RT_RELOCED	0x00000004	/* object has been relocated */
716 /*
717  * END: Exposed to rtld_db - don't move, don't delete
718  */
719 #define	FLG_RT_SETGROUP	0x00000008	/* group establishment required */
720 #define	FLG_RT_HWCAP	0x00000010	/* process $HWCAP expansion */
721 #define	FLG_RT_OBJECT	0x00000020	/* object processing (ie. .o's) */
722 #define	FLG_RT_NEWLOAD	0x00000040	/* object is newly loaded */
723 #define	FLG_RT_NODUMP	0x00000080	/* object can't be dldump(3x)'ed */
724 #define	FLG_RT_DELETE	0x00000100	/* object can be deleted */
725 #define	FLG_RT_ANALYZED	0x00000200	/* object has been analyzed */
726 #define	FLG_RT_INITDONE	0x00000400	/* objects .init has been completed */
727 #define	FLG_RT_TRANS	0x00000800	/* object is acting as a translator */
728 #define	FLG_RT_FIXED	0x00001000	/* image location is fixed */
729 #define	FLG_RT_PRELOAD	0x00002000	/* object was preloaded */
730 #define	FLG_RT_ALTER	0x00004000	/* alternative object used */
731 #define	FLG_RT_LOADFLTR	0x00008000	/* trigger filtee loading */
732 #define	FLG_RT_AUDIT	0x00010000	/* object is an auditor */
733 #define	FLG_RT_MODESET	0x00020000	/* MODE() has been initialized */
734 #define	FLG_RT_ANALZING	0x00040000	/* object is being analyzed */
735 #define	FLG_RT_INITFRST 0x00080000	/* execute .init first */
736 #define	FLG_RT_NOOPEN	0x00100000	/* dlopen() not allowed */
737 #define	FLG_RT_FINICLCT	0x00200000	/* fini has been collected (tsort) */
738 #define	FLG_RT_INITCALL	0x00400000	/* objects .init has been called */
739 #define	FLG_RT_OBJINTPO	0x00800000	/* object is a global interposer */
740 #define	FLG_RT_SYMINTPO	0x01000000	/* object contains symbol interposer */
741 #define	MSK_RT_INTPOSE	0x01800000	/* mask for all interposer */
742 					/*	possibilities */
743 #define	FLG_RT_MOVE	0x02000000	/* object needs move operation */
744 #define	FLG_RT_TMPLIST	0x04000000	/* object is part of a temporary list */
745 #define	FLG_RT_REGSYMS	0x08000000	/* object has DT_REGISTER entries */
746 #define	FLG_RT_INITCLCT	0x10000000	/* init has been collected (tsort) */
747 #define	FLG_RT_HANDLE	0x20000000	/* generate a handle for this object */
748 #define	FLG_RT_RELOCING	0x40000000	/* object is being relocated */
749 
750 #define	FL1_RT_COPYTOOK	0x00000001	/* copy relocation taken */
751 #define	FL1_RT_RELATIVE	0x00000002	/* relative path expansion required */
752 #define	FL1_RT_CONFSET	0x00000004	/* object was loaded by crle(1) */
753 #define	FL1_RT_NODEFLIB	0x00000008	/* ignore default library search */
754 #define	FL1_RT_ENDFILTE	0x00000010	/* filtee terminates filters search */
755 #define	FL1_RT_DISPREL	0x00000020	/* object has *disp* relocation */
756 #define	FL1_RT_TEXTREL	0x00000040	/* DT_TEXTREL set in object */
757 #define	FL1_RT_INITWAIT	0x00000080	/* threads are waiting on .init */
758 #define	FL1_RT_LDDSTUB	0x00000100	/* identify lddstub */
759 #define	FL1_RT_NOINIFIN	0x00000200	/* no .init or .fini exists */
760 #define	FL1_RT_USED	0x00000400	/* symbol referenced from this object */
761 #define	FL1_RT_SYMBOLIC	0x00000800	/* DF_SYMBOLIC was set - use */
762 					/*	symbolic sym resolution */
763 #define	FL1_RT_OBJSFLTR	0x00001000	/* object is acting as a standard */
764 #define	FL1_RT_OBJAFLTR	0x00002000	/*	or auxiliary filter */
765 #define	FL1_RT_SYMSFLTR	0x00004000	/* symbol is acting as a standard */
766 #define	FL1_RT_SYMAFLTR	0x00008000	/*	or auxiliary filter */
767 #define	MSK_RT_FILTER	0x0000f000	/* mask for all filter possibilities */
768 
769 #define	FL1_RT_TLSADD	0x00010000	/* objects TLS has been registered */
770 #define	FL1_RT_TLSSTAT	0x00020000	/* object requires static TLS */
771 #define	FL1_RT_DIRECT	0x00040000	/* object has DIRECT bindings enabled */
772 #define	FL1_RT_GLOBAUD	0x00080000	/* establish global auditing */
773 
774 /*
775  * The following range of bits are reserved to hold LML_TFLG_AUD_ values
776  * (although the definitions themselves aren't used anywhere).
777  */
778 #define	FL1_AUD_RS_STR	0x00100000	/* RESERVATION start for AU flags */
779 #define	FL1_AUD_RS_END	0x80000000	/* RESERVATION end for AU flags */
780 
781 #define	FL2_RT_DTFLAGS	0x00000001	/* DT_FLAGS element exists */
782 
783 /*
784  * Flags for the tls_modactivity() routine
785  */
786 #define	TM_FLG_MODADD	0x01		/* call tls_modadd() interface */
787 #define	TM_FLG_MODREM	0x02		/* call tls_modrem() interface */
788 
789 /*
790  * Macros for getting to link_map data.
791  */
792 #define	ADDR(X)		((X)->rt_public.l_addr)
793 #define	NAME(X)		((X)->rt_public.l_name)
794 #define	DYN(X)		((X)->rt_public.l_ld)
795 #define	NEXT(X)		((X)->rt_public.l_next)
796 #define	PREV(X)		((X)->rt_public.l_prev)
797 #define	REFNAME(X)	((X)->rt_public.l_refname)
798 
799 /*
800  * Macros for getting to linker private data.
801  */
802 #define	PATHNAME(X)	((X)->rt_pathname)
803 #define	PADSTART(X)	((X)->rt_padstart)
804 #define	PADIMLEN(X)	((X)->rt_padimlen)
805 #define	MSIZE(X)	((X)->rt_msize)
806 #define	FLAGS(X)	((X)->rt_flags)
807 #define	FLAGS1(X)	((X)->rt_flags1)
808 #define	FLAGS2(X)	((X)->rt_flags2)
809 #define	TLSMODID(X)	((X)->rt_tlsmodid)
810 
811 #define	ALIAS(X)	((X)->rt_alias)
812 #define	FPNODE(X)	((X)->rt_fpnode)
813 #define	INIT(X)		((X)->rt_init)
814 #define	FINI(X)		((X)->rt_fini)
815 #define	RPATH(X)	((X)->rt_runpath)
816 #define	RLIST(X)	((X)->rt_runlist)
817 #define	DEPENDS(X)	((X)->rt_depends)
818 #define	CALLERS(X)	((X)->rt_callers)
819 #define	HANDLES(X)	((X)->rt_handles)
820 #define	GROUPS(X)	((X)->rt_groups)
821 #define	ETEXT(X)	((X)->rt_etext)
822 #define	FCT(X)		((X)->rt_fct)
823 #define	SYMINTP(X)	((X)->rt_symintp)
824 #define	LIST(X)		((X)->rt_list)
825 #define	OBJFLTRNDX(X)	((X)->rt_objfltrndx)
826 #define	SYMSFLTRCNT(X)	((X)->rt_symsfltrcnt)
827 #define	SYMAFLTRCNT(X)	((X)->rt_symafltrcnt)
828 #define	MODE(X)		((X)->rt_mode)
829 #define	SORTVAL(X)	((X)->rt_sortval)
830 #define	CYCGROUP(X)	((X)->rt_cycgroup)
831 #define	STDEV(X)	((X)->rt_stdev)
832 #define	STINO(X)	((X)->rt_stino)
833 #define	ORIGNAME(X)	((X)->rt_origname)
834 #define	DIRSZ(X)	((X)->rt_dirsz)
835 #define	COPY_R(X)	((X)->rt_copy.rtc_r)
836 #define	COPY_S(X)	((X)->rt_copy.rtc_s)
837 #define	AUDITORS(X)	((X)->rt_auditors)
838 #define	AUDINFO(X)	((X)->rt_audinfo)
839 #define	SYMINFO(X)	((X)->rt_syminfo)
840 #define	INITARRAY(X)	((X)->rt_initarray)
841 #define	FINIARRAY(X)	((X)->rt_finiarray)
842 #define	PREINITARRAY(X)	((X)->rt_preinitarray)
843 #define	MMAPS(X)	((X)->rt_mmaps)
844 #define	MMAPCNT(X)	((X)->rt_mmapcnt)
845 #define	INITARRAYSZ(X)	((X)->rt_initarraysz)
846 #define	FINIARRAYSZ(X)	((X)->rt_finiarraysz)
847 #define	PREINITARRAYSZ(X) ((X)->rt_preinitarraysz)
848 #define	DYNINFO(X)	((X)->rt_dyninfo)
849 #define	DYNINFOCNT(X)	((X)->rt_dyninfocnt)
850 #define	RELACOUNT(X)	((X)->rt_relacount)
851 #define	IDX(X)		((X)->rt_idx)
852 #define	LAZY(X)		((X)->rt_lazy)
853 #define	CONDVAR(X)	((X)->rt_condvar)
854 #define	CNTL(X)		((X)->rt_cntl)
855 #define	HWCAP(X)	((X)->rt_hwcap)
856 #define	SFCAP(X)	((X)->rt_sfcap)
857 #define	THREADID(X)	((X)->rt_threadid)
858 
859 /*
860  * Flags for tsorting.
861  */
862 #define	RT_SORT_FWD	0x01		/* topological sort (.fini) */
863 #define	RT_SORT_REV	0x02		/* reverse topological sort (.init) */
864 #define	RT_SORT_DELETE	0x10		/* process FLG_RT_DELNEED objects */
865 					/*	only (called via dlclose()) */
866 #define	RT_SORT_INTPOSE	0x20		/* process interposer objects */
867 
868 /*
869  * Flags for lookup_sym (and hence find_sym) routines.
870  */
871 #define	LKUP_DEFT	0x0000		/* simple lookup request */
872 #define	LKUP_SPEC	0x0001		/* special ELF lookup (allows address */
873 					/*	resolutions to plt[] entries) */
874 #define	LKUP_LDOT	0x0002		/* indicates the original A_OUT */
875 					/*	symbol had a leading `.' */
876 #define	LKUP_FIRST	0x0004		/* lookup symbol in first link map */
877 					/*	only */
878 #define	LKUP_COPY	0x0008		/* lookup symbol for a COPY reloc, do */
879 					/*	not bind to symbol at head */
880 #define	LKUP_STDRELOC	0x0010		/* lookup originates from a standard */
881 					/*	relocation (elf_reloc()) */
882 #define	LKUP_SELF	0x0020		/* lookup symbol in ourself - undef */
883 					/*	is valid */
884 #define	LKUP_WEAK	0x0040		/* relocation reference is weak */
885 #define	LKUP_NEXT	0x0080		/* request originates from RTLD_NEXT */
886 #define	LKUP_NODESCENT	0x0100		/* don't descend through dependencies */
887 #define	LKUP_NOFALLBACK	0x0200		/* don't fall back to loading */
888 					/*	pending lazy dependencies */
889 #define	LKUP_DIRECT	0x0400		/* direct binding request */
890 #define	LKUP_SYMNDX	0x0800		/* establish symbol index */
891 #define	LKUP_SINGLETON	0x1000		/* search for a singleton symbol */
892 #define	LKUP_STANDARD	0x2000		/* standard lookup - originated from */
893 					/* 	head link-map element */
894 
895 /*
896  * For the runtime linker to perform a symbol search, a number of data items
897  * related to the search are required.  An Slookup data structure is used to
898  * convey this data to lookup_sym(), and in special cases, to other core
899  * routines that provide the implementation details for lookup_sym()
900  *
901  * The symbol name (sl_name), the caller (sl_cmap), and the link-map from which
902  * to start the search (sl_imap) are fundamental to the symbol search.  The
903  * initial search link-map might get modified by the core routines that provide
904  * the implementation details for lookup_sym().  This modification accommodates
905  * requirements such as processing a handle, direct binding and interposition.
906  * The association between the caller and the potential destination also
907  * determines whether the destination is a candidate to search.
908  *
909  * The lookup identifier (sl_id) is used to identify a runtime linker operation.
910  * Within this operation, any lazy loads that fail are not re-examined.  This
911  * technique keeps the overhead of processing a failed lazy load to a minimum.
912  *
913  * Symbol searches that originate from a relocation record are accompanied by
914  * the relocation index (sl_rsymndx), the symbol reference (sl_rsym) and
915  * possibly the relocation type (sl_rtype).  This data provides for determining
916  * lazy loading, direct binding, and special symbol processing requirements
917  * such as copy relocations and singleton lookup.
918  *
919  * The symbols hash value is computed by lookup_sym, and propagated throughout
920  * the search engine.  Note, occasionally the Slookup data is passed to a core
921  * routine that provides the implementation details for lookup_sym(), ie.
922  * elf_find_sym(), in which case the caller must initialize the hash value.
923  *
924  * The symbols binding information is established by lookup_sym() when the
925  * symbols relocation type is supplied.  Weak bindings allow relocations to
926  * be set to zero should a symbol lookup fail.
927  *
928  * The flags allow the caller to control aspects of the search, including the
929  * interpretation of copy relocations, etc.  Note, a number of flag settings
930  * are established in lookup_sym() from attributes of the symbol reference.
931  */
932 typedef struct {
933 	const char	*sl_name;	/* symbol name */
934 	Rt_map		*sl_cmap;	/* callers link-map */
935 	Rt_map		*sl_imap;	/* initial link-map to search */
936 	ulong_t		sl_id;		/* identifier for this lookup */
937 	ulong_t		sl_hash;	/* symbol hash value */
938 	ulong_t		sl_rsymndx;	/* referencing reloc symndx */
939 	Sym		*sl_rsym;	/* referencing symbol */
940 	uchar_t		sl_rtype;	/* relocation type associate with */
941 					/*    symbol */
942 	uchar_t		sl_bind;	/* symbols binding (returned) */
943 	uint_t		sl_flags;	/* lookup flags */
944 } Slookup;
945 
946 #define	SLOOKUP_INIT(sl, name, cmap, imap, id, hash, rsymndx, rsym, rtype, \
947     flags) \
948 	(void) (sl.sl_name = (name), sl.sl_cmap = (cmap), sl.sl_imap = (imap), \
949 	    sl.sl_id = (id), sl.sl_hash = (hash), sl.sl_rsymndx = (rsymndx), \
950 	    sl.sl_rsym = (rsym), sl.sl_rtype = (rtype), sl.sl_bind = 0, \
951 	    sl.sl_flags = (flags))
952 
953 /*
954  * Define a number of .plt lookup outcomes, for use in binding diagnostics.
955  */
956 typedef	enum {
957 	PLT_T_NONE = 0,
958 	PLT_T_21D,
959 	PLT_T_24D,
960 	PLT_T_U32,
961 	PLT_T_U44,
962 	PLT_T_FULL,
963 	PLT_T_FAR,
964 	PLT_T_NUM			/* Must be last */
965 } Pltbindtype;
966 
967 /*
968  * Prototypes.
969  */
970 extern ulong_t		ld_entry_cnt;	/* counter bumped on each entry to */
971 					/*    ld.so.1. */
972 extern Lm_list		lml_main;	/* main's link map list */
973 extern Lm_list		lml_rtld;	/* rtld's link map list */
974 extern Lm_list		*lml_list[];
975 
976 extern Pltbindtype	elf_plt_write(uintptr_t, uintptr_t, void *, uintptr_t,
977 			    Xword);
978 extern Rt_map		*is_so_loaded(Lm_list *, const char *, int *);
979 extern Sym		*lookup_sym(Slookup *, Rt_map **, uint_t *, int *);
980 extern int		rt_dldump(Rt_map *, const char *, int, Addr);
981 
982 #ifdef	__cplusplus
983 }
984 #endif
985 
986 #endif /* _RTLD_H */
987