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 55aefb655Srie * Common Development and Distribution License (the "License"). 65aefb655Srie * 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 * Copyright (c) 1988 AT&T 237c478bd9Sstevel@tonic-gate * All Rights Reserved 247c478bd9Sstevel@tonic-gate * 257c478bd9Sstevel@tonic-gate * 26cce0e03bSab * Copyright 2008 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 __RTLD_H 317c478bd9Sstevel@tonic-gate #define __RTLD_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Common header for run-time linker. 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate #include <sys/types.h> 377c478bd9Sstevel@tonic-gate #include <sys/stat.h> 387c478bd9Sstevel@tonic-gate #include <sys/avl.h> 397c478bd9Sstevel@tonic-gate #include <stdarg.h> 407c478bd9Sstevel@tonic-gate #include <synch.h> 417c478bd9Sstevel@tonic-gate #include <signal.h> 427c478bd9Sstevel@tonic-gate #include <errno.h> 437c478bd9Sstevel@tonic-gate #include <unistd.h> 447c478bd9Sstevel@tonic-gate #include <link.h> 457c478bd9Sstevel@tonic-gate #include <rtld.h> 467c478bd9Sstevel@tonic-gate #include <sgs.h> 477c478bd9Sstevel@tonic-gate #include <machdep.h> 487c478bd9Sstevel@tonic-gate #include <rtc.h> 495aefb655Srie #include <debug.h> 507c478bd9Sstevel@tonic-gate #include <msg.h> 517c478bd9Sstevel@tonic-gate #include <libc_int.h> 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #ifdef __cplusplus 547c478bd9Sstevel@tonic-gate extern "C" { 557c478bd9Sstevel@tonic-gate #endif 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * Dependency search rule order. 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate #define RPLENV 1 /* replaceable LD_LIBRARY_PATH */ 617c478bd9Sstevel@tonic-gate #define PRMENV 2 /* permanent LD_LIBRARY_PATH */ 627c478bd9Sstevel@tonic-gate #define RUNPATH 3 /* callers runpath */ 637c478bd9Sstevel@tonic-gate #define DEFAULT 4 /* default library path */ 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Data structure for file class specific functions and data. 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate typedef struct fct { 707c478bd9Sstevel@tonic-gate int (*fct_are_u_this)(Rej_desc *); /* determine type of object */ 717c478bd9Sstevel@tonic-gate ulong_t (*fct_entry_pt)(void); /* get entry point */ 727c478bd9Sstevel@tonic-gate Rt_map *(*fct_map_so)(Lm_list *, Aliste, const char *, const char *, 739aa23310Srie int, int *); /* map in a shared object */ 747c478bd9Sstevel@tonic-gate void (*fct_unmap_so)(Rt_map *); /* unmap a shared object */ 759aa23310Srie int (*fct_needed)(Lm_list *, Aliste, Rt_map *, int *); 767c478bd9Sstevel@tonic-gate /* determine needed objects */ 779aa23310Srie Sym *(*fct_lookup_sym)(Slookup *, Rt_map **, uint_t *, int *); 787c478bd9Sstevel@tonic-gate /* initialize symbol lookup */ 799aa23310Srie int (*fct_reloc)(Rt_map *, uint_t, int *); 809aa23310Srie /* relocate shared object */ 817c478bd9Sstevel@tonic-gate Pnode *fct_dflt_dirs; /* list of default dirs to */ 827c478bd9Sstevel@tonic-gate /* search */ 837c478bd9Sstevel@tonic-gate Pnode *fct_secure_dirs; /* list of secure dirs to */ 847c478bd9Sstevel@tonic-gate /* search (set[ug]id) */ 857c478bd9Sstevel@tonic-gate Pnode *(*fct_fix_name)(const char *, Rt_map *, uint_t); 867c478bd9Sstevel@tonic-gate /* transpose name */ 877c478bd9Sstevel@tonic-gate char *(*fct_get_so)(const char *, const char *); 887c478bd9Sstevel@tonic-gate /* get shared object */ 897c478bd9Sstevel@tonic-gate void (*fct_dladdr)(ulong_t, Rt_map *, Dl_info *, void **, int); 907c478bd9Sstevel@tonic-gate /* get symbolic address */ 919aa23310Srie Sym *(*fct_dlsym)(Grp_hdl *, Slookup *, Rt_map **, uint_t *, 929aa23310Srie int *); /* process dlsym request */ 937c478bd9Sstevel@tonic-gate int (*fct_verify_vers)(const char *, Rt_map *, Rt_map *); 947c478bd9Sstevel@tonic-gate /* verify versioning (ELF) */ 957c478bd9Sstevel@tonic-gate int (*fct_set_prot)(Rt_map *, int); 967c478bd9Sstevel@tonic-gate /* set protection */ 977c478bd9Sstevel@tonic-gate } Fct; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate /* 1017c478bd9Sstevel@tonic-gate * Return codes for util::anon_map(). 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate typedef enum { 1047c478bd9Sstevel@tonic-gate AM_OK, /* mmap(MAP_ANON) succeeded */ 1057c478bd9Sstevel@tonic-gate AM_NOSUP, /* mmap(MAP_ANON) not supported (old OS) */ 1067c478bd9Sstevel@tonic-gate AM_ERROR /* mmap(MAP_ANON) failed */ 1077c478bd9Sstevel@tonic-gate } Am_ret; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * Macros for getting to the file class table. 1127c478bd9Sstevel@tonic-gate */ 1137c478bd9Sstevel@tonic-gate #define LM_ENTRY_PT(X) ((X)->rt_fct->fct_entry_pt) 1147c478bd9Sstevel@tonic-gate #define LM_UNMAP_SO(X) ((X)->rt_fct->fct_unmap_so) 1157c478bd9Sstevel@tonic-gate #define LM_NEEDED(X) ((X)->rt_fct->fct_needed) 1167c478bd9Sstevel@tonic-gate #define LM_LOOKUP_SYM(X) ((X)->rt_fct->fct_lookup_sym) 1177c478bd9Sstevel@tonic-gate #define LM_RELOC(X) ((X)->rt_fct->fct_reloc) 1187c478bd9Sstevel@tonic-gate #define LM_DFLT_DIRS(X) ((X)->rt_fct->fct_dflt_dirs) 1197c478bd9Sstevel@tonic-gate #define LM_SECURE_DIRS(X) ((X)->rt_fct->fct_secure_dirs) 1207c478bd9Sstevel@tonic-gate #define LM_FIX_NAME(X) ((X)->rt_fct->fct_fix_name) 1217c478bd9Sstevel@tonic-gate #define LM_GET_SO(X) ((X)->rt_fct->fct_get_so) 1227c478bd9Sstevel@tonic-gate #define LM_DLADDR(X) ((X)->rt_fct->fct_dladdr) 1237c478bd9Sstevel@tonic-gate #define LM_DLSYM(X) ((X)->rt_fct->fct_dlsym) 1247c478bd9Sstevel@tonic-gate #define LM_VERIFY_VERS(X) ((X)->rt_fct->fct_verify_vers) 1257c478bd9Sstevel@tonic-gate #define LM_SET_PROT(X) ((X)->rt_fct->fct_set_prot) 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate /* 1297c478bd9Sstevel@tonic-gate * Define Alist initialization sizes. 1307c478bd9Sstevel@tonic-gate */ 1317c478bd9Sstevel@tonic-gate #define AL_CNT_ALIAS 2 /* ALIAS() initial alist count */ 1327c478bd9Sstevel@tonic-gate #define AL_CNT_DEPENDS 10 /* DEPENDS() initial alist count */ 1337c478bd9Sstevel@tonic-gate #define AL_CNT_CALLERS 10 /* CALLERS() initial alist count */ 1348521e5e6Srie #define AL_CNT_GROUPS 4 /* GROUPS() initial alist count */ 1357c478bd9Sstevel@tonic-gate #define AL_CNT_COPYREL 10 /* COPY() initial alist count */ 1367c478bd9Sstevel@tonic-gate #define AL_CNT_LAZYFIND 10 /* elf_lazy_find_sym() initial alist */ 1377c478bd9Sstevel@tonic-gate /* count */ 1387c478bd9Sstevel@tonic-gate #define AL_CNT_GRPCLCT 10 /* gdp_collect() initial alist count */ 1397c478bd9Sstevel@tonic-gate #define AL_CNT_DEPCLCT 10 /* load_so() initial alist count */ 1407c478bd9Sstevel@tonic-gate #define AL_CNT_RTLDINFO 1 /* RTLDINFO() initial alist count */ 1417c478bd9Sstevel@tonic-gate #define AL_CNT_FPNODE 2 /* FPNODE() initial alist count */ 1427c478bd9Sstevel@tonic-gate #define AL_CNT_LMLISTS 8 /* lm_lists initial alist count */ 1437c478bd9Sstevel@tonic-gate #define AL_CNT_LMNOW 8 /* lm_now initial alist count */ 1447c478bd9Sstevel@tonic-gate #define AL_CNT_RELBIND 20 /* relocation binding alist count */ 1457247f888Srie #define AL_CNT_ACTAUDIT 2 /* lm_actaudit alist count */ 146466e2a62Srie #define AL_CNT_MOVES 10 /* move_data alist count */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* 1507c478bd9Sstevel@tonic-gate * Size of buffer for building error messages. 1517c478bd9Sstevel@tonic-gate */ 1527c478bd9Sstevel@tonic-gate #define ERRSIZE 2048 /* MAXPATHLEN * 2 */ 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Configuration file information. 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate typedef struct config { 1597c478bd9Sstevel@tonic-gate const char *c_name; 1607c478bd9Sstevel@tonic-gate Addr c_bgn; 1617c478bd9Sstevel@tonic-gate Addr c_end; 1627c478bd9Sstevel@tonic-gate Word *c_hashtbl; 1637c478bd9Sstevel@tonic-gate Word *c_hashchain; 1647c478bd9Sstevel@tonic-gate const char *c_strtbl; 1657c478bd9Sstevel@tonic-gate Rtc_obj *c_objtbl; 1667c478bd9Sstevel@tonic-gate Rtc_fltr *c_fltr; 1677c478bd9Sstevel@tonic-gate Rtc_flte *c_flte; 1687c478bd9Sstevel@tonic-gate } Config; 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate /* 1717c478bd9Sstevel@tonic-gate * Register symbol list. 1727c478bd9Sstevel@tonic-gate */ 1737c478bd9Sstevel@tonic-gate typedef struct reglist { 1747c478bd9Sstevel@tonic-gate Rt_map *rl_lmp; /* defining object */ 1757c478bd9Sstevel@tonic-gate Sym *rl_sym; /* regsym */ 1767c478bd9Sstevel@tonic-gate struct reglist *rl_next; /* next entry */ 1777c478bd9Sstevel@tonic-gate } Reglist; 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * Data structure to hold interpreter information. 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate typedef struct interp { 1837c478bd9Sstevel@tonic-gate char *i_name; /* interpreter name */ 1847c478bd9Sstevel@tonic-gate caddr_t i_faddr; /* address interpreter is mapped at */ 1857c478bd9Sstevel@tonic-gate } Interp; 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate * Data structure used to keep track of copy relocations. These relocations 1897c478bd9Sstevel@tonic-gate * are collected during initial relocation processing and maintained on the 1907c478bd9Sstevel@tonic-gate * COPY(lmp) list of the defining object. Each copy list is also added to the 1917c478bd9Sstevel@tonic-gate * COPY(lmp) of the head object (normally the application dynamic executable) 1927c478bd9Sstevel@tonic-gate * from which they will be processed after all relocations are done. 1937c478bd9Sstevel@tonic-gate * 1947c478bd9Sstevel@tonic-gate * The use of RTLD_GROUP will also reference individual objects COPY(lmp) lists 1957c478bd9Sstevel@tonic-gate * in case a bound symbol must be assigned to it actual copy relocation. 1967c478bd9Sstevel@tonic-gate */ 1977c478bd9Sstevel@tonic-gate typedef struct { 1987c478bd9Sstevel@tonic-gate const char *r_name; /* symbol name */ 1997c478bd9Sstevel@tonic-gate Sym *r_rsym; /* reference symbol table entry */ 2007c478bd9Sstevel@tonic-gate Rt_map *r_rlmp; /* reference link map */ 2017c478bd9Sstevel@tonic-gate Rt_map *r_dlmp; /* definition link map */ 2027c478bd9Sstevel@tonic-gate Sym *r_dsym; /* definition symbol table entry */ 2037c478bd9Sstevel@tonic-gate void *r_radd; /* copy to address */ 2047c478bd9Sstevel@tonic-gate const void *r_dadd; /* copy from address */ 2057c478bd9Sstevel@tonic-gate ulong_t r_size; /* copy size bytes */ 2067c478bd9Sstevel@tonic-gate } Rel_copy; 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate /* 2097c478bd9Sstevel@tonic-gate * Data structure to hold initial file mapping information. Used to 2107c478bd9Sstevel@tonic-gate * communicate during initial object mapping and provide for error recovery. 2117c478bd9Sstevel@tonic-gate */ 2127c478bd9Sstevel@tonic-gate typedef struct { 2137c478bd9Sstevel@tonic-gate char *fm_maddr; /* address of initial mapping */ 2147c478bd9Sstevel@tonic-gate size_t fm_msize; /* size of initial mapping */ 2157c478bd9Sstevel@tonic-gate size_t fm_fsize; /* actual file size */ 2167c478bd9Sstevel@tonic-gate ulong_t fm_etext; /* end of text segment */ 2177c478bd9Sstevel@tonic-gate int fm_mflags; /* mapping flags */ 2187c478bd9Sstevel@tonic-gate ulong_t fm_hwptr; /* hardware capabilities pointer */ 2197c478bd9Sstevel@tonic-gate } Fmap; 2207c478bd9Sstevel@tonic-gate 221a953e2b1Srie #define FMAP_SIZE 0x8000 /* initial size to map from a file */ 222a953e2b1Srie /* big enough to capture standard */ 223a953e2b1Srie /* filters */ 2247c478bd9Sstevel@tonic-gate /* 2257c478bd9Sstevel@tonic-gate * Define a file descriptor, which maintains information regarding a pathname 2267c478bd9Sstevel@tonic-gate * that has been opened and minimally inspected. 2277c478bd9Sstevel@tonic-gate */ 2287c478bd9Sstevel@tonic-gate typedef struct { 2297c478bd9Sstevel@tonic-gate Rt_map *fd_lmp; /* existing link-map pointer */ 2307c478bd9Sstevel@tonic-gate Fct *fd_ftp; /* file functions pointer */ 2317c478bd9Sstevel@tonic-gate const char *fd_oname; /* original file name */ 2327c478bd9Sstevel@tonic-gate const char *fd_odir; /* original directory name */ 2337c478bd9Sstevel@tonic-gate const char *fd_nname; /* new file (expanded) name */ 2347c478bd9Sstevel@tonic-gate const char *fd_pname; /* new path (resolved) name */ 2357c478bd9Sstevel@tonic-gate dev_t fd_dev; /* file device number */ 2367c478bd9Sstevel@tonic-gate ino_t fd_ino; /* file inode number */ 2377c478bd9Sstevel@tonic-gate int fd_fd; /* open file descriptor */ 2387c478bd9Sstevel@tonic-gate uint_t fd_flags; 2397c478bd9Sstevel@tonic-gate avl_index_t fd_avlwhere; /* avl tree insertion index */ 2407c478bd9Sstevel@tonic-gate Fmap fd_fmap; /* file mapping information */ 2417c478bd9Sstevel@tonic-gate } Fdesc; 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate #define FLG_FD_ALTER 0x01 /* file is an alternate */ 2447c478bd9Sstevel@tonic-gate #define FLG_FD_SLASH 0x02 /* file contains a "/" */ 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate /* 2477c478bd9Sstevel@tonic-gate * File descriptor availability flag. 2487c478bd9Sstevel@tonic-gate */ 2497c478bd9Sstevel@tonic-gate #define FD_UNAVAIL -1 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate /* 2527c478bd9Sstevel@tonic-gate * Disabled filter flag. Filter objects are referenced using their .dynamic 2537c478bd9Sstevel@tonic-gate * index (DT_FILTER or DT_AUXILIARY). This index is saved and used to lookup 2547c478bd9Sstevel@tonic-gate * the required filter. Note that 0 is a valid .dynamic index. The caller's 2557c478bd9Sstevel@tonic-gate * OBJFLTRNDX() element is initialized using the following flag, and should 2567c478bd9Sstevel@tonic-gate * the filter's initialization fail, is reset to this value to indicate the 2577c478bd9Sstevel@tonic-gate * filter is disabled. UINT_MAX provides a convenient invalid .dynamic index. 2587c478bd9Sstevel@tonic-gate */ 2597c478bd9Sstevel@tonic-gate #define FLTR_DISABLED UINT_MAX 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate /* 2627c478bd9Sstevel@tonic-gate * Status flags for rtld_flags 2637c478bd9Sstevel@tonic-gate */ 2647c478bd9Sstevel@tonic-gate #define RT_FL_THREADS 0x00000001 /* threads are enabled */ 2657c478bd9Sstevel@tonic-gate #define RT_FL_WARNFLTR 0x00000002 /* warn of missing filtees (ldd) */ 2667c478bd9Sstevel@tonic-gate #define RT_FL_DBNOTIF 0x00000004 /* binding activity going on */ 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate #ifdef SIEBEL_DISABLE 2697c478bd9Sstevel@tonic-gate #define RT_FL_DISFIX_1 0x00000008 /* disable fix number 1 */ 2707c478bd9Sstevel@tonic-gate #endif 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate #define RT_FL_NOBIND 0x00000010 /* don't carry out plt binding */ 2737c478bd9Sstevel@tonic-gate #define RT_FL_NOVERSION 0x00000020 /* disable version checking */ 2747c478bd9Sstevel@tonic-gate #define RT_FL_SECURE 0x00000040 /* setuid/segid flag */ 2757c478bd9Sstevel@tonic-gate #define RT_FL_APPLIC 0x00000080 /* are we executing user code */ 2767c478bd9Sstevel@tonic-gate #define RT_FL_CONCUR 0x00000100 /* thread concurrency checks required */ 2777c478bd9Sstevel@tonic-gate #define RT_FL_CONFGEN 0x00000200 /* don't relocate initiating object */ 2787c478bd9Sstevel@tonic-gate /* set by crle(1). */ 2797c478bd9Sstevel@tonic-gate #define RT_FL_CONFAPP 0x00000400 /* application specific configuration */ 2807c478bd9Sstevel@tonic-gate /* cache required */ 2817c478bd9Sstevel@tonic-gate #define RT_FL_DEBUGGER 0x00000800 /* a debugger is monitoring us */ 2829aa23310Srie #define RT_FL_OPERATION 0x00001000 /* start recording operations */ 2837c478bd9Sstevel@tonic-gate #define RT_FL_NEWLOCALE 0x00002000 /* message locale has changed */ 2847c478bd9Sstevel@tonic-gate #define RT_FL_NOBAPLT 0x00004000 /* sparc: don't use ba plt's */ 2857c478bd9Sstevel@tonic-gate #define RT_FL_NOAUXFLTR 0x00008000 /* disable auxiliary filters */ 2867c478bd9Sstevel@tonic-gate #define RT_FL_NOCONCUR 0x00010000 /* disable thread concurrency checks */ 2877c478bd9Sstevel@tonic-gate #define RT_FL_NOAUDIT 0x00020000 /* disable auditing */ 2887c478bd9Sstevel@tonic-gate #define RT_FL_ATEXIT 0x00040000 /* we're shutting down */ 2897c478bd9Sstevel@tonic-gate #define RT_FL_SILENCERR 0x00080000 /* silence error messages */ 2907c478bd9Sstevel@tonic-gate #define RT_FL_BREADTH 0x00100000 /* use breadth-first for .init/.fini */ 2917c478bd9Sstevel@tonic-gate #define RT_FL_INITFIRST 0x00200000 /* processing a DT_INITFIRST object */ 2927c478bd9Sstevel@tonic-gate #define RT_FL_RELATIVE 0x00400000 /* relative path expansion required */ 2937c478bd9Sstevel@tonic-gate #define RT_FL_EXECNAME 0x00800000 /* AT_SUN_EXECNAME vector is avail */ 2947c478bd9Sstevel@tonic-gate #define RT_FL_DEMANGLE 0x01000000 /* demangle C++ symbol names */ 2957c478bd9Sstevel@tonic-gate #define RT_FL_NOCFG 0x02000000 /* disable config file use */ 2967c478bd9Sstevel@tonic-gate #define RT_FL_NODIRCFG 0x04000000 /* disable directory config use */ 2977c478bd9Sstevel@tonic-gate #define RT_FL_NOOBJALT 0x08000000 /* disable object alternative use */ 2987c478bd9Sstevel@tonic-gate #define RT_FL_NOENVCFG 0x10000000 /* disable config envars use */ 2997c478bd9Sstevel@tonic-gate #define RT_FL_DIRCFG 0x20000000 /* directory config info available */ 3007c478bd9Sstevel@tonic-gate #define RT_FL_OBJALT 0x40000000 /* object alternatives are available */ 3017c478bd9Sstevel@tonic-gate #define RT_FL_MEMRESV 0x80000000 /* memory reservation established */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* 3047c478bd9Sstevel@tonic-gate * Status flags for rtld_flags2 3057c478bd9Sstevel@tonic-gate */ 3065aefb655Srie #define RT_FL2_HASAUDIT 0x00000001 /* auditing lm_list is present */ 3077c478bd9Sstevel@tonic-gate #define RT_FL2_RTLDSEEN 0x00000002 /* rtldinfo has been set */ 3085aefb655Srie #define RT_FL2_UNIFPROC 0x00000004 /* libc/libthread unified environment */ 3097c478bd9Sstevel@tonic-gate #define RT_FL2_NOMALIGN 0x00000008 /* mmap MAP_ALIGN isn't available */ 3107c478bd9Sstevel@tonic-gate #define RT_FL2_NOFLTCFG 0x00000010 /* disable config filter use */ 3117c478bd9Sstevel@tonic-gate #define RT_FL2_FLTCFG 0x00000020 /* filter config info available */ 3127c478bd9Sstevel@tonic-gate #define RT_FL2_HWCAP 0x00000040 /* hardware capabilities available */ 3137c478bd9Sstevel@tonic-gate #define RT_FL2_FTL2WARN 0x00000080 /* convert fatal to warning messages */ 3147c478bd9Sstevel@tonic-gate #define RT_FL2_BINDNOW 0x00000100 /* LD_BIND_NOW in effect */ 315dffec89cSrie #define RT_FL2_BINDLAZY 0x00000200 /* disable RTLD_NOW (and LD_BIND_NOW) */ 31610a4fa49Srie #define RT_FL2_PLMSETUP 0x00000400 /* primary link-map set up complete */ 3179aa23310Srie #define RT_FL2_BRANDED 0x00000800 /* process is branded */ 3189aa23310Srie #define RT_FL2_NOPLM 0x00001000 /* process has no primary link map */ 3193dbfc803SRod Evans #define RT_FL2_SETUID 0x00002000 /* ld.so.1 is setuid root */ 320bebb829dSRod Evans #define RT_FL2_ADDR32 0x00004000 /* 32-bit address space requirement */ 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate /* 3237c478bd9Sstevel@tonic-gate * Information flags for env_info. 3247c478bd9Sstevel@tonic-gate */ 3257c478bd9Sstevel@tonic-gate #define ENV_INF_PATHCFG 0x00000001 /* replaceable LD_LIBRARY_PATH */ 3267c478bd9Sstevel@tonic-gate /* originates from configuration */ 3277c478bd9Sstevel@tonic-gate /* file */ 3287c478bd9Sstevel@tonic-gate #define ENV_INF_FLAGCFG 0x00000002 /* replaceable LD_FLAGS originates */ 3297c478bd9Sstevel@tonic-gate /* from configuration file */ 3307c478bd9Sstevel@tonic-gate 3317c478bd9Sstevel@tonic-gate /* 33210a4fa49Srie * RTLDINFO descriptor. 33310a4fa49Srie */ 33410a4fa49Srie typedef struct { 33510a4fa49Srie Rt_map *rti_lmp; /* RTLDINFO provider */ 33610a4fa49Srie Lc_interface *rti_info; /* RTLDINFO data */ 33710a4fa49Srie } Rti_desc; 33810a4fa49Srie 33910a4fa49Srie /* 34010a4fa49Srie * Binding flags for the bindguard routines. 3418cd45542Sraf * These are defined in usr/src/lib/libc/inc/libc_int.h in the 3428cd45542Sraf * latest version of the libc/rtld runtime interface (CI_V_FIVE). 3437c478bd9Sstevel@tonic-gate */ 3448cd45542Sraf #if !defined(CI_V_FIVE) 3457c478bd9Sstevel@tonic-gate #define THR_FLG_RTLD 0x00000001 /* rtldlock bind_guard() flag */ 3468cd45542Sraf #define THR_FLG_NOLOCK 0x00000000 /* no-op before CI_V_FIVE */ 3478cd45542Sraf #define THR_FLG_REENTER 0x00000000 /* no-op before CI_V_FIVE */ 3488cd45542Sraf #endif 3497c478bd9Sstevel@tonic-gate 3509aa23310Srie #define ROUND(x, a) (((int)(x) + ((int)(a) - 1)) & ~((int)(a) - 1)) 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate /* 3537c478bd9Sstevel@tonic-gate * Print buffer. 3547c478bd9Sstevel@tonic-gate */ 3557c478bd9Sstevel@tonic-gate typedef struct { 3567c478bd9Sstevel@tonic-gate char *pr_buf; /* pointer to beginning of buffer */ 3577c478bd9Sstevel@tonic-gate char *pr_cur; /* pointer to next free char in buffer */ 3587c478bd9Sstevel@tonic-gate size_t pr_len; /* buffer size */ 3597c478bd9Sstevel@tonic-gate int pr_fd; /* output fd */ 3607c478bd9Sstevel@tonic-gate } Prfbuf; 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate /* 3637c478bd9Sstevel@tonic-gate * dlopen() handle list size. 3647c478bd9Sstevel@tonic-gate */ 3657c478bd9Sstevel@tonic-gate #define HDLIST_SZ 101 /* prime no. for hashing */ 3667c478bd9Sstevel@tonic-gate #define HDLIST_ORP 102 /* orphan handle list */ 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate /* 3697c478bd9Sstevel@tonic-gate * Define expansion path information. Search paths, i.e., LD_LIBRARY_PATH, 3707c478bd9Sstevel@tonic-gate * RPATHS, etc. are defined using la_objsearch() information (see LA_SER flags 3717c478bd9Sstevel@tonic-gate * in link.h). Definitions here extend the path information to other uses of 3727c478bd9Sstevel@tonic-gate * pathname expansion, and are or'd together with any LA_SER_* flags. 3737c478bd9Sstevel@tonic-gate */ 3749aa23310Srie #define PN_FLG_EXTLOAD 0x00001000 /* path defines extra loaded objects */ 3757c478bd9Sstevel@tonic-gate /* (preload, audit etc.) */ 3769aa23310Srie #define PN_FLG_UNIQUE 0x00002000 /* ensure path is unique */ 3779aa23310Srie #define PN_FLG_USED 0x00004000 /* indicate that path is used */ 3789aa23310Srie #define PN_FLG_DUPLICAT 0x00008000 /* path is a duplicate */ 379*247b82a1SRod Evans #define PN_FLG_FULLPATH 0x00010000 /* ensure path is a full path */ 3807c478bd9Sstevel@tonic-gate 3819aa23310Srie #define PN_FLG_MASK 0x000ff000 /* mask for p_orig incorporation */ 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate /* 3847c478bd9Sstevel@tonic-gate * Define reserved path tokens. These are used to prevent various expansions 3857c478bd9Sstevel@tonic-gate * from occurring, and record those expansions that do. Note that any expansion 3867c478bd9Sstevel@tonic-gate * information is also recorded in the p_orig field of a Pnode, and thus is 3879aa23310Srie * or'd together with any LA_SER, and PN_FLG flags. 3887c478bd9Sstevel@tonic-gate */ 3897c478bd9Sstevel@tonic-gate #define PN_TKN_ORIGIN 0x00100000 /* $ORIGIN expansion has occurred */ 3907c478bd9Sstevel@tonic-gate #define PN_TKN_PLATFORM 0x00200000 /* $PLATFORM expansion has occurred */ 3917c478bd9Sstevel@tonic-gate #define PN_TKN_OSNAME 0x00400000 /* $OSNAME expansion has occurred */ 3927c478bd9Sstevel@tonic-gate #define PN_TKN_OSREL 0x00800000 /* $OSREL expansion has occurred */ 3937c478bd9Sstevel@tonic-gate #define PN_TKN_ISALIST 0x01000000 /* $ISALIST expansion has occurred */ 3947c478bd9Sstevel@tonic-gate #define PN_TKN_HWCAP 0x02000000 /* $HWCAP expansion has occurred */ 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate #define PN_TKN_MASK 0xfff00000 /* mask for p_orig incorporation */ 3977c478bd9Sstevel@tonic-gate 3989aa23310Srie /* 3999aa23310Srie * Additional token expansion information. Although these flags may be set 4009aa23310Srie * within a token data item they are masked off with PN_TKN_MASK prior to any 4019aa23310Srie * expansion information being recorded in a Pnode for later diagnostics. 4029aa23310Srie */ 4037c478bd9Sstevel@tonic-gate #define TKN_NONE 0x00000001 /* no token expansion has occurred */ 4047c478bd9Sstevel@tonic-gate #define TKN_DOTSLASH 0x00000002 /* path contains a "./" */ 4057c478bd9Sstevel@tonic-gate 4067c478bd9Sstevel@tonic-gate /* 4077c478bd9Sstevel@tonic-gate * Define _caller flags. 4087c478bd9Sstevel@tonic-gate */ 4097c478bd9Sstevel@tonic-gate #define CL_NONE 0 4107c478bd9Sstevel@tonic-gate #define CL_EXECDEF 1 /* supply the executable as a default */ 4117c478bd9Sstevel@tonic-gate /* if the caller can't be determined */ 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate /* 4147c478bd9Sstevel@tonic-gate * Binding information. Note, this is or'ed in with the DBG_BINFO flags to 4157c478bd9Sstevel@tonic-gate * convey information regarding symbol bindings. 4167c478bd9Sstevel@tonic-gate */ 41760758829Srie #define BINFO_REJDIRECT 0x10000 /* reject a direct binding */ 41860758829Srie #define BINFO_REJSINGLE 0x20000 /* reject a singleton binding */ 41960758829Srie #define BINFO_REJECTED 0xf0000 /* a binding has been rejected */ 4207c478bd9Sstevel@tonic-gate 4217c478bd9Sstevel@tonic-gate /* 4227c478bd9Sstevel@tonic-gate * Data declarations. 4237c478bd9Sstevel@tonic-gate */ 42410a4fa49Srie extern Lc_desc glcs[]; /* global external interfaces */ 42510a4fa49Srie 4268cd45542Sraf extern Rt_lock rtldlock; /* rtld lock */ 4278cd45542Sraf extern int thr_flg_nolock; 4288cd45542Sraf extern int thr_flg_reenter; 4297c478bd9Sstevel@tonic-gate 4307c478bd9Sstevel@tonic-gate extern List dynlm_list; /* dynamic list of link-maps */ 4317c478bd9Sstevel@tonic-gate extern char **environ; /* environ pointer */ 4327c478bd9Sstevel@tonic-gate 4337c478bd9Sstevel@tonic-gate extern int dyn_plt_ent_size; /* Size of dynamic plt's */ 4347c478bd9Sstevel@tonic-gate extern ulong_t at_flags; /* machine specific file flags */ 43541072f3cSrie extern const char *procname; /* file name of executing process */ 4367c478bd9Sstevel@tonic-gate extern Rtld_db_priv r_debug; /* debugging information */ 4377c478bd9Sstevel@tonic-gate extern char *lasterr; /* string describing last error */ 4387c478bd9Sstevel@tonic-gate extern Interp *interp; /* ELF executable interpreter info */ 43941072f3cSrie extern const char *rtldname; /* name of the dynamic linker */ 4407c478bd9Sstevel@tonic-gate extern List hdl_list[]; /* dlopen() handle list */ 4417c478bd9Sstevel@tonic-gate extern size_t syspagsz; /* system page size */ 4427c478bd9Sstevel@tonic-gate extern char *platform; /* platform name */ 4437c478bd9Sstevel@tonic-gate extern size_t platform_sz; /* platform name string size */ 4447c478bd9Sstevel@tonic-gate extern Isa_desc *isa; /* isalist descriptor */ 4457c478bd9Sstevel@tonic-gate extern Uts_desc *uts; /* utsname descriptor */ 4467c478bd9Sstevel@tonic-gate extern uint_t rtld_flags; /* status flags for RTLD */ 4477c478bd9Sstevel@tonic-gate extern uint_t rtld_flags2; /* additional status flags for RTLD */ 4487c478bd9Sstevel@tonic-gate extern Fmap *fmap; /* Initial file mapping info */ 4497c478bd9Sstevel@tonic-gate extern uint32_t pltcnt21d; /* cnt of 21d PLTs */ 4507c478bd9Sstevel@tonic-gate extern uint32_t pltcnt24d; /* cnt of 24d PLTs */ 4517c478bd9Sstevel@tonic-gate extern uint32_t pltcntu32; /* cnt of u32 PLTs */ 4527c478bd9Sstevel@tonic-gate extern uint32_t pltcntu44; /* cnt of u44 PLTs */ 4537c478bd9Sstevel@tonic-gate extern uint32_t pltcntfull; /* cnt of full PLTs */ 4547c478bd9Sstevel@tonic-gate extern uint32_t pltcntfar; /* cnt of far PLTs */ 4557c478bd9Sstevel@tonic-gate extern uchar_t search_rules[]; /* dependency search rules */ 4567c478bd9Sstevel@tonic-gate 4577c478bd9Sstevel@tonic-gate extern Fct elf_fct; /* ELF file class dependent data */ 4587c478bd9Sstevel@tonic-gate 45902ca3e02Srie #if defined(__sparc) && !defined(__sparcv9) 4607c478bd9Sstevel@tonic-gate extern Fct aout_fct; /* a.out (4.x) file class dependent */ 4617c478bd9Sstevel@tonic-gate /* data */ 4627c478bd9Sstevel@tonic-gate #endif 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate extern const char *locale; /* locale environment setting */ 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate extern Config *config; /* configuration structure */ 4677c478bd9Sstevel@tonic-gate extern const char *locale; /* locale environment setting */ 4687c478bd9Sstevel@tonic-gate 4697c478bd9Sstevel@tonic-gate extern const char *rpl_audit; /* replaceable LD_AUDIT string */ 4707c478bd9Sstevel@tonic-gate extern const char *rpl_debug; /* replaceable LD_DEBUG string */ 4717c478bd9Sstevel@tonic-gate extern const char *rpl_ldflags; /* replaceable LD_FLAGS string */ 4727c478bd9Sstevel@tonic-gate extern const char *rpl_libpath; /* replaceable LD_LIBRARY string */ 4737c478bd9Sstevel@tonic-gate extern Pnode *rpl_libdirs; /* and its associated Pnode list */ 4747c478bd9Sstevel@tonic-gate extern const char *rpl_preload; /* replaceable LD_PRELOAD string */ 4757c478bd9Sstevel@tonic-gate 4767c478bd9Sstevel@tonic-gate extern const char *prm_audit; /* permanent LD_AUDIT string */ 4777c478bd9Sstevel@tonic-gate extern const char *prm_debug; /* permanent LD_DEBUG string */ 4787c478bd9Sstevel@tonic-gate extern const char *prm_ldflags; /* permanent LD_FLAGS string */ 4797c478bd9Sstevel@tonic-gate extern const char *prm_libpath; /* permanent LD_LIBRARY string */ 4807c478bd9Sstevel@tonic-gate extern Pnode *prm_libdirs; /* and its associated Pnode list */ 4817c478bd9Sstevel@tonic-gate extern const char *prm_preload; /* permanent LD_PRELOAD string */ 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate extern uint_t env_info; /* information regarding environment */ 4847c478bd9Sstevel@tonic-gate /* variables */ 4857c478bd9Sstevel@tonic-gate extern int killsig; /* signal sent on fatal exit */ 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gate extern uint_t audit_argcnt; /* no. of stack args to copy */ 4887c478bd9Sstevel@tonic-gate extern Audit_desc *auditors; /* global auditors */ 4897c478bd9Sstevel@tonic-gate 4907c478bd9Sstevel@tonic-gate extern char **_environ; 4917c478bd9Sstevel@tonic-gate 4927c478bd9Sstevel@tonic-gate extern const char *dbg_file; /* debugging directed to a file */ 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate extern Reglist *reglist; /* list of register symbols */ 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate extern const Msg err_reject[]; /* rejection error message tables */ 4977c478bd9Sstevel@tonic-gate extern const Msg ldd_reject[]; 4987c478bd9Sstevel@tonic-gate 4997c478bd9Sstevel@tonic-gate extern const char *profile_name; /* object being profiled */ 5007c478bd9Sstevel@tonic-gate extern const char *profile_out; /* profile output file */ 5017c478bd9Sstevel@tonic-gate extern const char *profile_lib; /* audit library to perform profile */ 5027c478bd9Sstevel@tonic-gate 50341072f3cSrie extern Dl_argsinfo argsinfo; /* process argument, environment and */ 50441072f3cSrie /* auxv information */ 50541072f3cSrie 5067c478bd9Sstevel@tonic-gate extern const char *err_strs[]; /* diagnostic error string headers */ 5077c478bd9Sstevel@tonic-gate extern const char *nosym_str; /* MSG_GEN_NOSYM message cache */ 5087c478bd9Sstevel@tonic-gate 5097c478bd9Sstevel@tonic-gate extern ulong_t hwcap; /* hardware capabilities */ 5107c478bd9Sstevel@tonic-gate extern ulong_t sfcap; /* software capabilities */ 5117c478bd9Sstevel@tonic-gate 5129aa23310Srie extern avl_tree_t *nfavl; /* not-found AVL path name tree */ 5139aa23310Srie 5147c478bd9Sstevel@tonic-gate /* 5157c478bd9Sstevel@tonic-gate * Function declarations. 5167c478bd9Sstevel@tonic-gate */ 5177c478bd9Sstevel@tonic-gate extern void addfree(void *, size_t); 5187c478bd9Sstevel@tonic-gate extern int append_alias(Rt_map *, const char *, int *); 5199aa23310Srie extern int analyze_lmc(Lm_list *, Aliste, Rt_map *, int *); 5205aefb655Srie extern Am_ret anon_map(Lm_list *, caddr_t *, size_t, int, int); 5217c478bd9Sstevel@tonic-gate extern Fct *are_u_this(Rej_desc *, int, struct stat *, 5227c478bd9Sstevel@tonic-gate const char *); 5237c478bd9Sstevel@tonic-gate extern void atexit_fini(void); 5247c478bd9Sstevel@tonic-gate extern int bind_one(Rt_map *, Rt_map *, uint_t); 5257c478bd9Sstevel@tonic-gate extern int bufprint(Prfbuf *, const char *, ...); 5265aefb655Srie extern void call_array(Addr *, uint_t, Rt_map *, Word); 5277c478bd9Sstevel@tonic-gate extern void call_fini(Lm_list *, Rt_map **); 5287c478bd9Sstevel@tonic-gate extern void call_init(Rt_map **, int); 52960758829Srie extern int callable(Rt_map *, Rt_map *, Grp_hdl *, uint_t); 5307c478bd9Sstevel@tonic-gate extern Rt_map *_caller(caddr_t, int); 5317c478bd9Sstevel@tonic-gate extern caddr_t caller(void); 5327c478bd9Sstevel@tonic-gate extern void *calloc(size_t, size_t); 5337c478bd9Sstevel@tonic-gate extern void cap_assign(Cap *, Rt_map *); 534bebb829dSRod Evans extern int cap_check(Rej_desc *, Ehdr *); 5355aefb655Srie extern const char *_conv_reloc_type(uint_t rel); 5365aefb655Srie extern uintptr_t dbg_setup(const char *, Dbg_desc *); 5377c478bd9Sstevel@tonic-gate extern const char *demangle(const char *); 5387c478bd9Sstevel@tonic-gate extern int dlclose_intn(Grp_hdl *, Rt_map *); 53902ca3e02Srie extern int dlclose_core(Grp_hdl *, Rt_map *, Lm_list *); 5407c478bd9Sstevel@tonic-gate extern Sym *dlsym_handle(Grp_hdl *, Slookup *, Rt_map **, 5419aa23310Srie uint_t *, int *); 5427c478bd9Sstevel@tonic-gate extern void *dlsym_intn(void *, const char *, Rt_map *, Rt_map **); 5437c478bd9Sstevel@tonic-gate extern Grp_hdl *dlmopen_intn(Lm_list *, const char *, int, Rt_map *, 5449aa23310Srie uint_t, uint_t); 5457c478bd9Sstevel@tonic-gate extern size_t doprf(const char *, va_list, Prfbuf *); 5467c478bd9Sstevel@tonic-gate extern int dowrite(Prfbuf *); 5477c478bd9Sstevel@tonic-gate extern void dz_init(int); 5485aefb655Srie extern caddr_t dz_map(Lm_list *, caddr_t, size_t, int, int); 5497c478bd9Sstevel@tonic-gate extern int elf_config(Rt_map *, int); 5507c478bd9Sstevel@tonic-gate extern int elf_mach_flags_check(Rej_desc *, Ehdr *); 5517c478bd9Sstevel@tonic-gate extern Rtc_obj *elf_config_ent(const char *, Word, int, const char **); 5525aefb655Srie extern Pnode *elf_config_flt(Lm_list *, const char *, const char *); 5537c478bd9Sstevel@tonic-gate extern ulong_t elf_hash(const char *); 5547c478bd9Sstevel@tonic-gate extern void elf_reloc_bad(Rt_map *, void *, uchar_t, ulong_t, 5557c478bd9Sstevel@tonic-gate ulong_t); 5567c478bd9Sstevel@tonic-gate extern ulong_t elf_reloc_relative(ulong_t, ulong_t, ulong_t, 5577c478bd9Sstevel@tonic-gate ulong_t, ulong_t, ulong_t); 5587c478bd9Sstevel@tonic-gate extern ulong_t elf_reloc_relacount(ulong_t, ulong_t, 5597c478bd9Sstevel@tonic-gate ulong_t, ulong_t); 56002ca3e02Srie extern long elf_static_tls(Rt_map *, Sym *, void *, uchar_t, char *, 561d326b23bSrie ulong_t, long); 5628cd45542Sraf extern int enter(int); 5637c478bd9Sstevel@tonic-gate extern uint_t expand(char **, size_t *, char **, uint_t, uint_t, 5647c478bd9Sstevel@tonic-gate Rt_map *); 5657c478bd9Sstevel@tonic-gate extern Pnode *expand_paths(Rt_map *, const char *, uint_t, uint_t); 5668af2c5b9Srie extern void free_hdl(Grp_hdl *, Rt_map *, uint_t); 5677c478bd9Sstevel@tonic-gate extern void file_notfound(Lm_list *, const char *, Rt_map *, 5687c478bd9Sstevel@tonic-gate uint_t, Rej_desc *); 5697c478bd9Sstevel@tonic-gate extern int find_path(Lm_list *, const char *, Rt_map *, uint_t, 5709aa23310Srie Fdesc *, Rej_desc *, int *); 5717c478bd9Sstevel@tonic-gate extern int fpavl_insert(Lm_list *, Rt_map *, const char *, 5727c478bd9Sstevel@tonic-gate avl_index_t); 5739aa23310Srie extern Rt_map *fpavl_recorded(Lm_list *, const char *, avl_index_t *); 5747c478bd9Sstevel@tonic-gate extern void fpavl_remove(Rt_map *); 5757c478bd9Sstevel@tonic-gate extern size_t fullpath(Rt_map *, const char *); 5767c478bd9Sstevel@tonic-gate extern void fmap_setup(); 5777c478bd9Sstevel@tonic-gate extern void get_lcinterface(Rt_map *, Lc_interface *); 5787c478bd9Sstevel@tonic-gate extern Lmid_t get_linkmap_id(Lm_list *); 5797c478bd9Sstevel@tonic-gate extern Pnode *get_next_dir(Pnode **, Rt_map *, uint_t); 5809a411307Srie extern int hdl_add(Grp_hdl *, Rt_map *, uint_t); 5818af2c5b9Srie extern Grp_hdl *hdl_create(Lm_list *, Rt_map *, Rt_map *, uint_t, 5828af2c5b9Srie uint_t, uint_t); 58302ca3e02Srie extern int hdl_initialize(Grp_hdl *, Rt_map *, int, int); 58402ca3e02Srie extern Pnode *hwcap_filtees(Pnode **, Aliste, Lm_cntl *, Dyninfo *, 5859aa23310Srie Rt_map *, const char *, int, uint_t, int *); 5869a411307Srie extern void is_dep_ready(Rt_map *, Rt_map *, int); 5879a411307Srie extern void is_dep_init(Rt_map *, Rt_map *); 588466e2a62Srie extern int is_move_data(caddr_t); 589*247b82a1SRod Evans extern int is_path_secure(char *, Rt_map *, uint_t, uint_t); 5903dbfc803SRod Evans extern int is_rtld_setuid(); 5919a411307Srie extern int is_sym_interposer(Rt_map *, Sym *); 5929a411307Srie extern void ldso_plt_init(Rt_map *); 5937c478bd9Sstevel@tonic-gate extern Listnode *list_append(List *, const void *); 5947c478bd9Sstevel@tonic-gate extern Listnode *list_insert(List *, const void *, Listnode *); 5957c478bd9Sstevel@tonic-gate extern Listnode *list_prepend(List *, const void *); 5967c478bd9Sstevel@tonic-gate extern void list_delete(List *, void *); 5978cd45542Sraf extern void leave(Lm_list *, int); 5987c478bd9Sstevel@tonic-gate extern void lm_append(Lm_list *, Aliste, Rt_map *); 5997c478bd9Sstevel@tonic-gate extern void lm_delete(Lm_list *, Rt_map *); 6007c478bd9Sstevel@tonic-gate extern void lm_move(Lm_list *, Aliste, Aliste, Lm_cntl *, 6017c478bd9Sstevel@tonic-gate Lm_cntl *); 6027247f888Srie extern void load_completion(Rt_map *); 6037c478bd9Sstevel@tonic-gate extern Rt_map *load_hwcap(Lm_list *, Aliste, const char *, Rt_map *, 6049aa23310Srie uint_t, uint_t, Grp_hdl **, Rej_desc *, int *); 6057247f888Srie extern Rt_map *load_path(Lm_list *, Aliste, const char **, Rt_map *, 6069aa23310Srie int, uint_t, Grp_hdl **, Fdesc *, Rej_desc *, 6079aa23310Srie int *); 6087c478bd9Sstevel@tonic-gate extern Rt_map *load_one(Lm_list *, Aliste, Pnode *, Rt_map *, int, 6099aa23310Srie uint_t, Grp_hdl **, int *); 6107247f888Srie extern int load_trace(Lm_list *, const char **, Rt_map *); 6119aa23310Srie extern void nfavl_insert(const char *, avl_index_t); 6129aa23310Srie extern int nfavl_recorded(const char *, avl_index_t *); 6135aefb655Srie extern caddr_t nu_map(Lm_list *, caddr_t, size_t, int, int); 6147c478bd9Sstevel@tonic-gate extern void *malloc(size_t); 615466e2a62Srie extern int move_data(Rt_map *); 6165aefb655Srie extern int pr_open(Lm_list *); 6177c478bd9Sstevel@tonic-gate extern void rd_event(Lm_list *, rd_event_e, r_state_e); 6187c478bd9Sstevel@tonic-gate extern int readenv_user(const char **, Word *, Word *, int); 6197c478bd9Sstevel@tonic-gate extern int readenv_config(Rtc_env *, Addr, int); 62031fdd7caSab extern void rejection_inherit(Rej_desc *, Rej_desc *); 6219aa23310Srie extern int relocate_lmc(Lm_list *, Aliste, Rt_map *, Rt_map *, 6229aa23310Srie int *); 623cce0e03bSab extern int relocate_finish(Rt_map *, APlist *, int, int); 6247c478bd9Sstevel@tonic-gate extern void remove_cntl(Lm_list *, Aliste); 6257c478bd9Sstevel@tonic-gate extern int remove_hdl(Grp_hdl *, Rt_map *, int *); 62602ca3e02Srie extern void remove_lmc(Lm_list *, Rt_map *, Lm_cntl *, Aliste, 62702ca3e02Srie const char *); 6287c478bd9Sstevel@tonic-gate extern void remove_incomplete(Lm_list *, Aliste); 6297c478bd9Sstevel@tonic-gate extern void remove_lists(Rt_map *, int); 6307c478bd9Sstevel@tonic-gate extern void remove_lml(Lm_list *); 6317c478bd9Sstevel@tonic-gate extern void remove_pnode(Pnode *); 6327c478bd9Sstevel@tonic-gate extern void remove_rej(Rej_desc *); 6337c478bd9Sstevel@tonic-gate extern void remove_so(Lm_list *, Rt_map *); 6347c478bd9Sstevel@tonic-gate extern int rt_cond_broadcast(Rt_cond *); 6357c478bd9Sstevel@tonic-gate extern Rt_cond *rt_cond_create(void); 6367c478bd9Sstevel@tonic-gate extern int rt_cond_wait(Rt_cond *, Rt_lock *); 6377c478bd9Sstevel@tonic-gate extern int rt_bind_guard(int); 6387c478bd9Sstevel@tonic-gate extern int rt_bind_clear(int); 63910a4fa49Srie extern int rt_get_extern(Lm_list *, Rt_map *); 6407c478bd9Sstevel@tonic-gate extern int rt_mutex_lock(Rt_lock *); 6417c478bd9Sstevel@tonic-gate extern int rt_mutex_unlock(Rt_lock *); 64210a4fa49Srie extern void rt_thr_init(Lm_list *); 6437c478bd9Sstevel@tonic-gate extern thread_t rt_thr_self(void); 6445aefb655Srie extern void rtld_db_dlactivity(Lm_list *); 6455aefb655Srie extern void rtld_db_preinit(Lm_list *); 6465aefb655Srie extern void rtld_db_postinit(Lm_list *); 6477c478bd9Sstevel@tonic-gate extern void rtldexit(Lm_list *, int); 64841072f3cSrie extern int rtld_getopt(char **, char ***, auxv_t **, Word *, 64941072f3cSrie Word *, int); 6507c478bd9Sstevel@tonic-gate extern void security(uid_t, uid_t, gid_t, gid_t, int); 6517c478bd9Sstevel@tonic-gate extern void set_environ(Lm_list *); 65241072f3cSrie extern Rt_map *setup(char **, auxv_t *, Word, char *, int, char *, 6537c478bd9Sstevel@tonic-gate Dyn *, ulong_t, ulong_t, int fd, Phdr *, char *, 6547c478bd9Sstevel@tonic-gate char **, int, uid_t, uid_t, gid_t, gid_t, void *, 6557c478bd9Sstevel@tonic-gate int, uint_t); 6563dbfc803SRod Evans extern void spavl_insert(const char *); 6573dbfc803SRod Evans extern int spavl_recorded(const char *, avl_index_t *); 658d326b23bSrie extern int tls_assign(Lm_list *, Rt_map *, Phdr *); 65910a4fa49Srie extern void tls_modaddrem(Rt_map *, uint_t); 66010a4fa49Srie extern int tls_statmod(Lm_list *, Rt_map *); 6617c478bd9Sstevel@tonic-gate extern Rt_map **tsort(Rt_map *, int, int); 6627c478bd9Sstevel@tonic-gate extern void unused(Lm_list *); 6637c478bd9Sstevel@tonic-gate extern int update_mode(Rt_map *, int, int); 6647c478bd9Sstevel@tonic-gate extern void zero(caddr_t, size_t); 6657c478bd9Sstevel@tonic-gate 66602ca3e02Srie #if defined(__sparc) 6677c478bd9Sstevel@tonic-gate /* 6687c478bd9Sstevel@tonic-gate * SPARC Register symbol support. 6697c478bd9Sstevel@tonic-gate */ 6707c478bd9Sstevel@tonic-gate extern int elf_regsyms(Rt_map *); 6717c478bd9Sstevel@tonic-gate extern void set_sparc_g1(ulong_t); 6727c478bd9Sstevel@tonic-gate extern void set_sparc_g2(ulong_t); 6737c478bd9Sstevel@tonic-gate extern void set_sparc_g3(ulong_t); 6747c478bd9Sstevel@tonic-gate extern void set_sparc_g4(ulong_t); 6757c478bd9Sstevel@tonic-gate extern void set_sparc_g5(ulong_t); 6767c478bd9Sstevel@tonic-gate extern void set_sparc_g6(ulong_t); 6777c478bd9Sstevel@tonic-gate extern void set_sparc_g7(ulong_t); 67802ca3e02Srie #endif 6797c478bd9Sstevel@tonic-gate 6807c478bd9Sstevel@tonic-gate extern long _sysconfig(int); 6817c478bd9Sstevel@tonic-gate 6827c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6837c478bd9Sstevel@tonic-gate } 6847c478bd9Sstevel@tonic-gate #endif 6857c478bd9Sstevel@tonic-gate 6867c478bd9Sstevel@tonic-gate #endif /* __RTLD_H */ 687