xref: /illumos-gate/usr/src/uts/common/sys/link.h (revision b6a0e2cd)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50bc07c75Srie  * Common Development and Distribution License (the "License").
60bc07c75Srie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate /*
230bc07c75Srie  *	Copyright (c) 1988 AT&T
240bc07c75Srie  *	  All Rights Reserved
250bc07c75Srie  *
26ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
27ba3594baSGarrett D'Amore  *
28f441771bSRod Evans  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _SYS_LINK_H
327c478bd9Sstevel@tonic-gate #define	_SYS_LINK_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef	_ASM
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/elftypes.h>
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Communication structures for the runtime linker.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * The following data structure provides a self-identifying union consisting
497c478bd9Sstevel@tonic-gate  * of a tag from a known list and a value.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #ifndef	_ASM
527c478bd9Sstevel@tonic-gate typedef struct {
537c478bd9Sstevel@tonic-gate 	Elf32_Sword d_tag;		/* how to interpret value */
547c478bd9Sstevel@tonic-gate 	union {
557c478bd9Sstevel@tonic-gate 		Elf32_Word	d_val;
567c478bd9Sstevel@tonic-gate 		Elf32_Addr	d_ptr;
577c478bd9Sstevel@tonic-gate 		Elf32_Off	d_off;
587c478bd9Sstevel@tonic-gate 	} d_un;
597c478bd9Sstevel@tonic-gate } Elf32_Dyn;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
627c478bd9Sstevel@tonic-gate typedef struct {
637c478bd9Sstevel@tonic-gate 	Elf64_Xword d_tag;		/* how to interpret value */
647c478bd9Sstevel@tonic-gate 	union {
657c478bd9Sstevel@tonic-gate 		Elf64_Xword	d_val;
667c478bd9Sstevel@tonic-gate 		Elf64_Addr	d_ptr;
677c478bd9Sstevel@tonic-gate 	} d_un;
687c478bd9Sstevel@tonic-gate } Elf64_Dyn;
697c478bd9Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
707c478bd9Sstevel@tonic-gate #endif	/* _ASM */
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * Tag values
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate #define	DT_NULL		0	/* last entry in list */
767c478bd9Sstevel@tonic-gate #define	DT_NEEDED	1	/* a needed object */
777c478bd9Sstevel@tonic-gate #define	DT_PLTRELSZ	2	/* size of relocations for the PLT */
787c478bd9Sstevel@tonic-gate #define	DT_PLTGOT	3	/* addresses used by procedure linkage table */
797c478bd9Sstevel@tonic-gate #define	DT_HASH		4	/* hash table */
807c478bd9Sstevel@tonic-gate #define	DT_STRTAB	5	/* string table */
817c478bd9Sstevel@tonic-gate #define	DT_SYMTAB	6	/* symbol table */
827c478bd9Sstevel@tonic-gate #define	DT_RELA		7	/* addr of relocation entries */
837c478bd9Sstevel@tonic-gate #define	DT_RELASZ	8	/* size of relocation table */
847c478bd9Sstevel@tonic-gate #define	DT_RELAENT	9	/* base size of relocation entry */
857c478bd9Sstevel@tonic-gate #define	DT_STRSZ	10	/* size of string table */
867c478bd9Sstevel@tonic-gate #define	DT_SYMENT	11	/* size of symbol table entry */
877c478bd9Sstevel@tonic-gate #define	DT_INIT		12	/* _init addr */
887c478bd9Sstevel@tonic-gate #define	DT_FINI		13	/* _fini addr */
897c478bd9Sstevel@tonic-gate #define	DT_SONAME	14	/* name of this shared object */
907c478bd9Sstevel@tonic-gate #define	DT_RPATH	15	/* run-time search path */
917c478bd9Sstevel@tonic-gate #define	DT_SYMBOLIC	16	/* shared object linked -Bsymbolic */
927c478bd9Sstevel@tonic-gate #define	DT_REL		17	/* addr of relocation entries */
937c478bd9Sstevel@tonic-gate #define	DT_RELSZ	18	/* size of relocation table */
947c478bd9Sstevel@tonic-gate #define	DT_RELENT	19	/* base size of relocation entry */
957c478bd9Sstevel@tonic-gate #define	DT_PLTREL	20	/* relocation type for PLT entry */
967c478bd9Sstevel@tonic-gate #define	DT_DEBUG	21	/* pointer to r_debug structure */
977c478bd9Sstevel@tonic-gate #define	DT_TEXTREL	22	/* text relocations remain for this object */
987c478bd9Sstevel@tonic-gate #define	DT_JMPREL	23	/* pointer to the PLT relocation entries */
997c478bd9Sstevel@tonic-gate #define	DT_BIND_NOW	24	/* perform all relocations at load of object */
100b23a7923SAli Bahrami #define	DT_INIT_ARRAY	25	/* pointer to .init_array */
101b23a7923SAli Bahrami #define	DT_FINI_ARRAY	26	/* pointer to .fini_array */
102b23a7923SAli Bahrami #define	DT_INIT_ARRAYSZ	27	/* size of .init_array */
103b23a7923SAli Bahrami #define	DT_FINI_ARRAYSZ	28	/* size of .fini_array */
1047c478bd9Sstevel@tonic-gate #define	DT_RUNPATH	29	/* run-time search path */
1057c478bd9Sstevel@tonic-gate #define	DT_FLAGS	30	/* state flags - see DF_* */
1067c478bd9Sstevel@tonic-gate 
107d579eb63Sab196087 /*
108d579eb63Sab196087  * DT_* encoding rules: The value of each dynamic tag determines the
109d579eb63Sab196087  * interpretation of the d_un union. This convention provides for simpler
110d579eb63Sab196087  * interpretation of dynamic tags by external tools. A tag whose value
111d579eb63Sab196087  * is an even number indicates a dynamic section entry that uses d_ptr.
112d579eb63Sab196087  * A tag whose value is an odd number indicates a dynamic section entry
113d579eb63Sab196087  * that uses d_val, or that uses neither d_ptr nor d_val.
114d579eb63Sab196087  *
115d579eb63Sab196087  * There are exceptions to the above rule:
116d579eb63Sab196087  *	- Tags with values that are less than DT_ENCODING.
117d579eb63Sab196087  *	- Tags with values that fall between DT_LOOS and DT_SUNW_ENCODING
118d579eb63Sab196087  *	- Tags with values that fall between DT_HIOS and DT_LOPROC
119d579eb63Sab196087  *
120d579eb63Sab196087  * Third party tools must handle these exception ranges explicitly
121d579eb63Sab196087  * on an item by item basis.
122d579eb63Sab196087  */
123d579eb63Sab196087 #define	DT_ENCODING		32	/* positive tag DT_* encoding rules */
124d579eb63Sab196087 					/*	start after this */
125b23a7923SAli Bahrami #define	DT_PREINIT_ARRAY	32	/* pointer to .preinit_array */
126b23a7923SAli Bahrami #define	DT_PREINIT_ARRAYSZ	33	/* size of .preinit_array */
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #define	DT_MAXPOSTAGS		34	/* number of positive tags */
1297c478bd9Sstevel@tonic-gate 
130d579eb63Sab196087 /*
131d579eb63Sab196087  * DT_* encoding rules do not apply between DT_LOOS and DT_SUNW_ENCODING
132d579eb63Sab196087  */
1337c478bd9Sstevel@tonic-gate #define	DT_LOOS			0x6000000d	/* OS specific range */
1347c478bd9Sstevel@tonic-gate #define	DT_SUNW_AUXILIARY	0x6000000d	/* symbol auxiliary name */
1357c478bd9Sstevel@tonic-gate #define	DT_SUNW_RTLDINF		0x6000000e	/* ld.so.1 info (private) */
1367c478bd9Sstevel@tonic-gate #define	DT_SUNW_FILTER		0x6000000f	/* symbol filter name */
1377c478bd9Sstevel@tonic-gate #define	DT_SUNW_CAP		0x60000010	/* hardware/software */
1387c478bd9Sstevel@tonic-gate 						/*	capabilities */
1399039eeafSab196087 #define	DT_SUNW_SYMTAB		0x60000011	/* symtab with local fcn */
1409039eeafSab196087 						/*	symbols immediately */
1419039eeafSab196087 						/*	preceding DT_SYMTAB */
142d579eb63Sab196087 #define	DT_SUNW_SYMSZ		0x60000012	/* Size of SUNW_SYMTAB table */
143d579eb63Sab196087 
144d579eb63Sab196087 /*
145d579eb63Sab196087  * DT_* encoding rules apply between DT_SUNW_ENCODING and DT_HIOS
146d579eb63Sab196087  */
147d579eb63Sab196087 #define	DT_SUNW_ENCODING	0x60000013	/* DT_* encoding rules resume */
148d579eb63Sab196087 						/*	after this */
1494f680cc6SAli Bahrami #define	DT_SUNW_SORTENT		0x60000013	/* sizeof [SYM|TLS]SORT entry */
150d579eb63Sab196087 #define	DT_SUNW_SYMSORT		0x60000014	/* sym indices sorted by addr */
151d579eb63Sab196087 #define	DT_SUNW_SYMSORTSZ	0x60000015	/* size of SUNW_SYMSORT */
152d579eb63Sab196087 #define	DT_SUNW_TLSSORT		0x60000016	/* tls sym ndx sort by offset */
153d579eb63Sab196087 #define	DT_SUNW_TLSSORTSZ	0x60000017	/* size of SUNW_TLSSORT */
15408278a5eSRod Evans #define	DT_SUNW_CAPINFO		0x60000018	/* capabilities symbols */
1553244bcaaSab196087 #define	DT_SUNW_STRPAD		0x60000019	/* # of unused bytes at the */
1563244bcaaSab196087 						/*	end of dynstr */
15708278a5eSRod Evans #define	DT_SUNW_CAPCHAIN	0x6000001a	/* capabilities chain info */
158ba2be530Sab196087 #define	DT_SUNW_LDMACH		0x6000001b	/* EM_ machine code of linker */
159ba2be530Sab196087 						/*	that produced object */
16008278a5eSRod Evans #define	DT_SUNW_CAPCHAINENT	0x6000001d	/* capabilities chain entry */
16108278a5eSRod Evans #define	DT_SUNW_CAPCHAINSZ	0x6000001f	/* capabilities chain size */
162d2a70789SRichard Lowe /* 0x60000021 would be DT_SUNW_PARENT */
163d2a70789SRichard Lowe #define	DT_SUNW_ASLR		0x60000023	/* executable ASLR desire */
164*b6a0e2cdSRichard Lowe #define	DT_SUNW_KMOD		0x60000027	/* object is a kernel module */
1653244bcaaSab196087 
166d579eb63Sab196087 /*
167d579eb63Sab196087  * DT_* encoding rules do not apply between DT_HIOS and DT_LOPROC
168d579eb63Sab196087  */
1697c478bd9Sstevel@tonic-gate #define	DT_HIOS			0x6ffff000
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate /*
1727c478bd9Sstevel@tonic-gate  * The following values have been deprecated and remain here to allow
1737c478bd9Sstevel@tonic-gate  * compatibility with older binaries.
1747c478bd9Sstevel@tonic-gate  */
1757c478bd9Sstevel@tonic-gate #define	DT_DEPRECATED_SPARC_REGISTER	0x7000001
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
1797c478bd9Sstevel@tonic-gate  * Dyn.d_un.d_val field of the Elf*_Dyn structure.
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate #define	DT_VALRNGLO	0x6ffffd00
1827e16fca0SAli Bahrami 
1837e16fca0SAli Bahrami #define	DT_GNU_PRELINKED 0x6ffffdf5	/* prelinking timestamp (unused) */
1847e16fca0SAli Bahrami #define	DT_GNU_CONFLICTSZ 0x6ffffdf6	/* size of conflict section (unused) */
1857e16fca0SAli Bahrami #define	DT_GNU_LIBLISTSZ 0x6ffffdf7	/* size of library list (unused) */
1867c478bd9Sstevel@tonic-gate #define	DT_CHECKSUM	0x6ffffdf8	/* elf checksum */
1877c478bd9Sstevel@tonic-gate #define	DT_PLTPADSZ	0x6ffffdf9	/* pltpadding size */
1887c478bd9Sstevel@tonic-gate #define	DT_MOVEENT	0x6ffffdfa	/* move table entry size */
1897c478bd9Sstevel@tonic-gate #define	DT_MOVESZ	0x6ffffdfb	/* move table size */
19094c044f4SRod Evans #define	DT_FEATURE_1	0x6ffffdfc	/* feature holder (unused) */
1917c478bd9Sstevel@tonic-gate #define	DT_POSFLAG_1	0x6ffffdfd	/* flags for DT_* entries, effecting */
1927c478bd9Sstevel@tonic-gate 					/*	the following DT_* entry. */
1937c478bd9Sstevel@tonic-gate 					/*	See DF_P1_* definitions */
1947c478bd9Sstevel@tonic-gate #define	DT_SYMINSZ	0x6ffffdfe	/* syminfo table size (in bytes) */
1957c478bd9Sstevel@tonic-gate #define	DT_SYMINENT	0x6ffffdff	/* syminfo entry size (in bytes) */
1967c478bd9Sstevel@tonic-gate #define	DT_VALRNGHI	0x6ffffdff
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate  * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
2007c478bd9Sstevel@tonic-gate  * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
2017c478bd9Sstevel@tonic-gate  *
2027c478bd9Sstevel@tonic-gate  * If any adjustment is made to the ELF object after it has been
2037c478bd9Sstevel@tonic-gate  * built, these entries will need to be adjusted.
2047c478bd9Sstevel@tonic-gate  */
2057c478bd9Sstevel@tonic-gate #define	DT_ADDRRNGLO	0x6ffffe00
2067e16fca0SAli Bahrami 
2077e16fca0SAli Bahrami #define	DT_GNU_HASH	0x6ffffef5	/* GNU-style hash table (unused) */
2087e16fca0SAli Bahrami #define	DT_TLSDESC_PLT	0x6ffffef6	/* GNU (unused) */
2097e16fca0SAli Bahrami #define	DT_TLSDESC_GOT	0x6ffffef7	/* GNU (unused) */
2107e16fca0SAli Bahrami #define	DT_GNU_CONFLICT	0x6ffffef8	/* start of conflict section (unused) */
2117e16fca0SAli Bahrami #define	DT_GNU_LIBLIST	0x6ffffef9	/* Library list (unused) */
2127e16fca0SAli Bahrami 
2137c478bd9Sstevel@tonic-gate #define	DT_CONFIG	0x6ffffefa	/* configuration information */
2147c478bd9Sstevel@tonic-gate #define	DT_DEPAUDIT	0x6ffffefb	/* dependency auditing */
2157c478bd9Sstevel@tonic-gate #define	DT_AUDIT	0x6ffffefc	/* object auditing */
2167c478bd9Sstevel@tonic-gate #define	DT_PLTPAD	0x6ffffefd	/* pltpadding (sparcv9) */
2177c478bd9Sstevel@tonic-gate #define	DT_MOVETAB	0x6ffffefe	/* move table */
2187c478bd9Sstevel@tonic-gate #define	DT_SYMINFO	0x6ffffeff	/* syminfo table */
2197c478bd9Sstevel@tonic-gate #define	DT_ADDRRNGHI	0x6ffffeff
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * The following DT_* entries should have been assigned within one of the
2237c478bd9Sstevel@tonic-gate  * DT_* ranges, but existed before such ranges had been established.
2247c478bd9Sstevel@tonic-gate  */
225d840867fSab196087 #define	DT_VERSYM	0x6ffffff0	/* version symbol table - unused by */
226d840867fSab196087 					/*	Solaris (see libld/update.c) */
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate #define	DT_RELACOUNT	0x6ffffff9	/* number of RELATIVE relocations */
2297c478bd9Sstevel@tonic-gate #define	DT_RELCOUNT	0x6ffffffa	/* number of RELATIVE relocations */
2307c478bd9Sstevel@tonic-gate #define	DT_FLAGS_1	0x6ffffffb	/* state flags - see DF_1_* defs */
2317c478bd9Sstevel@tonic-gate #define	DT_VERDEF	0x6ffffffc	/* version definition table and */
2327c478bd9Sstevel@tonic-gate #define	DT_VERDEFNUM	0x6ffffffd	/*	associated no. of entries */
2337c478bd9Sstevel@tonic-gate #define	DT_VERNEED	0x6ffffffe	/* version needed table and */
2347c478bd9Sstevel@tonic-gate #define	DT_VERNEEDNUM	0x6fffffff	/*	associated no. of entries */
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate /*
2377c478bd9Sstevel@tonic-gate  * DT_* entries between DT_HIPROC and DT_LOPROC are reserved for processor
2387c478bd9Sstevel@tonic-gate  * specific semantics.
239d579eb63Sab196087  *
240d579eb63Sab196087  * DT_* encoding rules apply to all tag values larger than DT_LOPROC.
2417c478bd9Sstevel@tonic-gate  */
2427c478bd9Sstevel@tonic-gate #define	DT_LOPROC	0x70000000	/* processor specific range */
2437c478bd9Sstevel@tonic-gate #define	DT_AUXILIARY	0x7ffffffd	/* shared library auxiliary name */
2447c478bd9Sstevel@tonic-gate #define	DT_USED		0x7ffffffe	/* ignored - same as needed */
2457c478bd9Sstevel@tonic-gate #define	DT_FILTER	0x7fffffff	/* shared library filter name */
2467c478bd9Sstevel@tonic-gate #define	DT_HIPROC	0x7fffffff
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * Values for DT_FLAGS
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate #define	DF_ORIGIN	0x00000001	/* ORIGIN processing required */
2537c478bd9Sstevel@tonic-gate #define	DF_SYMBOLIC	0x00000002	/* symbolic bindings in effect */
2547c478bd9Sstevel@tonic-gate #define	DF_TEXTREL	0x00000004	/* text relocations remain */
2557c478bd9Sstevel@tonic-gate #define	DF_BIND_NOW	0x00000008	/* process all relocations */
2567c478bd9Sstevel@tonic-gate #define	DF_STATIC_TLS	0x00000010	/* obj. contains static TLS refs */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate /*
2597c478bd9Sstevel@tonic-gate  * Values for the DT_POSFLAG_1 .dynamic entry.
2607c478bd9Sstevel@tonic-gate  * These values only affect the following DT_* entry.
2617c478bd9Sstevel@tonic-gate  */
2627c478bd9Sstevel@tonic-gate #define	DF_P1_LAZYLOAD	0x00000001	/* following object is to be */
2637c478bd9Sstevel@tonic-gate 					/*	lazy loaded */
2647c478bd9Sstevel@tonic-gate #define	DF_P1_GROUPPERM	0x00000002	/* following object's symbols are */
2657c478bd9Sstevel@tonic-gate 					/*	not available for general */
2667c478bd9Sstevel@tonic-gate 					/*	symbol bindings. */
267f441771bSRod Evans #define	DF_P1_DEFERRED	0x00000004	/* following object is deferred */
268f441771bSRod Evans 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * Values for the DT_FLAGS_1 .dynamic entry.
2717c478bd9Sstevel@tonic-gate  */
2727c478bd9Sstevel@tonic-gate #define	DF_1_NOW	0x00000001	/* set RTLD_NOW for this object */
2737c478bd9Sstevel@tonic-gate #define	DF_1_GLOBAL	0x00000002	/* set RTLD_GLOBAL for this object */
2747c478bd9Sstevel@tonic-gate #define	DF_1_GROUP	0x00000004	/* set RTLD_GROUP for this object */
2757c478bd9Sstevel@tonic-gate #define	DF_1_NODELETE	0x00000008	/* set RTLD_NODELETE for this object */
2767c478bd9Sstevel@tonic-gate #define	DF_1_LOADFLTR	0x00000010	/* trigger filtee loading at runtime */
2777c478bd9Sstevel@tonic-gate #define	DF_1_INITFIRST	0x00000020	/* set RTLD_INITFIRST for this object */
2787c478bd9Sstevel@tonic-gate #define	DF_1_NOOPEN	0x00000040	/* set RTLD_NOOPEN for this object */
2797c478bd9Sstevel@tonic-gate #define	DF_1_ORIGIN	0x00000080	/* ORIGIN processing required */
2807c478bd9Sstevel@tonic-gate #define	DF_1_DIRECT	0x00000100	/* direct binding enabled */
28194c044f4SRod Evans #define	DF_1_TRANS	0x00000200	/* unused obsolete name */
2829a411307Srie #define	DF_1_INTERPOSE	0x00000400	/* object is an interposer */
2837c478bd9Sstevel@tonic-gate #define	DF_1_NODEFLIB	0x00000800	/* ignore default library search path */
2847c478bd9Sstevel@tonic-gate #define	DF_1_NODUMP	0x00001000	/* object can't be dldump(3x)'ed */
2857c478bd9Sstevel@tonic-gate #define	DF_1_CONFALT	0x00002000	/* configuration alternative created */
2867c478bd9Sstevel@tonic-gate #define	DF_1_ENDFILTEE	0x00004000	/* filtee terminates filters search */
2877c478bd9Sstevel@tonic-gate #define	DF_1_DISPRELDNE	0x00008000	/* disp reloc applied at build time */
2887c478bd9Sstevel@tonic-gate #define	DF_1_DISPRELPND	0x00010000	/* disp reloc applied at run-time */
2897c478bd9Sstevel@tonic-gate #define	DF_1_NODIRECT	0x00020000	/* object contains symbols that */
2907c478bd9Sstevel@tonic-gate 					/*	cannot be directly bound to */
2910bc07c75Srie #define	DF_1_IGNMULDEF	0x00040000	/* internal: krtld ignore muldefs */
2920bc07c75Srie #define	DF_1_NOKSYMS	0x00080000	/* internal: don't export object's */
2930bc07c75Srie 					/*	symbols via /dev/ksyms */
29469112eddSAli Bahrami #define	DF_1_NOHDR	0x00100000	/* mapfile: 1st segment mapping */
2954899432aSab196087 					/*	omits ELF & program headers */
2963244bcaaSab196087 #define	DF_1_EDITED	0x00200000	/* object has been modified since */
2973244bcaaSab196087 					/*	being built by 'ld' */
2980bc07c75Srie #define	DF_1_NORELOC	0x00400000	/* internal: unrelocated object */
2999a411307Srie #define	DF_1_SYMINTPOSE	0x00800000	/* individual symbol interposers */
3009a411307Srie 					/*	exist */
3017247f888Srie #define	DF_1_GLOBAUDIT	0x01000000	/* establish global auditing */
30260758829Srie #define	DF_1_SINGLETON	0x02000000	/* singleton symbols exist */
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate /*
30594c044f4SRod Evans  * Values set to DT_FEATURE_1 tag's d_val (unused obsolete tag)
3067c478bd9Sstevel@tonic-gate  */
3077c478bd9Sstevel@tonic-gate #define	DTF_1_PARINIT	0x00000001	/* partially initialization feature */
3087c478bd9Sstevel@tonic-gate #define	DTF_1_CONFEXP	0x00000002	/* configuration file expected */
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate /*
3127c478bd9Sstevel@tonic-gate  * Version structures.  There are three types of version structure:
3137c478bd9Sstevel@tonic-gate  *
3147c478bd9Sstevel@tonic-gate  *  o	A definition of the versions within the image itself.
3157c478bd9Sstevel@tonic-gate  *	Each version definition is assigned a unique index (starting from
3167c478bd9Sstevel@tonic-gate  *	VER_NDX_BGNDEF)	which is used to cross-reference symbols associated to
3177c478bd9Sstevel@tonic-gate  *	the version.  Each version can have one or more dependencies on other
3187c478bd9Sstevel@tonic-gate  *	version definitions within the image.  The version name, and any
3197c478bd9Sstevel@tonic-gate  *	dependency names, are specified in the version definition auxiliary
3207c478bd9Sstevel@tonic-gate  *	array.  Version definition entries require a version symbol index table.
3217c478bd9Sstevel@tonic-gate  *
3227c478bd9Sstevel@tonic-gate  *  o	A version requirement on a needed dependency.  Each needed entry
3237c478bd9Sstevel@tonic-gate  *	specifies the shared object dependency (as specified in DT_NEEDED).
3247c478bd9Sstevel@tonic-gate  *	One or more versions required from this dependency are specified in the
3257c478bd9Sstevel@tonic-gate  *	version needed auxiliary array.
3267c478bd9Sstevel@tonic-gate  *
3277c478bd9Sstevel@tonic-gate  *  o	A version symbol index table.  Each symbol indexes into this array
3287c478bd9Sstevel@tonic-gate  *	to determine its version index.  Index values of VER_NDX_BGNDEF or
3297c478bd9Sstevel@tonic-gate  *	greater indicate the version definition to which a symbol is associated.
3307c478bd9Sstevel@tonic-gate  *	(the size of a symbol index entry is recorded in the sh_info field).
3317c478bd9Sstevel@tonic-gate  */
3327c478bd9Sstevel@tonic-gate #ifndef	_ASM
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate typedef struct {			/* Version Definition Structure. */
3357c478bd9Sstevel@tonic-gate 	Elf32_Half	vd_version;	/* this structures version revision */
3367c478bd9Sstevel@tonic-gate 	Elf32_Half	vd_flags;	/* version information */
3377c478bd9Sstevel@tonic-gate 	Elf32_Half	vd_ndx;		/* version index */
3387c478bd9Sstevel@tonic-gate 	Elf32_Half	vd_cnt;		/* no. of associated aux entries */
3397c478bd9Sstevel@tonic-gate 	Elf32_Word	vd_hash;	/* version name hash value */
3407c478bd9Sstevel@tonic-gate 	Elf32_Word	vd_aux;		/* no. of bytes from start of this */
3417c478bd9Sstevel@tonic-gate 					/*	verdef to verdaux array */
3427c478bd9Sstevel@tonic-gate 	Elf32_Word	vd_next;	/* no. of bytes from start of this */
3437c478bd9Sstevel@tonic-gate } Elf32_Verdef;				/*	verdef to next verdef entry */
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate typedef struct {			/* Verdef Auxiliary Structure. */
3467c478bd9Sstevel@tonic-gate 	Elf32_Word	vda_name;	/* first element defines the version */
3477c478bd9Sstevel@tonic-gate 					/*	name. Additional entries */
3487c478bd9Sstevel@tonic-gate 					/*	define dependency names. */
3497c478bd9Sstevel@tonic-gate 	Elf32_Word	vda_next;	/* no. of bytes from start of this */
3507c478bd9Sstevel@tonic-gate } Elf32_Verdaux;			/*	verdaux to next verdaux entry */
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate typedef	struct {			/* Version Requirement Structure. */
3547c478bd9Sstevel@tonic-gate 	Elf32_Half	vn_version;	/* this structures version revision */
3557c478bd9Sstevel@tonic-gate 	Elf32_Half	vn_cnt;		/* no. of associated aux entries */
3567c478bd9Sstevel@tonic-gate 	Elf32_Word	vn_file;	/* name of needed dependency (file) */
3577c478bd9Sstevel@tonic-gate 	Elf32_Word	vn_aux;		/* no. of bytes from start of this */
3587c478bd9Sstevel@tonic-gate 					/*	verneed to vernaux array */
3597c478bd9Sstevel@tonic-gate 	Elf32_Word	vn_next;	/* no. of bytes from start of this */
3607c478bd9Sstevel@tonic-gate } Elf32_Verneed;			/*	verneed to next verneed entry */
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate typedef struct {			/* Verneed Auxiliary Structure. */
3637c478bd9Sstevel@tonic-gate 	Elf32_Word	vna_hash;	/* version name hash value */
3647c478bd9Sstevel@tonic-gate 	Elf32_Half	vna_flags;	/* version information */
3657c478bd9Sstevel@tonic-gate 	Elf32_Half	vna_other;
3667c478bd9Sstevel@tonic-gate 	Elf32_Word	vna_name;	/* version name */
3677c478bd9Sstevel@tonic-gate 	Elf32_Word	vna_next;	/* no. of bytes from start of this */
3687c478bd9Sstevel@tonic-gate } Elf32_Vernaux;			/*	vernaux to next vernaux entry */
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate typedef	Elf32_Half	Elf32_Versym;	/* Version symbol index array */
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate typedef struct {
3737c478bd9Sstevel@tonic-gate 	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
3747c478bd9Sstevel@tonic-gate 	Elf32_Half	si_flags;	/* per symbol flags */
3757c478bd9Sstevel@tonic-gate } Elf32_Syminfo;
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
3797c478bd9Sstevel@tonic-gate typedef struct {
3807c478bd9Sstevel@tonic-gate 	Elf64_Half	vd_version;	/* this structures version revision */
3817c478bd9Sstevel@tonic-gate 	Elf64_Half	vd_flags;	/* version information */
3827c478bd9Sstevel@tonic-gate 	Elf64_Half	vd_ndx;		/* version index */
3837c478bd9Sstevel@tonic-gate 	Elf64_Half	vd_cnt;		/* no. of associated aux entries */
3847c478bd9Sstevel@tonic-gate 	Elf64_Word	vd_hash;	/* version name hash value */
3857c478bd9Sstevel@tonic-gate 	Elf64_Word	vd_aux;		/* no. of bytes from start of this */
3867c478bd9Sstevel@tonic-gate 					/*	verdef to verdaux array */
3877c478bd9Sstevel@tonic-gate 	Elf64_Word	vd_next;	/* no. of bytes from start of this */
3887c478bd9Sstevel@tonic-gate } Elf64_Verdef;				/*	verdef to next verdef entry */
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate typedef struct {
3917c478bd9Sstevel@tonic-gate 	Elf64_Word	vda_name;	/* first element defines the version */
3927c478bd9Sstevel@tonic-gate 					/*	name. Additional entries */
3937c478bd9Sstevel@tonic-gate 					/*	define dependency names. */
3947c478bd9Sstevel@tonic-gate 	Elf64_Word	vda_next;	/* no. of bytes from start of this */
3957c478bd9Sstevel@tonic-gate } Elf64_Verdaux;			/*	verdaux to next verdaux entry */
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate typedef struct {
3987c478bd9Sstevel@tonic-gate 	Elf64_Half	vn_version;	/* this structures version revision */
3997c478bd9Sstevel@tonic-gate 	Elf64_Half	vn_cnt;		/* no. of associated aux entries */
4007c478bd9Sstevel@tonic-gate 	Elf64_Word	vn_file;	/* name of needed dependency (file) */
4017c478bd9Sstevel@tonic-gate 	Elf64_Word	vn_aux;		/* no. of bytes from start of this */
4027c478bd9Sstevel@tonic-gate 					/*	verneed to vernaux array */
4037c478bd9Sstevel@tonic-gate 	Elf64_Word	vn_next;	/* no. of bytes from start of this */
4047c478bd9Sstevel@tonic-gate } Elf64_Verneed;			/*	verneed to next verneed entry */
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate typedef struct {
4077c478bd9Sstevel@tonic-gate 	Elf64_Word	vna_hash;	/* version name hash value */
4087c478bd9Sstevel@tonic-gate 	Elf64_Half	vna_flags;	/* version information */
4097c478bd9Sstevel@tonic-gate 	Elf64_Half	vna_other;
4107c478bd9Sstevel@tonic-gate 	Elf64_Word	vna_name;	/* version name */
4117c478bd9Sstevel@tonic-gate 	Elf64_Word	vna_next;	/* no. of bytes from start of this */
4127c478bd9Sstevel@tonic-gate } Elf64_Vernaux;			/*	vernaux to next vernaux entry */
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate typedef	Elf64_Half	Elf64_Versym;
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate typedef struct {
4177c478bd9Sstevel@tonic-gate 	Elf64_Half	si_boundto;	/* direct bindings - symbol bound to */
4187c478bd9Sstevel@tonic-gate 	Elf64_Half	si_flags;	/* per symbol flags */
4197c478bd9Sstevel@tonic-gate } Elf64_Syminfo;
4207c478bd9Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate #endif	/* _ASM */
4237c478bd9Sstevel@tonic-gate 
4247c478bd9Sstevel@tonic-gate /*
4257c478bd9Sstevel@tonic-gate  * Versym symbol index values.  Values greater than VER_NDX_GLOBAL
4267c478bd9Sstevel@tonic-gate  * and less then VER_NDX_LORESERVE associate symbols with user
4277c478bd9Sstevel@tonic-gate  * specified version descriptors.
4287c478bd9Sstevel@tonic-gate  */
4297c478bd9Sstevel@tonic-gate #define	VER_NDX_LOCAL		0	/* symbol is local */
4307c478bd9Sstevel@tonic-gate #define	VER_NDX_GLOBAL		1	/* symbol is global and assigned to */
4317c478bd9Sstevel@tonic-gate 					/*	the base version */
4327c478bd9Sstevel@tonic-gate #define	VER_NDX_LORESERVE	0xff00	/* beginning of RESERVED entries */
4337c478bd9Sstevel@tonic-gate #define	VER_NDX_ELIMINATE	0xff01	/* symbol is to be eliminated */
4347c478bd9Sstevel@tonic-gate 
4357c478bd9Sstevel@tonic-gate /*
436090a8d9eSAli Bahrami  * Verdef (vd_flags) and Vernaux (vna_flags) flags values.
4377c478bd9Sstevel@tonic-gate  */
4387c478bd9Sstevel@tonic-gate #define	VER_FLG_BASE		0x1	/* version definition of file itself */
439090a8d9eSAli Bahrami 					/*	(Verdef only) */
4407c478bd9Sstevel@tonic-gate #define	VER_FLG_WEAK		0x2	/* weak version identifier */
441090a8d9eSAli Bahrami #define	VER_FLG_INFO		0x4	/* version is recorded in object for */
442090a8d9eSAli Bahrami 					/*	informational purposes */
443090a8d9eSAli Bahrami 					/*	(Versym reference) only. No */
444090a8d9eSAli Bahrami 					/*	runtime verification is */
445090a8d9eSAli Bahrami 					/*	required. (Vernaux only) */
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate /*
4487c478bd9Sstevel@tonic-gate  * Verdef version values.
4497c478bd9Sstevel@tonic-gate  */
4507c478bd9Sstevel@tonic-gate #define	VER_DEF_NONE		0	/* Ver_def version */
4517c478bd9Sstevel@tonic-gate #define	VER_DEF_CURRENT		1
4527c478bd9Sstevel@tonic-gate #define	VER_DEF_NUM		2
4537c478bd9Sstevel@tonic-gate 
4547c478bd9Sstevel@tonic-gate /*
4557c478bd9Sstevel@tonic-gate  * Verneed version values.
4567c478bd9Sstevel@tonic-gate  */
4577c478bd9Sstevel@tonic-gate #define	VER_NEED_NONE		0	/* Ver_need version */
4587c478bd9Sstevel@tonic-gate #define	VER_NEED_CURRENT	1
4597c478bd9Sstevel@tonic-gate #define	VER_NEED_NUM		2
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate /*
4637c478bd9Sstevel@tonic-gate  * Syminfo flag values
4647c478bd9Sstevel@tonic-gate  */
4657c478bd9Sstevel@tonic-gate #define	SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association */
4667c478bd9Sstevel@tonic-gate 					/*	to object containing defn. */
4674f680cc6SAli Bahrami #define	SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
4684f680cc6SAli Bahrami 					/*	standard filter */
46994c044f4SRod Evans #define	SYMINFO_FLG_PASSTHRU	SYMINFO_FLG_FILTER /* unused obsolete name */
4707c478bd9Sstevel@tonic-gate #define	SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
4719a411307Srie #define	SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn. should be */
4727c478bd9Sstevel@tonic-gate 					/*	lazily-loaded */
4737c478bd9Sstevel@tonic-gate #define	SYMINFO_FLG_DIRECTBIND	0x0010	/* ref should be bound directly to */
4747c478bd9Sstevel@tonic-gate 					/*	object containing defn. */
4757c478bd9Sstevel@tonic-gate #define	SYMINFO_FLG_NOEXTDIRECT	0x0020	/* don't let an external reference */
4767c478bd9Sstevel@tonic-gate 					/*	directly bind to this symbol */
4774f680cc6SAli Bahrami #define	SYMINFO_FLG_AUXILIARY	0x0040	/* symbol ref is associated to a */
4784f680cc6SAli Bahrami 					/*	auxiliary filter */
4799a411307Srie #define	SYMINFO_FLG_INTERPOSE	0x0080	/* symbol defines an interposer */
48008278a5eSRod Evans #define	SYMINFO_FLG_CAP		0x0100	/* symbol is capabilities specific */
481f441771bSRod Evans #define	SYMINFO_FLG_DEFERRED	0x0200	/* symbol should not be included in */
482f441771bSRod Evans 					/*	BIND_NOW relocations */
4837c478bd9Sstevel@tonic-gate 
4847c478bd9Sstevel@tonic-gate /*
4857c478bd9Sstevel@tonic-gate  * Syminfo.si_boundto values.
4867c478bd9Sstevel@tonic-gate  */
4877c478bd9Sstevel@tonic-gate #define	SYMINFO_BT_SELF		0xffff	/* symbol bound to self */
4887c478bd9Sstevel@tonic-gate #define	SYMINFO_BT_PARENT	0xfffe	/* symbol bound to parent */
4897c478bd9Sstevel@tonic-gate #define	SYMINFO_BT_NONE		0xfffd	/* no special symbol binding */
4907c478bd9Sstevel@tonic-gate #define	SYMINFO_BT_EXTERN	0xfffc	/* symbol defined as external */
4917c478bd9Sstevel@tonic-gate #define	SYMINFO_BT_LOWRESERVE	0xff00	/* beginning of reserved entries */
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate /*
4947c478bd9Sstevel@tonic-gate  * Syminfo version values.
4957c478bd9Sstevel@tonic-gate  */
4967c478bd9Sstevel@tonic-gate #define	SYMINFO_NONE		0	/* Syminfo version */
4977c478bd9Sstevel@tonic-gate #define	SYMINFO_CURRENT		1
4987c478bd9Sstevel@tonic-gate #define	SYMINFO_NUM		2
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate /*
5027c478bd9Sstevel@tonic-gate  * Public structure defined and maintained within the runtime linker
5037c478bd9Sstevel@tonic-gate  */
5047c478bd9Sstevel@tonic-gate #ifndef	_ASM
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate typedef struct link_map	Link_map;
5077c478bd9Sstevel@tonic-gate 
5087c478bd9Sstevel@tonic-gate struct link_map {
5097c478bd9Sstevel@tonic-gate 	unsigned long	l_addr;		/* address at which object is mapped */
5107c478bd9Sstevel@tonic-gate 	char		*l_name;	/* full name of loaded object */
5117c478bd9Sstevel@tonic-gate #ifdef _LP64
5127c478bd9Sstevel@tonic-gate 	Elf64_Dyn	*l_ld;		/* dynamic structure of object */
5137c478bd9Sstevel@tonic-gate #else
5147c478bd9Sstevel@tonic-gate 	Elf32_Dyn	*l_ld;		/* dynamic structure of object */
5157c478bd9Sstevel@tonic-gate #endif
5167c478bd9Sstevel@tonic-gate 	Link_map	*l_next;	/* next link object */
5177c478bd9Sstevel@tonic-gate 	Link_map	*l_prev;	/* previous link object */
5187c478bd9Sstevel@tonic-gate 	char		*l_refname;	/* filters reference name */
5197c478bd9Sstevel@tonic-gate };
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
5227c478bd9Sstevel@tonic-gate typedef struct link_map32 Link_map32;
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate struct link_map32 {
5257c478bd9Sstevel@tonic-gate 	Elf32_Word	l_addr;
5267c478bd9Sstevel@tonic-gate 	Elf32_Addr	l_name;
5277c478bd9Sstevel@tonic-gate 	Elf32_Addr	l_ld;
5287c478bd9Sstevel@tonic-gate 	Elf32_Addr	l_next;
5297c478bd9Sstevel@tonic-gate 	Elf32_Addr	l_prev;
5307c478bd9Sstevel@tonic-gate 	Elf32_Addr	l_refname;
5317c478bd9Sstevel@tonic-gate };
5327c478bd9Sstevel@tonic-gate #endif
5337c478bd9Sstevel@tonic-gate 
5347c478bd9Sstevel@tonic-gate typedef enum {
5357c478bd9Sstevel@tonic-gate 	RT_CONSISTENT,
5367c478bd9Sstevel@tonic-gate 	RT_ADD,
5377c478bd9Sstevel@tonic-gate 	RT_DELETE
5387c478bd9Sstevel@tonic-gate } r_state_e;
5397c478bd9Sstevel@tonic-gate 
5407c478bd9Sstevel@tonic-gate typedef enum {
5417c478bd9Sstevel@tonic-gate 	RD_FL_NONE = 0,		/* no flags */
5427c478bd9Sstevel@tonic-gate 	RD_FL_ODBG = (1<<0),	/* old style debugger present */
5437c478bd9Sstevel@tonic-gate 	RD_FL_DBG = (1<<1)	/* debugging enabled */
5447c478bd9Sstevel@tonic-gate } rd_flags_e;
5457c478bd9Sstevel@tonic-gate 
5467c478bd9Sstevel@tonic-gate 
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate /*
5497c478bd9Sstevel@tonic-gate  * Debugging events enabled inside of the runtime linker.  To
5507c478bd9Sstevel@tonic-gate  * access these events see the librtld_db interface.
5517c478bd9Sstevel@tonic-gate  */
5527c478bd9Sstevel@tonic-gate typedef enum {
5537c478bd9Sstevel@tonic-gate 	RD_NONE = 0,		/* no event */
5547c478bd9Sstevel@tonic-gate 	RD_PREINIT,		/* the Initial rendezvous before .init */
5557c478bd9Sstevel@tonic-gate 	RD_POSTINIT,		/* the Second rendezvous after .init */
5567c478bd9Sstevel@tonic-gate 	RD_DLACTIVITY		/* a dlopen or dlclose has happened */
5577c478bd9Sstevel@tonic-gate } rd_event_e;
5587c478bd9Sstevel@tonic-gate 
5597c478bd9Sstevel@tonic-gate struct r_debug {
5607c478bd9Sstevel@tonic-gate 	int		r_version;	/* debugging info version no. */
5617c478bd9Sstevel@tonic-gate 	Link_map	*r_map;		/* address of link_map */
5627c478bd9Sstevel@tonic-gate 	unsigned long	r_brk;		/* address of update routine */
5637c478bd9Sstevel@tonic-gate 	r_state_e	r_state;
5647c478bd9Sstevel@tonic-gate 	unsigned long	r_ldbase;	/* base addr of ld.so */
5657c478bd9Sstevel@tonic-gate 	Link_map	*r_ldsomap;	/* address of ld.so.1's link map */
5667c478bd9Sstevel@tonic-gate 	rd_event_e	r_rdevent;	/* debug event */
5677c478bd9Sstevel@tonic-gate 	rd_flags_e	r_flags;	/* misc flags. */
5687c478bd9Sstevel@tonic-gate };
5697c478bd9Sstevel@tonic-gate 
5707c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
5717c478bd9Sstevel@tonic-gate struct r_debug32 {
5727c478bd9Sstevel@tonic-gate 	Elf32_Word	r_version;	/* debugging info version no. */
5737c478bd9Sstevel@tonic-gate 	Elf32_Addr	r_map;		/* address of link_map */
5747c478bd9Sstevel@tonic-gate 	Elf32_Word	r_brk;		/* address of update routine */
5757c478bd9Sstevel@tonic-gate 	r_state_e	r_state;
5767c478bd9Sstevel@tonic-gate 	Elf32_Word	r_ldbase;	/* base addr of ld.so */
5777c478bd9Sstevel@tonic-gate 	Elf32_Addr	r_ldsomap;	/* address of ld.so.1's link map */
5787c478bd9Sstevel@tonic-gate 	rd_event_e	r_rdevent;	/* debug event */
5797c478bd9Sstevel@tonic-gate 	rd_flags_e	r_flags;	/* misc flags. */
5807c478bd9Sstevel@tonic-gate };
5817c478bd9Sstevel@tonic-gate #endif
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate 
5847c478bd9Sstevel@tonic-gate #define	R_DEBUG_VERSION	2		/* current r_debug version */
5857c478bd9Sstevel@tonic-gate #endif	/* _ASM */
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate /*
5887c478bd9Sstevel@tonic-gate  * Attribute/value structures used to bootstrap ELF-based dynamic linker.
5897c478bd9Sstevel@tonic-gate  */
5907c478bd9Sstevel@tonic-gate #ifndef	_ASM
5917c478bd9Sstevel@tonic-gate typedef struct {
5927c478bd9Sstevel@tonic-gate 	Elf32_Sword eb_tag;		/* what this one is */
5937c478bd9Sstevel@tonic-gate 	union {				/* possible values */
5947c478bd9Sstevel@tonic-gate 		Elf32_Word eb_val;
5957c478bd9Sstevel@tonic-gate 		Elf32_Addr eb_ptr;
5967c478bd9Sstevel@tonic-gate 		Elf32_Off  eb_off;
5977c478bd9Sstevel@tonic-gate 	} eb_un;
5987c478bd9Sstevel@tonic-gate } Elf32_Boot;
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
6017c478bd9Sstevel@tonic-gate typedef struct {
6027c478bd9Sstevel@tonic-gate 	Elf64_Xword eb_tag;		/* what this one is */
6037c478bd9Sstevel@tonic-gate 	union {				/* possible values */
6047c478bd9Sstevel@tonic-gate 		Elf64_Xword eb_val;
6057c478bd9Sstevel@tonic-gate 		Elf64_Addr eb_ptr;
6067c478bd9Sstevel@tonic-gate 		Elf64_Off eb_off;
6077c478bd9Sstevel@tonic-gate 	} eb_un;
6087c478bd9Sstevel@tonic-gate } Elf64_Boot;
6097c478bd9Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_LONGLONG_TYPE) */
6107c478bd9Sstevel@tonic-gate #endif	/* _ASM */
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate /*
6137c478bd9Sstevel@tonic-gate  * Attributes
6147c478bd9Sstevel@tonic-gate  */
6157c478bd9Sstevel@tonic-gate #define	EB_NULL		0		/* (void) last entry */
6167c478bd9Sstevel@tonic-gate #define	EB_DYNAMIC	1		/* (*) dynamic structure of subject */
6177c478bd9Sstevel@tonic-gate #define	EB_LDSO_BASE	2		/* (caddr_t) base address of ld.so */
6187c478bd9Sstevel@tonic-gate #define	EB_ARGV		3		/* (caddr_t) argument vector */
6197c478bd9Sstevel@tonic-gate #define	EB_ENVP		4		/* (char **) environment strings */
6207c478bd9Sstevel@tonic-gate #define	EB_AUXV		5		/* (auxv_t *) auxiliary vector */
6217c478bd9Sstevel@tonic-gate #define	EB_DEVZERO	6		/* (int) fd for /dev/zero */
6227c478bd9Sstevel@tonic-gate #define	EB_PAGESIZE	7		/* (int) page size */
6237c478bd9Sstevel@tonic-gate #define	EB_MAX		8		/* number of "EBs" */
6247c478bd9Sstevel@tonic-gate #define	EB_MAX_SIZE32	64		/* size in bytes, _ILP32 */
6257c478bd9Sstevel@tonic-gate #define	EB_MAX_SIZE64	128		/* size in bytes, _LP64 */
6267c478bd9Sstevel@tonic-gate 
6277c478bd9Sstevel@tonic-gate 
6287c478bd9Sstevel@tonic-gate #ifndef	_ASM
6297c478bd9Sstevel@tonic-gate 
6307c478bd9Sstevel@tonic-gate /*
6317c478bd9Sstevel@tonic-gate  * Concurrency communication structure for libc callbacks.
6327c478bd9Sstevel@tonic-gate  */
6337c478bd9Sstevel@tonic-gate extern void	_ld_libc(void *);
6347c478bd9Sstevel@tonic-gate 
6357c478bd9Sstevel@tonic-gate #pragma unknown_control_flow(_ld_libc)
6367c478bd9Sstevel@tonic-gate #endif /* _ASM */
6377c478bd9Sstevel@tonic-gate 
6387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6397c478bd9Sstevel@tonic-gate }
6407c478bd9Sstevel@tonic-gate #endif
6417c478bd9Sstevel@tonic-gate 
6427c478bd9Sstevel@tonic-gate #endif	/* _SYS_LINK_H */
643