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 (c) 1988 AT&T
24 *	  All Rights Reserved
25 *
26 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#ifndef _SYS_LINK_H
31#define	_SYS_LINK_H
32
33#pragma ident	"@(#)link.h	1.80	08/03/18 SMI"
34
35#ifndef	_ASM
36#include <sys/types.h>
37
38#include "elftypes.h" /* In lieu of Solaris <sys/types.h> */
39
40#endif
41
42#ifdef	__cplusplus
43extern "C" {
44#endif
45
46/*
47 * Communication structures for the runtime linker.
48 */
49
50/*
51 * The following data structure provides a self-identifying union consisting
52 * of a tag from a known list and a value.
53 */
54#ifndef	_ASM
55typedef struct {
56	Elf32_Sword d_tag;		/* how to interpret value */
57	union {
58		Elf32_Word	d_val;
59		Elf32_Addr	d_ptr;
60		Elf32_Off	d_off;
61	} d_un;
62} Elf32_Dyn;
63
64#if defined(_LP64) || defined(_LONGLONG_TYPE)
65typedef struct {
66	Elf64_Xword d_tag;		/* how to interpret value */
67	union {
68		Elf64_Xword	d_val;
69		Elf64_Addr	d_ptr;
70	} d_un;
71} Elf64_Dyn;
72#endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
73#endif	/* _ASM */
74
75/*
76 * Tag values
77 */
78#define	DT_NULL		0	/* last entry in list */
79#define	DT_NEEDED	1	/* a needed object */
80#define	DT_PLTRELSZ	2	/* size of relocations for the PLT */
81#define	DT_PLTGOT	3	/* addresses used by procedure linkage table */
82#define	DT_HASH		4	/* hash table */
83#define	DT_STRTAB	5	/* string table */
84#define	DT_SYMTAB	6	/* symbol table */
85#define	DT_RELA		7	/* addr of relocation entries */
86#define	DT_RELASZ	8	/* size of relocation table */
87#define	DT_RELAENT	9	/* base size of relocation entry */
88#define	DT_STRSZ	10	/* size of string table */
89#define	DT_SYMENT	11	/* size of symbol table entry */
90#define	DT_INIT		12	/* _init addr */
91#define	DT_FINI		13	/* _fini addr */
92#define	DT_SONAME	14	/* name of this shared object */
93#define	DT_RPATH	15	/* run-time search path */
94#define	DT_SYMBOLIC	16	/* shared object linked -Bsymbolic */
95#define	DT_REL		17	/* addr of relocation entries */
96#define	DT_RELSZ	18	/* size of relocation table */
97#define	DT_RELENT	19	/* base size of relocation entry */
98#define	DT_PLTREL	20	/* relocation type for PLT entry */
99#define	DT_DEBUG	21	/* pointer to r_debug structure */
100#define	DT_TEXTREL	22	/* text relocations remain for this object */
101#define	DT_JMPREL	23	/* pointer to the PLT relocation entries */
102#define	DT_BIND_NOW	24	/* perform all relocations at load of object */
103#define	DT_INIT_ARRAY	25	/* pointer to .initarray */
104#define	DT_FINI_ARRAY	26	/* pointer to .finiarray */
105#define	DT_INIT_ARRAYSZ	27	/* size of .initarray */
106#define	DT_FINI_ARRAYSZ	28	/* size of .finiarray */
107#define	DT_RUNPATH	29	/* run-time search path */
108#define	DT_FLAGS	30	/* state flags - see DF_* */
109
110/*
111 * DT_* encoding rules: The value of each dynamic tag determines the
112 * interpretation of the d_un union. This convention provides for simpler
113 * interpretation of dynamic tags by external tools. A tag whose value
114 * is an even number indicates a dynamic section entry that uses d_ptr.
115 * A tag whose value is an odd number indicates a dynamic section entry
116 * that uses d_val, or that uses neither d_ptr nor d_val.
117 *
118 * There are exceptions to the above rule:
119 *	- Tags with values that are less than DT_ENCODING.
120 *	- Tags with values that fall between DT_LOOS and DT_SUNW_ENCODING
121 *	- Tags with values that fall between DT_HIOS and DT_LOPROC
122 *
123 * Third party tools must handle these exception ranges explicitly
124 * on an item by item basis.
125 */
126#define	DT_ENCODING		32	/* positive tag DT_* encoding rules */
127					/*	start after this */
128#define	DT_PREINIT_ARRAY	32    /* pointer to .preinitarray segment */
129#define	DT_PREINIT_ARRAYSZ	33    /* size of .preinitarray segment */
130
131#define	DT_MAXPOSTAGS		34	/* number of positive tags */
132
133/*
134 * DT_* encoding rules do not apply between DT_LOOS and DT_SUNW_ENCODING
135 */
136#define	DT_LOOS			0x6000000d	/* OS specific range */
137#define	DT_SUNW_AUXILIARY	0x6000000d	/* symbol auxiliary name */
138#define	DT_SUNW_RTLDINF		0x6000000e	/* ld.so.1 info (private) */
139#define	DT_SUNW_FILTER		0x6000000f	/* symbol filter name */
140#define	DT_SUNW_CAP		0x60000010	/* hardware/software */
141						/*	capabilities */
142#define	DT_SUNW_SYMTAB		0x60000011	/* symtab with local fcn */
143						/*	symbols immediately */
144						/*	preceding DT_SYMTAB */
145#define	DT_SUNW_SYMSZ		0x60000012	/* Size of SUNW_SYMTAB table */
146
147/*
148 * DT_* encoding rules apply between DT_SUNW_ENCODING and DT_HIOS
149 */
150#define	DT_SUNW_ENCODING	0x60000013	/* DT_* encoding rules resume */
151						/*	after this */
152#define	DT_SUNW_SORTENT		0x60000013	/* sizeof [SYM|TLS]SORT entrt */
153#define	DT_SUNW_SYMSORT		0x60000014	/* sym indices sorted by addr */
154#define	DT_SUNW_SYMSORTSZ	0x60000015	/* size of SUNW_SYMSORT */
155#define	DT_SUNW_TLSSORT		0x60000016	/* tls sym ndx sort by offset */
156#define	DT_SUNW_TLSSORTSZ	0x60000017	/* size of SUNW_TLSSORT */
157
158#define	DT_SUNW_STRPAD		0x60000019	/* # of unused bytes at the */
159						/*	end of dynstr */
160#define	DT_SUNW_LDMACH		0x6000001b	/* EM_ machine code of linker */
161						/*	that produced object */
162
163/*
164 * DT_* encoding rules do not apply between DT_HIOS and DT_LOPROC
165 */
166#define	DT_HIOS			0x6ffff000
167
168/*
169 * The following values have been deprecated and remain here to allow
170 * compatibility with older binaries.
171 */
172#define	DT_DEPRECATED_SPARC_REGISTER	0x7000001
173
174/*
175 * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
176 * Dyn.d_un.d_val field of the Elf*_Dyn structure.
177 */
178#define	DT_VALRNGLO	0x6ffffd00
179#define	DT_CHECKSUM	0x6ffffdf8	/* elf checksum */
180#define	DT_PLTPADSZ	0x6ffffdf9	/* pltpadding size */
181#define	DT_MOVEENT	0x6ffffdfa	/* move table entry size */
182#define	DT_MOVESZ	0x6ffffdfb	/* move table size */
183#define	DT_FEATURE_1	0x6ffffdfc	/* feature holder */
184#define	DT_POSFLAG_1	0x6ffffdfd	/* flags for DT_* entries, effecting */
185					/*	the following DT_* entry. */
186					/*	See DF_P1_* definitions */
187#define	DT_SYMINSZ	0x6ffffdfe	/* syminfo table size (in bytes) */
188#define	DT_SYMINENT	0x6ffffdff	/* syminfo entry size (in bytes) */
189#define	DT_VALRNGHI	0x6ffffdff
190
191/*
192 * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
193 * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
194 *
195 * If any adjustment is made to the ELF object after it has been
196 * built, these entries will need to be adjusted.
197 */
198#define	DT_ADDRRNGLO	0x6ffffe00
199#define	DT_CONFIG	0x6ffffefa	/* configuration information */
200#define	DT_DEPAUDIT	0x6ffffefb	/* dependency auditing */
201#define	DT_AUDIT	0x6ffffefc	/* object auditing */
202#define	DT_PLTPAD	0x6ffffefd	/* pltpadding (sparcv9) */
203#define	DT_MOVETAB	0x6ffffefe	/* move table */
204#define	DT_SYMINFO	0x6ffffeff	/* syminfo table */
205#define	DT_ADDRRNGHI	0x6ffffeff
206
207/*
208 * The following DT_* entries should have been assigned within one of the
209 * DT_* ranges, but existed before such ranges had been established.
210 */
211#define	DT_VERSYM	0x6ffffff0	/* version symbol table - unused by */
212					/*	Solaris (see libld/update.c) */
213
214#define	DT_RELACOUNT	0x6ffffff9	/* number of RELATIVE relocations */
215#define	DT_RELCOUNT	0x6ffffffa	/* number of RELATIVE relocations */
216#define	DT_FLAGS_1	0x6ffffffb	/* state flags - see DF_1_* defs */
217#define	DT_VERDEF	0x6ffffffc	/* version definition table and */
218#define	DT_VERDEFNUM	0x6ffffffd	/*	associated no. of entries */
219#define	DT_VERNEED	0x6ffffffe	/* version needed table and */
220#define	DT_VERNEEDNUM	0x6fffffff	/* 	associated no. of entries */
221
222/*
223 * DT_* entries between DT_HIPROC and DT_LOPROC are reserved for processor
224 * specific semantics.
225 *
226 * DT_* encoding rules apply to all tag values larger than DT_LOPROC.
227 */
228#define	DT_LOPROC	0x70000000	/* processor specific range */
229#define	DT_AUXILIARY	0x7ffffffd	/* shared library auxiliary name */
230#define	DT_USED		0x7ffffffe	/* ignored - same as needed */
231#define	DT_FILTER	0x7fffffff	/* shared library filter name */
232#define	DT_HIPROC	0x7fffffff
233
234
235/*
236 * Values for DT_FLAGS
237 */
238#define	DF_ORIGIN	0x00000001	/* ORIGIN processing required */
239#define	DF_SYMBOLIC	0x00000002	/* symbolic bindings in effect */
240#define	DF_TEXTREL	0x00000004	/* text relocations remain */
241#define	DF_BIND_NOW	0x00000008	/* process all relocations */
242#define	DF_STATIC_TLS	0x00000010	/* obj. contains static TLS refs */
243
244/*
245 * Values for the DT_POSFLAG_1 .dynamic entry.
246 * These values only affect the following DT_* entry.
247 */
248#define	DF_P1_LAZYLOAD	0x00000001	/* following object is to be */
249					/*	lazy loaded */
250#define	DF_P1_GROUPPERM	0x00000002	/* following object's symbols are */
251					/*	not available for general */
252					/*	symbol bindings. */
253/*
254 * Values for the DT_FLAGS_1 .dynamic entry.
255 */
256#define	DF_1_NOW	0x00000001	/* set RTLD_NOW for this object */
257#define	DF_1_GLOBAL	0x00000002	/* set RTLD_GLOBAL for this object */
258#define	DF_1_GROUP	0x00000004	/* set RTLD_GROUP for this object */
259#define	DF_1_NODELETE	0x00000008	/* set RTLD_NODELETE for this object */
260#define	DF_1_LOADFLTR	0x00000010	/* trigger filtee loading at runtime */
261#define	DF_1_INITFIRST	0x00000020	/* set RTLD_INITFIRST for this object */
262#define	DF_1_NOOPEN	0x00000040	/* set RTLD_NOOPEN for this object */
263#define	DF_1_ORIGIN	0x00000080	/* ORIGIN processing required */
264#define	DF_1_DIRECT	0x00000100	/* direct binding enabled */
265#define	DF_1_TRANS	0x00000200
266#define	DF_1_INTERPOSE	0x00000400	/* object is an interposer */
267#define	DF_1_NODEFLIB	0x00000800	/* ignore default library search path */
268#define	DF_1_NODUMP	0x00001000	/* object can't be dldump(3x)'ed */
269#define	DF_1_CONFALT	0x00002000	/* configuration alternative created */
270#define	DF_1_ENDFILTEE	0x00004000	/* filtee terminates filters search */
271#define	DF_1_DISPRELDNE	0x00008000	/* disp reloc applied at build time */
272#define	DF_1_DISPRELPND	0x00010000	/* disp reloc applied at run-time */
273#define	DF_1_NODIRECT	0x00020000	/* object contains symbols that */
274					/*	cannot be directly bound to */
275#define	DF_1_IGNMULDEF	0x00040000	/* internal: krtld ignore muldefs */
276#define	DF_1_NOKSYMS	0x00080000	/* internal: don't export object's */
277					/*	symbols via /dev/ksyms */
278#define	DF_1_NOHDR	0x00100000	/* mapfile ?N:1st segment mapping */
279					/*	omits ELF & program headers */
280#define	DF_1_EDITED	0x00200000	/* object has been modified since */
281					/*	being built by 'ld' */
282#define	DF_1_NORELOC	0x00400000	/* internal: unrelocated object */
283#define	DF_1_SYMINTPOSE	0x00800000	/* individual symbol interposers */
284					/*	exist */
285#define	DF_1_GLOBAUDIT	0x01000000	/* establish global auditing */
286#define	DF_1_SINGLETON	0x02000000	/* singleton symbols exist */
287
288/*
289 * Values set to DT_FEATURE_1 tag's d_val.
290 */
291#define	DTF_1_PARINIT	0x00000001	/* partially initialization feature */
292#define	DTF_1_CONFEXP	0x00000002	/* configuration file expected */
293
294
295/*
296 * Version structures.  There are three types of version structure:
297 *
298 *  o	A definition of the versions within the image itself.
299 *	Each version definition is assigned a unique index (starting from
300 *	VER_NDX_BGNDEF)	which is used to cross-reference symbols associated to
301 *	the version.  Each version can have one or more dependencies on other
302 *	version definitions within the image.  The version name, and any
303 *	dependency names, are specified in the version definition auxiliary
304 *	array.  Version definition entries require a version symbol index table.
305 *
306 *  o	A version requirement on a needed dependency.  Each needed entry
307 *	specifies the shared object dependency (as specified in DT_NEEDED).
308 *	One or more versions required from this dependency are specified in the
309 *	version needed auxiliary array.
310 *
311 *  o	A version symbol index table.  Each symbol indexes into this array
312 *	to determine its version index.  Index values of VER_NDX_BGNDEF or
313 *	greater indicate the version definition to which a symbol is associated.
314 *	(the size of a symbol index entry is recorded in the sh_info field).
315 */
316#ifndef	_ASM
317
318typedef struct {			/* Version Definition Structure. */
319	Elf32_Half	vd_version;	/* this structures version revision */
320	Elf32_Half	vd_flags;	/* version information */
321	Elf32_Half	vd_ndx;		/* version index */
322	Elf32_Half	vd_cnt;		/* no. of associated aux entries */
323	Elf32_Word	vd_hash;	/* version name hash value */
324	Elf32_Word	vd_aux;		/* no. of bytes from start of this */
325					/*	verdef to verdaux array */
326	Elf32_Word	vd_next;	/* no. of bytes from start of this */
327} Elf32_Verdef;				/*	verdef to next verdef entry */
328
329typedef struct {			/* Verdef Auxiliary Structure. */
330	Elf32_Word	vda_name;	/* first element defines the version */
331					/*	name. Additional entries */
332					/*	define dependency names. */
333	Elf32_Word	vda_next;	/* no. of bytes from start of this */
334} Elf32_Verdaux;			/*	verdaux to next verdaux entry */
335
336
337typedef	struct {			/* Version Requirement Structure. */
338	Elf32_Half	vn_version;	/* this structures version revision */
339	Elf32_Half	vn_cnt;		/* no. of associated aux entries */
340	Elf32_Word	vn_file;	/* name of needed dependency (file) */
341	Elf32_Word	vn_aux;		/* no. of bytes from start of this */
342					/*	verneed to vernaux array */
343	Elf32_Word	vn_next;	/* no. of bytes from start of this */
344} Elf32_Verneed;			/*	verneed to next verneed entry */
345
346typedef struct {			/* Verneed Auxiliary Structure. */
347	Elf32_Word	vna_hash;	/* version name hash value */
348	Elf32_Half	vna_flags;	/* version information */
349	Elf32_Half	vna_other;
350	Elf32_Word	vna_name;	/* version name */
351	Elf32_Word	vna_next;	/* no. of bytes from start of this */
352} Elf32_Vernaux;			/*	vernaux to next vernaux entry */
353
354typedef	Elf32_Half 	Elf32_Versym;	/* Version symbol index array */
355
356typedef struct {
357	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
358	Elf32_Half	si_flags;	/* per symbol flags */
359} Elf32_Syminfo;
360
361
362#if defined(_LP64) || defined(_LONGLONG_TYPE)
363typedef struct {
364	Elf64_Half	vd_version;	/* this structures version revision */
365	Elf64_Half	vd_flags;	/* version information */
366	Elf64_Half	vd_ndx;		/* version index */
367	Elf64_Half	vd_cnt;		/* no. of associated aux entries */
368	Elf64_Word	vd_hash;	/* version name hash value */
369	Elf64_Word	vd_aux;		/* no. of bytes from start of this */
370					/*	verdef to verdaux array */
371	Elf64_Word	vd_next;	/* no. of bytes from start of this */
372} Elf64_Verdef;				/*	verdef to next verdef entry */
373
374typedef struct {
375	Elf64_Word	vda_name;	/* first element defines the version */
376					/*	name. Additional entries */
377					/*	define dependency names. */
378	Elf64_Word	vda_next;	/* no. of bytes from start of this */
379} Elf64_Verdaux;			/*	verdaux to next verdaux entry */
380
381typedef struct {
382	Elf64_Half	vn_version;	/* this structures version revision */
383	Elf64_Half	vn_cnt;		/* no. of associated aux entries */
384	Elf64_Word	vn_file;	/* name of needed dependency (file) */
385	Elf64_Word	vn_aux;		/* no. of bytes from start of this */
386					/*	verneed to vernaux array */
387	Elf64_Word	vn_next;	/* no. of bytes from start of this */
388} Elf64_Verneed;			/*	verneed to next verneed entry */
389
390typedef struct {
391	Elf64_Word	vna_hash;	/* version name hash value */
392	Elf64_Half	vna_flags;	/* version information */
393	Elf64_Half	vna_other;
394	Elf64_Word	vna_name;	/* version name */
395	Elf64_Word	vna_next;	/* no. of bytes from start of this */
396} Elf64_Vernaux;			/*	vernaux to next vernaux entry */
397
398typedef	Elf64_Half	Elf64_Versym;
399
400typedef struct {
401	Elf64_Half	si_boundto;	/* direct bindings - symbol bound to */
402	Elf64_Half	si_flags;	/* per symbol flags */
403} Elf64_Syminfo;
404#endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
405
406#endif	/* _ASM */
407
408/*
409 * Versym symbol index values.  Values greater than VER_NDX_GLOBAL
410 * and less then VER_NDX_LORESERVE associate symbols with user
411 * specified version descriptors.
412 */
413#define	VER_NDX_LOCAL		0	/* symbol is local */
414#define	VER_NDX_GLOBAL		1	/* symbol is global and assigned to */
415					/*	the base version */
416#define	VER_NDX_LORESERVE	0xff00	/* beginning of RESERVED entries */
417#define	VER_NDX_ELIMINATE	0xff01	/* symbol is to be eliminated */
418
419/*
420 * Verdef and Verneed (via Veraux) flags values.
421 */
422#define	VER_FLG_BASE		0x1	/* version definition of file itself */
423#define	VER_FLG_WEAK		0x2	/* weak version identifier */
424
425/*
426 * Verdef version values.
427 */
428#define	VER_DEF_NONE		0	/* Ver_def version */
429#define	VER_DEF_CURRENT		1
430#define	VER_DEF_NUM		2
431
432/*
433 * Verneed version values.
434 */
435#define	VER_NEED_NONE		0	/* Ver_need version */
436#define	VER_NEED_CURRENT	1
437#define	VER_NEED_NUM		2
438
439
440/*
441 * Syminfo flag values
442 */
443#define	SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association */
444					/*	to object containing defn. */
445#define	SYMINFO_FLG_PASSTHRU	0x0002	/* ignored - see SYMINFO_FLG_FILTER */
446#define	SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
447#define	SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn. should be */
448					/*	lazily-loaded */
449#define	SYMINFO_FLG_DIRECTBIND	0x0010	/* ref should be bound directly to */
450					/*	object containing defn. */
451#define	SYMINFO_FLG_NOEXTDIRECT	0x0020	/* don't let an external reference */
452					/*	directly bind to this symbol */
453#define	SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
454#define	SYMINFO_FLG_AUXILIARY	0x0040	/* 	standard or auxiliary filter */
455#define	SYMINFO_FLG_INTERPOSE	0x0080	/* symbol defines an interposer */
456
457/*
458 * Syminfo.si_boundto values.
459 */
460#define	SYMINFO_BT_SELF		0xffff	/* symbol bound to self */
461#define	SYMINFO_BT_PARENT	0xfffe	/* symbol bound to parent */
462#define	SYMINFO_BT_NONE		0xfffd	/* no special symbol binding */
463#define	SYMINFO_BT_EXTERN	0xfffc	/* symbol defined as external */
464#define	SYMINFO_BT_LOWRESERVE	0xff00	/* beginning of reserved entries */
465
466/*
467 * Syminfo version values.
468 */
469#define	SYMINFO_NONE		0	/* Syminfo version */
470#define	SYMINFO_CURRENT		1
471#define	SYMINFO_NUM		2
472
473
474/*
475 * Public structure defined and maintained within the runtime linker
476 */
477#ifndef	_ASM
478
479typedef struct link_map	Link_map;
480
481struct link_map {
482	unsigned long	l_addr;		/* address at which object is mapped */
483	char 		*l_name;	/* full name of loaded object */
484#ifdef _LP64
485	Elf64_Dyn	*l_ld;		/* dynamic structure of object */
486#else
487	Elf32_Dyn	*l_ld;		/* dynamic structure of object */
488#endif
489	Link_map	*l_next;	/* next link object */
490	Link_map	*l_prev;	/* previous link object */
491	char		*l_refname;	/* filters reference name */
492};
493
494#ifdef _SYSCALL32
495typedef struct link_map32 Link_map32;
496
497struct link_map32 {
498	Elf32_Word	l_addr;
499	Elf32_Addr	l_name;
500	Elf32_Addr	l_ld;
501	Elf32_Addr	l_next;
502	Elf32_Addr	l_prev;
503	Elf32_Addr	l_refname;
504};
505#endif
506
507typedef enum {
508	RT_CONSISTENT,
509	RT_ADD,
510	RT_DELETE
511} r_state_e;
512
513typedef enum {
514	RD_FL_NONE = 0,		/* no flags */
515	RD_FL_ODBG = (1<<0),	/* old style debugger present */
516	RD_FL_DBG = (1<<1)	/* debugging enabled */
517} rd_flags_e;
518
519
520
521/*
522 * Debugging events enabled inside of the runtime linker.  To
523 * access these events see the librtld_db interface.
524 */
525typedef enum {
526	RD_NONE = 0,		/* no event */
527	RD_PREINIT,		/* the Initial rendezvous before .init */
528	RD_POSTINIT,		/* the Second rendezvous after .init */
529	RD_DLACTIVITY,		/* a dlopen or dlclose has happened */
530	RD_DYLD_LOST,		/* communication with target dyld was lost */
531	RD_DYLD_EXIT		/* target exited. */
532} rd_event_e;
533
534struct r_debug {
535	int		r_version;	/* debugging info version no. */
536	Link_map	*r_map;		/* address of link_map */
537	unsigned long	r_brk;		/* address of update routine */
538	r_state_e	r_state;
539	unsigned long	r_ldbase;	/* base addr of ld.so */
540	Link_map	*r_ldsomap;	/* address of ld.so.1's link map */
541	rd_event_e	r_rdevent;	/* debug event */
542	rd_flags_e	r_flags;	/* misc flags. */
543};
544
545#ifdef _SYSCALL32
546struct r_debug32 {
547	Elf32_Word	r_version;	/* debugging info version no. */
548	Elf32_Addr	r_map;		/* address of link_map */
549	Elf32_Word	r_brk;		/* address of update routine */
550	r_state_e	r_state;
551	Elf32_Word	r_ldbase;	/* base addr of ld.so */
552	Elf32_Addr	r_ldsomap;	/* address of ld.so.1's link map */
553	rd_event_e	r_rdevent;	/* debug event */
554	rd_flags_e	r_flags;	/* misc flags. */
555};
556#endif
557
558
559#define	R_DEBUG_VERSION	2		/* current r_debug version */
560#endif	/* _ASM */
561
562/*
563 * Attribute/value structures used to bootstrap ELF-based dynamic linker.
564 */
565#ifndef	_ASM
566typedef struct {
567	Elf32_Sword eb_tag;		/* what this one is */
568	union {				/* possible values */
569		Elf32_Word eb_val;
570		Elf32_Addr eb_ptr;
571		Elf32_Off  eb_off;
572	} eb_un;
573} Elf32_Boot;
574
575#if defined(_LP64) || defined(_LONGLONG_TYPE)
576typedef struct {
577	Elf64_Xword eb_tag;		/* what this one is */
578	union {				/* possible values */
579		Elf64_Xword eb_val;
580		Elf64_Addr eb_ptr;
581		Elf64_Off eb_off;
582	} eb_un;
583} Elf64_Boot;
584#endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
585#endif	/* _ASM */
586
587/*
588 * Attributes
589 */
590#define	EB_NULL		0		/* (void) last entry */
591#define	EB_DYNAMIC	1		/* (*) dynamic structure of subject */
592#define	EB_LDSO_BASE	2		/* (caddr_t) base address of ld.so */
593#define	EB_ARGV		3		/* (caddr_t) argument vector */
594#define	EB_ENVP		4		/* (char **) environment strings */
595#define	EB_AUXV		5		/* (auxv_t *) auxiliary vector */
596#define	EB_DEVZERO	6		/* (int) fd for /dev/zero */
597#define	EB_PAGESIZE	7		/* (int) page size */
598#define	EB_MAX		8		/* number of "EBs" */
599#define	EB_MAX_SIZE32	64		/* size in bytes, _ILP32 */
600#define	EB_MAX_SIZE64	128		/* size in bytes, _LP64 */
601
602
603#ifndef	_ASM
604
605#ifdef __STDC__
606
607/*
608 * Concurrency communication structure for libc callbacks.
609 */
610extern void	_ld_libc(void *);
611#else /* __STDC__ */
612extern void	_ld_libc();
613#endif /* __STDC__ */
614
615#pragma unknown_control_flow(_ld_libc)
616#endif /* _ASM */
617
618#ifdef	__cplusplus
619}
620#endif
621
622#endif	/* _SYS_LINK_H */
623