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