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