xref: /titanic_52/usr/src/head/link.h (revision 20272c2e66d77f79ef35e7160584b5d098c3287f)
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
59acbbeafSnn35248  * Common Development and Distribution License (the "License").
69acbbeafSnn35248  * 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 /*
22*20272c2eSAli Bahrami  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _LINK_H
277c478bd9Sstevel@tonic-gate #define	_LINK_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/link.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _ASM
327c478bd9Sstevel@tonic-gate #include <libelf.h>
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <dlfcn.h>
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifndef _ASM
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * ld support library calls
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #ifdef __STDC__
467c478bd9Sstevel@tonic-gate extern uint_t	ld_version(uint_t);
473906e0c2Srie extern void	ld_input_done(uint_t *);
483906e0c2Srie 
497c478bd9Sstevel@tonic-gate extern void	ld_start(const char *, const Elf32_Half, const char *);
507c478bd9Sstevel@tonic-gate extern void	ld_atexit(int);
513906e0c2Srie extern void	ld_open(const char **, const char **, int *, int, Elf **,
523906e0c2Srie 			Elf *, size_t, const Elf_Kind);
537c478bd9Sstevel@tonic-gate extern void	ld_file(const char *, const Elf_Kind, int, Elf *);
547c478bd9Sstevel@tonic-gate extern void	ld_input_section(const char *, Elf32_Shdr **, Elf32_Word,
557c478bd9Sstevel@tonic-gate 			Elf_Data *, Elf *, uint_t *);
567c478bd9Sstevel@tonic-gate extern void	ld_section(const char *, Elf32_Shdr *, Elf32_Word,
577c478bd9Sstevel@tonic-gate 			Elf_Data *, Elf *);
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
607c478bd9Sstevel@tonic-gate extern void	ld_start64(const char *, const Elf64_Half, const char *);
617c478bd9Sstevel@tonic-gate extern void	ld_atexit64(int);
623906e0c2Srie extern void	ld_open64(const char **, const char **, int *, int, Elf **,
633906e0c2Srie 			Elf *, size_t, const Elf_Kind);
647c478bd9Sstevel@tonic-gate extern void	ld_file64(const char *, const Elf_Kind, int, Elf *);
657c478bd9Sstevel@tonic-gate extern void	ld_input_section64(const char *, Elf64_Shdr **, Elf64_Word,
667c478bd9Sstevel@tonic-gate 			Elf_Data *, Elf *, uint_t *);
677c478bd9Sstevel@tonic-gate extern void	ld_section64(const char *, Elf64_Shdr *, Elf64_Word,
687c478bd9Sstevel@tonic-gate 			Elf_Data *, Elf *);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */
717c478bd9Sstevel@tonic-gate #else
727c478bd9Sstevel@tonic-gate extern void	ld_version();
733906e0c2Srie extern void	ld_input_done();
743906e0c2Srie 
757c478bd9Sstevel@tonic-gate extern void	ld_start();
767c478bd9Sstevel@tonic-gate extern void	ld_atexit();
773906e0c2Srie extern void	ld_open();
787c478bd9Sstevel@tonic-gate extern void	ld_file();
797c478bd9Sstevel@tonic-gate extern void	ld_input_section();
807c478bd9Sstevel@tonic-gate extern void	ld_section();
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_LONGLONG_TYPE)
837c478bd9Sstevel@tonic-gate extern void	ld_start64();
847c478bd9Sstevel@tonic-gate extern void	ld_atexit64();
853906e0c2Srie extern void	ld_open64();
867c478bd9Sstevel@tonic-gate extern void	ld_file64();
873906e0c2Srie extern void	ld_input_section64();
887c478bd9Sstevel@tonic-gate extern void	ld_section64();
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */
917c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate /*
943906e0c2Srie  * ld_version() version values.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate #define	LD_SUP_VNONE	0
977c478bd9Sstevel@tonic-gate #define	LD_SUP_VERSION1	1
987c478bd9Sstevel@tonic-gate #define	LD_SUP_VERSION2	2
993906e0c2Srie #define	LD_SUP_VERSION3	3
1003906e0c2Srie #define	LD_SUP_VCURRENT	LD_SUP_VERSION3
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1033906e0c2Srie  * Flags passed to ld support calls.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate #define	LD_SUP_DERIVED		0x1	/* derived filename */
1067c478bd9Sstevel@tonic-gate #define	LD_SUP_INHERITED	0x2	/* file inherited from .so DT_NEEDED */
1077c478bd9Sstevel@tonic-gate #define	LD_SUP_EXTRACTED	0x4	/* file extracted from archive */
1087c478bd9Sstevel@tonic-gate #endif
1097c478bd9Sstevel@tonic-gate 
1103906e0c2Srie /*
1113906e0c2Srie  * Runtime link-map identifiers.
1123906e0c2Srie  */
1137c478bd9Sstevel@tonic-gate #define	LM_ID_BASE		0x00
1147c478bd9Sstevel@tonic-gate #define	LM_ID_LDSO		0x01
11522872efbSedp #define	LM_ID_NUM		2
1169acbbeafSnn35248 
11722872efbSedp #define	LM_ID_BRAND		0xfd	/* brand emulation linkmap objs */
11822872efbSedp #define	LM_ID_NONE		0xfe	/* no link map specified */
1197c478bd9Sstevel@tonic-gate #define	LM_ID_NEWLM		0xff	/* create a new link-map */
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1223906e0c2Srie  * Runtime Link-Edit Auditing.
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define	LAV_NONE		0
1257c478bd9Sstevel@tonic-gate #define	LAV_VERSION1		1
1267c478bd9Sstevel@tonic-gate #define	LAV_VERSION2		2
1277c478bd9Sstevel@tonic-gate #define	LAV_VERSION3		3
1287247f888Srie #define	LAV_VERSION4		4
1297247f888Srie #define	LAV_CURRENT		LAV_VERSION4
1307247f888Srie #define	LAV_NUM			5
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * Flags that can be or'd into the la_objopen() return code
1347c478bd9Sstevel@tonic-gate  */
1357c478bd9Sstevel@tonic-gate #define	LA_FLG_BINDTO		0x0001	/* audit symbinds TO this object */
1367c478bd9Sstevel@tonic-gate #define	LA_FLG_BINDFROM		0x0002	/* audit symbinding FROM this object */
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * Flags that can be or'd into the 'flags' argument of la_symbind()
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate #define	LA_SYMB_NOPLTENTER	0x0001	/* disable pltenter for this symbol */
1427c478bd9Sstevel@tonic-gate #define	LA_SYMB_NOPLTEXIT	0x0002	/* disable pltexit for this symbol */
1437c478bd9Sstevel@tonic-gate #define	LA_SYMB_STRUCTCALL	0x0004	/* this function call passes a */
1447c478bd9Sstevel@tonic-gate 					/*	structure as it's return code */
1457c478bd9Sstevel@tonic-gate #define	LA_SYMB_DLSYM		0x0008	/* this symbol bindings is due to */
1467c478bd9Sstevel@tonic-gate 					/*	a call to dlsym() */
1477c478bd9Sstevel@tonic-gate #define	LA_SYMB_ALTVALUE	0x0010	/* alternate symbol binding returned */
1487c478bd9Sstevel@tonic-gate 					/*	by la_symbind() */
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Flags that describe the object passed to la_objsearch()
1527c478bd9Sstevel@tonic-gate  */
1537c478bd9Sstevel@tonic-gate #define	LA_SER_ORIG		0x001	/* original (needed) name */
1547c478bd9Sstevel@tonic-gate #define	LA_SER_LIBPATH		0x002	/* LD_LIBRARY_PATH entry prepended */
1557c478bd9Sstevel@tonic-gate #define	LA_SER_RUNPATH		0x004	/* runpath entry prepended */
1567c478bd9Sstevel@tonic-gate #define	LA_SER_CONFIG		0x008	/* configuration entry prepended */
1577c478bd9Sstevel@tonic-gate #define	LA_SER_DEFAULT		0x040	/* default path prepended */
1587c478bd9Sstevel@tonic-gate #define	LA_SER_SECURE		0x080	/* default (secure) path prepended */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #define	LA_SER_MASK		0xfff	/* mask of known flags */
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * Flags that describe the la_activity()
1647c478bd9Sstevel@tonic-gate  */
1657c478bd9Sstevel@tonic-gate #define	LA_ACT_CONSISTENT	0x00	/* add/deletion of objects complete */
1667c478bd9Sstevel@tonic-gate #define	LA_ACT_ADD		0x01	/* objects being added */
1677c478bd9Sstevel@tonic-gate #define	LA_ACT_DELETE		0x02	/* objects being deleted */
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #ifndef	_KERNEL
1717c478bd9Sstevel@tonic-gate #ifndef	_ASM
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #if defined(_LP64)
1747c478bd9Sstevel@tonic-gate typedef long	lagreg_t;
1757c478bd9Sstevel@tonic-gate #else
1767c478bd9Sstevel@tonic-gate typedef int	lagreg_t;
1777c478bd9Sstevel@tonic-gate #endif
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate struct _la_sparc_regs {
1807c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego0;
1817c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego1;
1827c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego2;
1837c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego3;
1847c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego4;
1857c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego5;
1867c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego6;
1877c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rego7;
1887c478bd9Sstevel@tonic-gate };
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate #if defined(_LP64)
1917c478bd9Sstevel@tonic-gate typedef struct _la_sparc_regs	La_sparcv9_regs;
1927c478bd9Sstevel@tonic-gate typedef struct {
1937c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rsp;
1947c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rbp;
1957c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rdi;	    /* arg1 */
1967c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rsi;	    /* arg2 */
1977c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rdx;	    /* arg3 */
1987c478bd9Sstevel@tonic-gate 	lagreg_t	lr_rcx;	    /* arg4 */
1997c478bd9Sstevel@tonic-gate 	lagreg_t	lr_r8;	    /* arg5 */
2007c478bd9Sstevel@tonic-gate 	lagreg_t	lr_r9;	    /* arg6 */
2017c478bd9Sstevel@tonic-gate } La_amd64_regs;
2027c478bd9Sstevel@tonic-gate #else
2037c478bd9Sstevel@tonic-gate typedef struct _la_sparc_regs	La_sparcv8_regs;
2047c478bd9Sstevel@tonic-gate typedef struct {
2057c478bd9Sstevel@tonic-gate 	lagreg_t	lr_esp;
2067c478bd9Sstevel@tonic-gate 	lagreg_t	lr_ebp;
2077c478bd9Sstevel@tonic-gate } La_i86_regs;
2087c478bd9Sstevel@tonic-gate #endif
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate #if	!defined(_SYS_INT_TYPES_H)
2117c478bd9Sstevel@tonic-gate #if	defined(_LP64) || defined(_I32LPx)
2127c478bd9Sstevel@tonic-gate typedef unsigned long		uintptr_t;
2137c478bd9Sstevel@tonic-gate #else
2147c478bd9Sstevel@tonic-gate typedef	unsigned int		uintptr_t;
2157c478bd9Sstevel@tonic-gate #endif
2167c478bd9Sstevel@tonic-gate #endif
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate #ifdef	__STDC__
2207c478bd9Sstevel@tonic-gate extern uint_t		la_version(uint_t);
2217c478bd9Sstevel@tonic-gate extern void		la_activity(uintptr_t *, uint_t);
2227c478bd9Sstevel@tonic-gate extern void		la_preinit(uintptr_t *);
2237c478bd9Sstevel@tonic-gate extern char		*la_objsearch(const char *, uintptr_t *, uint_t);
2247c478bd9Sstevel@tonic-gate extern uint_t		la_objopen(Link_map *, Lmid_t, uintptr_t *);
2257c478bd9Sstevel@tonic-gate extern uint_t		la_objclose(uintptr_t *);
2267c478bd9Sstevel@tonic-gate extern int		la_objfilter(uintptr_t *, const char *, uintptr_t *,
2277c478bd9Sstevel@tonic-gate 				uint_t);
2287c478bd9Sstevel@tonic-gate #if	defined(_LP64)
2297c478bd9Sstevel@tonic-gate extern uintptr_t	la_amd64_pltenter(Elf64_Sym *, uint_t, uintptr_t *,
2307c478bd9Sstevel@tonic-gate 				uintptr_t *, La_amd64_regs *,	uint_t *,
2317c478bd9Sstevel@tonic-gate 				const char *);
2327c478bd9Sstevel@tonic-gate extern uintptr_t	la_symbind64(Elf64_Sym *, uint_t, uintptr_t *,
2337c478bd9Sstevel@tonic-gate 				uintptr_t *, uint_t *, const char *);
2347c478bd9Sstevel@tonic-gate extern uintptr_t	la_sparcv9_pltenter(Elf64_Sym *, uint_t, uintptr_t *,
2357c478bd9Sstevel@tonic-gate 				uintptr_t *, La_sparcv9_regs *,	uint_t *,
2367c478bd9Sstevel@tonic-gate 				const char *);
2377c478bd9Sstevel@tonic-gate extern uintptr_t	la_pltexit64(Elf64_Sym *, uint_t, uintptr_t *,
2387c478bd9Sstevel@tonic-gate 				uintptr_t *, uintptr_t, const char *);
2397c478bd9Sstevel@tonic-gate #else  /* !defined(_LP64) */
2407c478bd9Sstevel@tonic-gate extern uintptr_t	la_symbind32(Elf32_Sym *, uint_t, uintptr_t *,
2417c478bd9Sstevel@tonic-gate 				uintptr_t *, uint_t *);
2427c478bd9Sstevel@tonic-gate extern uintptr_t	la_sparcv8_pltenter(Elf32_Sym *, uint_t, uintptr_t *,
2437c478bd9Sstevel@tonic-gate 				uintptr_t *, La_sparcv8_regs *, uint_t *);
2447c478bd9Sstevel@tonic-gate extern uintptr_t	la_i86_pltenter(Elf32_Sym *, uint_t, uintptr_t *,
2457c478bd9Sstevel@tonic-gate 				uintptr_t *, La_i86_regs *, uint_t *);
2467c478bd9Sstevel@tonic-gate extern uintptr_t	la_pltexit(Elf32_Sym *, uint_t, uintptr_t *,
2477c478bd9Sstevel@tonic-gate 				uintptr_t *, uintptr_t);
2487c478bd9Sstevel@tonic-gate #endif /* _LP64 */
2497c478bd9Sstevel@tonic-gate #else  /* __STDC__ */
2507c478bd9Sstevel@tonic-gate extern uint_t		la_version();
2517c478bd9Sstevel@tonic-gate extern void		la_preinit();
2527c478bd9Sstevel@tonic-gate extern uint_t		la_objopen();
2537c478bd9Sstevel@tonic-gate extern uint_t		la_objclose();
2547c478bd9Sstevel@tonic-gate extern int		la_objfilter();
2557c478bd9Sstevel@tonic-gate #if	defined(_LP64)
2567c478bd9Sstevel@tonic-gate extern uintptr_t	la_sparcv9_pltenter();
2577c478bd9Sstevel@tonic-gate extern uintptr_t	la_pltexit64();
2587c478bd9Sstevel@tonic-gate extern uintptr_t	la_symbind64();
2597c478bd9Sstevel@tonic-gate #else  /* _ILP32 */
2607c478bd9Sstevel@tonic-gate extern uintptr_t	la_sparcv8_pltenter();
2617c478bd9Sstevel@tonic-gate extern uintptr_t	la_i86_pltenter();
2627c478bd9Sstevel@tonic-gate extern uintptr_t	la_pltexit();
2637c478bd9Sstevel@tonic-gate extern uintptr_t	la_symbind32();
2647c478bd9Sstevel@tonic-gate #endif /* _LP64 */
2657c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate 
268*20272c2eSAli Bahrami /*
269*20272c2eSAli Bahrami  * The ElfW() macro is a GNU/Linux feature, provided as support for
270*20272c2eSAli Bahrami  * the dl_phdr_info structure used by dl_phdr_iterate(), which also
271*20272c2eSAli Bahrami  * originated under Linux. Given an ELF data type, without the ElfXX_
272*20272c2eSAli Bahrami  * prefix, it supplies the appropriate prefix (Elf32_ or Elf64_) for
273*20272c2eSAli Bahrami  * the ELFCLASS of the code being compiled.
274*20272c2eSAli Bahrami  *
275*20272c2eSAli Bahrami  * Note that ElfW() is not suitable in situations in which the ELFCLASS
276*20272c2eSAli Bahrami  * of the code being compiled does not match that of the objects that
277*20272c2eSAli Bahrami  * code is intended to operate on (e.g. a 32-bit link-editor building
278*20272c2eSAli Bahrami  * a 64-bit object). The macros defined in <sys/machelf.h> are
279*20272c2eSAli Bahrami  * recommended in such cases.
280*20272c2eSAli Bahrami  */
281*20272c2eSAli Bahrami #ifdef _LP64
282*20272c2eSAli Bahrami #define	ElfW(type)	Elf64_ ## type
283*20272c2eSAli Bahrami #else
284*20272c2eSAli Bahrami #define	ElfW(type)	Elf32_ ## type
285*20272c2eSAli Bahrami #endif
286*20272c2eSAli Bahrami 
287*20272c2eSAli Bahrami /*
288*20272c2eSAli Bahrami  * The callback function to dl_interate_phdr() receives a pointer
289*20272c2eSAli Bahrami  * to a structure of this type.
290*20272c2eSAli Bahrami  *
291*20272c2eSAli Bahrami  * dlpi_addr is defined such that the address of any segment in
292*20272c2eSAli Bahrami  * the program header array can be calculated as:
293*20272c2eSAli Bahrami  *
294*20272c2eSAli Bahrami  *	addr == info->dlpi_addr + info->dlpi_phdr[x].p_vaddr;
295*20272c2eSAli Bahrami  *
296*20272c2eSAli Bahrami  * It is therefore 0 for ET_EXEC objects, and the base address at
297*20272c2eSAli Bahrami  * which the object is mapped otherwise.
298*20272c2eSAli Bahrami  */
299*20272c2eSAli Bahrami struct dl_phdr_info {
300*20272c2eSAli Bahrami 	ElfW(Addr)		dlpi_addr;	/* Base address of object */
301*20272c2eSAli Bahrami 	const char		*dlpi_name;	/* Null-terminated obj name */
302*20272c2eSAli Bahrami 	const ElfW(Phdr)	*dlpi_phdr;	/* Ptr to ELF program hdr arr */
303*20272c2eSAli Bahrami 	ElfW(Half)		dlpi_phnum;	/* # of items in dlpi_phdr[] */
304*20272c2eSAli Bahrami 
305*20272c2eSAli Bahrami 	/*
306*20272c2eSAli Bahrami 	 * Note: Following members were introduced after the first version
307*20272c2eSAli Bahrami 	 * of this structure was available.  The dl_iterate_phdr() callback
308*20272c2eSAli Bahrami 	 * function is passed a 'size' argument giving the size of the info
309*20272c2eSAli Bahrami 	 * structure, and must compare that size to the offset of these fields
310*20272c2eSAli Bahrami 	 * before accessing them to ensure that they are present.
311*20272c2eSAli Bahrami 	 */
312*20272c2eSAli Bahrami 
313*20272c2eSAli Bahrami 	/* Incremented when a new object is mapped into the process */
314*20272c2eSAli Bahrami 	u_longlong_t		dlpi_adds;
315*20272c2eSAli Bahrami 	/* Incremented when an object is unmapped from the process */
316*20272c2eSAli Bahrami 	u_longlong_t		dlpi_subs;
317*20272c2eSAli Bahrami };
318*20272c2eSAli Bahrami 
319*20272c2eSAli Bahrami extern  int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
320*20272c2eSAli Bahrami 	    void *);
321*20272c2eSAli Bahrami 
3227c478bd9Sstevel@tonic-gate #endif	/* _ASM */
3237c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3247c478bd9Sstevel@tonic-gate 
325*20272c2eSAli Bahrami 
3267c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate #endif
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #endif	/* _LINK_H */
331