1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1988 AT&T 24*7c478bd9Sstevel@tonic-gate * All Rights Reserved 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate * 27*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef __RTLD_H 32*7c478bd9Sstevel@tonic-gate #define __RTLD_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * Common header for run-time linker. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 40*7c478bd9Sstevel@tonic-gate #include <sys/stat.h> 41*7c478bd9Sstevel@tonic-gate #include <sys/avl.h> 42*7c478bd9Sstevel@tonic-gate #include <stdarg.h> 43*7c478bd9Sstevel@tonic-gate #include <synch.h> 44*7c478bd9Sstevel@tonic-gate #include <signal.h> 45*7c478bd9Sstevel@tonic-gate #include <errno.h> 46*7c478bd9Sstevel@tonic-gate #include <unistd.h> 47*7c478bd9Sstevel@tonic-gate #include <link.h> 48*7c478bd9Sstevel@tonic-gate #include <rtld.h> 49*7c478bd9Sstevel@tonic-gate #include <sgs.h> 50*7c478bd9Sstevel@tonic-gate #include <machdep.h> 51*7c478bd9Sstevel@tonic-gate #include <rtc.h> 52*7c478bd9Sstevel@tonic-gate #include <msg.h> 53*7c478bd9Sstevel@tonic-gate #include <libc_int.h> 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 56*7c478bd9Sstevel@tonic-gate extern "C" { 57*7c478bd9Sstevel@tonic-gate #endif 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate /* 60*7c478bd9Sstevel@tonic-gate * Dependency search rule order. 61*7c478bd9Sstevel@tonic-gate */ 62*7c478bd9Sstevel@tonic-gate #define RPLENV 1 /* replaceable LD_LIBRARY_PATH */ 63*7c478bd9Sstevel@tonic-gate #define PRMENV 2 /* permanent LD_LIBRARY_PATH */ 64*7c478bd9Sstevel@tonic-gate #define RUNPATH 3 /* callers runpath */ 65*7c478bd9Sstevel@tonic-gate #define DEFAULT 4 /* default library path */ 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Data structure for file class specific functions and data. 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate typedef struct fct { 72*7c478bd9Sstevel@tonic-gate int (*fct_are_u_this)(Rej_desc *); /* determine type of object */ 73*7c478bd9Sstevel@tonic-gate ulong_t (*fct_entry_pt)(void); /* get entry point */ 74*7c478bd9Sstevel@tonic-gate Rt_map *(*fct_map_so)(Lm_list *, Aliste, const char *, const char *, 75*7c478bd9Sstevel@tonic-gate int); /* map in a shared object */ 76*7c478bd9Sstevel@tonic-gate void (*fct_unmap_so)(Rt_map *); /* unmap a shared object */ 77*7c478bd9Sstevel@tonic-gate int (*fct_needed)(Lm_list *, Aliste, Rt_map *); 78*7c478bd9Sstevel@tonic-gate /* determine needed objects */ 79*7c478bd9Sstevel@tonic-gate Sym *(*fct_lookup_sym)(Slookup *, Rt_map **, uint_t *); 80*7c478bd9Sstevel@tonic-gate /* initialize symbol lookup */ 81*7c478bd9Sstevel@tonic-gate int (*fct_reloc)(Rt_map *, uint_t); /* relocate shared object */ 82*7c478bd9Sstevel@tonic-gate Pnode *fct_dflt_dirs; /* list of default dirs to */ 83*7c478bd9Sstevel@tonic-gate /* search */ 84*7c478bd9Sstevel@tonic-gate Pnode *fct_secure_dirs; /* list of secure dirs to */ 85*7c478bd9Sstevel@tonic-gate /* search (set[ug]id) */ 86*7c478bd9Sstevel@tonic-gate Pnode *(*fct_fix_name)(const char *, Rt_map *, uint_t); 87*7c478bd9Sstevel@tonic-gate /* transpose name */ 88*7c478bd9Sstevel@tonic-gate char *(*fct_get_so)(const char *, const char *); 89*7c478bd9Sstevel@tonic-gate /* get shared object */ 90*7c478bd9Sstevel@tonic-gate void (*fct_dladdr)(ulong_t, Rt_map *, Dl_info *, void **, int); 91*7c478bd9Sstevel@tonic-gate /* get symbolic address */ 92*7c478bd9Sstevel@tonic-gate Sym *(*fct_dlsym)(Grp_hdl *, Slookup *, Rt_map **, uint_t *); 93*7c478bd9Sstevel@tonic-gate /* process dlsym request */ 94*7c478bd9Sstevel@tonic-gate int (*fct_verify_vers)(const char *, Rt_map *, Rt_map *); 95*7c478bd9Sstevel@tonic-gate /* verify versioning (ELF) */ 96*7c478bd9Sstevel@tonic-gate int (*fct_set_prot)(Rt_map *, int); 97*7c478bd9Sstevel@tonic-gate /* set protection */ 98*7c478bd9Sstevel@tonic-gate } Fct; 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * Return codes for util::anon_map(). 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate typedef enum { 105*7c478bd9Sstevel@tonic-gate AM_OK, /* mmap(MAP_ANON) succeeded */ 106*7c478bd9Sstevel@tonic-gate AM_NOSUP, /* mmap(MAP_ANON) not supported (old OS) */ 107*7c478bd9Sstevel@tonic-gate AM_ERROR /* mmap(MAP_ANON) failed */ 108*7c478bd9Sstevel@tonic-gate } Am_ret; 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate /* 112*7c478bd9Sstevel@tonic-gate * Macros for getting to the file class table. 113*7c478bd9Sstevel@tonic-gate */ 114*7c478bd9Sstevel@tonic-gate #define LM_ENTRY_PT(X) ((X)->rt_fct->fct_entry_pt) 115*7c478bd9Sstevel@tonic-gate #define LM_UNMAP_SO(X) ((X)->rt_fct->fct_unmap_so) 116*7c478bd9Sstevel@tonic-gate #define LM_NEEDED(X) ((X)->rt_fct->fct_needed) 117*7c478bd9Sstevel@tonic-gate #define LM_LOOKUP_SYM(X) ((X)->rt_fct->fct_lookup_sym) 118*7c478bd9Sstevel@tonic-gate #define LM_RELOC(X) ((X)->rt_fct->fct_reloc) 119*7c478bd9Sstevel@tonic-gate #define LM_DFLT_DIRS(X) ((X)->rt_fct->fct_dflt_dirs) 120*7c478bd9Sstevel@tonic-gate #define LM_SECURE_DIRS(X) ((X)->rt_fct->fct_secure_dirs) 121*7c478bd9Sstevel@tonic-gate #define LM_FIX_NAME(X) ((X)->rt_fct->fct_fix_name) 122*7c478bd9Sstevel@tonic-gate #define LM_GET_SO(X) ((X)->rt_fct->fct_get_so) 123*7c478bd9Sstevel@tonic-gate #define LM_DLADDR(X) ((X)->rt_fct->fct_dladdr) 124*7c478bd9Sstevel@tonic-gate #define LM_DLSYM(X) ((X)->rt_fct->fct_dlsym) 125*7c478bd9Sstevel@tonic-gate #define LM_VERIFY_VERS(X) ((X)->rt_fct->fct_verify_vers) 126*7c478bd9Sstevel@tonic-gate #define LM_SET_PROT(X) ((X)->rt_fct->fct_set_prot) 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * Define Alist initialization sizes. 131*7c478bd9Sstevel@tonic-gate */ 132*7c478bd9Sstevel@tonic-gate #define AL_CNT_ALIAS 2 /* ALIAS() initial alist count */ 133*7c478bd9Sstevel@tonic-gate #define AL_CNT_DEPENDS 10 /* DEPENDS() initial alist count */ 134*7c478bd9Sstevel@tonic-gate #define AL_CNT_CALLERS 10 /* CALLERS() initial alist count */ 135*7c478bd9Sstevel@tonic-gate #define AL_CNT_GROUPS 1 /* GROUPS() initial alist count */ 136*7c478bd9Sstevel@tonic-gate #define AL_CNT_COPYREL 10 /* COPY() initial alist count */ 137*7c478bd9Sstevel@tonic-gate #define AL_CNT_LAZYFIND 10 /* elf_lazy_find_sym() initial alist */ 138*7c478bd9Sstevel@tonic-gate /* count */ 139*7c478bd9Sstevel@tonic-gate #define AL_CNT_GRPCLCT 10 /* gdp_collect() initial alist count */ 140*7c478bd9Sstevel@tonic-gate #define AL_CNT_DEPCLCT 10 /* load_so() initial alist count */ 141*7c478bd9Sstevel@tonic-gate #define AL_CNT_RTLDINFO 1 /* RTLDINFO() initial alist count */ 142*7c478bd9Sstevel@tonic-gate #define AL_CNT_FPNODE 2 /* FPNODE() initial alist count */ 143*7c478bd9Sstevel@tonic-gate #define AL_CNT_LMLISTS 8 /* lm_lists initial alist count */ 144*7c478bd9Sstevel@tonic-gate #define AL_CNT_LMNOW 8 /* lm_now initial alist count */ 145*7c478bd9Sstevel@tonic-gate #define AL_CNT_RELBIND 20 /* relocation binding alist count */ 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate /* 149*7c478bd9Sstevel@tonic-gate * Size of buffer for building error messages. 150*7c478bd9Sstevel@tonic-gate */ 151*7c478bd9Sstevel@tonic-gate #define ERRSIZE 2048 /* MAXPATHLEN * 2 */ 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* 155*7c478bd9Sstevel@tonic-gate * Configuration file information. 156*7c478bd9Sstevel@tonic-gate */ 157*7c478bd9Sstevel@tonic-gate typedef struct config { 158*7c478bd9Sstevel@tonic-gate const char *c_name; 159*7c478bd9Sstevel@tonic-gate Addr c_bgn; 160*7c478bd9Sstevel@tonic-gate Addr c_end; 161*7c478bd9Sstevel@tonic-gate Word *c_hashtbl; 162*7c478bd9Sstevel@tonic-gate Word *c_hashchain; 163*7c478bd9Sstevel@tonic-gate const char *c_strtbl; 164*7c478bd9Sstevel@tonic-gate Rtc_obj *c_objtbl; 165*7c478bd9Sstevel@tonic-gate Rtc_fltr *c_fltr; 166*7c478bd9Sstevel@tonic-gate Rtc_flte *c_flte; 167*7c478bd9Sstevel@tonic-gate } Config; 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate /* 170*7c478bd9Sstevel@tonic-gate * Register symbol list. 171*7c478bd9Sstevel@tonic-gate */ 172*7c478bd9Sstevel@tonic-gate typedef struct reglist { 173*7c478bd9Sstevel@tonic-gate Rt_map *rl_lmp; /* defining object */ 174*7c478bd9Sstevel@tonic-gate Sym *rl_sym; /* regsym */ 175*7c478bd9Sstevel@tonic-gate struct reglist *rl_next; /* next entry */ 176*7c478bd9Sstevel@tonic-gate } Reglist; 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate /* 179*7c478bd9Sstevel@tonic-gate * Data structure to hold interpreter information. 180*7c478bd9Sstevel@tonic-gate */ 181*7c478bd9Sstevel@tonic-gate typedef struct interp { 182*7c478bd9Sstevel@tonic-gate char *i_name; /* interpreter name */ 183*7c478bd9Sstevel@tonic-gate caddr_t i_faddr; /* address interpreter is mapped at */ 184*7c478bd9Sstevel@tonic-gate } Interp; 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate /* 187*7c478bd9Sstevel@tonic-gate * Data structure used to keep track of copy relocations. These relocations 188*7c478bd9Sstevel@tonic-gate * are collected during initial relocation processing and maintained on the 189*7c478bd9Sstevel@tonic-gate * COPY(lmp) list of the defining object. Each copy list is also added to the 190*7c478bd9Sstevel@tonic-gate * COPY(lmp) of the head object (normally the application dynamic executable) 191*7c478bd9Sstevel@tonic-gate * from which they will be processed after all relocations are done. 192*7c478bd9Sstevel@tonic-gate * 193*7c478bd9Sstevel@tonic-gate * The use of RTLD_GROUP will also reference individual objects COPY(lmp) lists 194*7c478bd9Sstevel@tonic-gate * in case a bound symbol must be assigned to it actual copy relocation. 195*7c478bd9Sstevel@tonic-gate */ 196*7c478bd9Sstevel@tonic-gate typedef struct { 197*7c478bd9Sstevel@tonic-gate const char *r_name; /* symbol name */ 198*7c478bd9Sstevel@tonic-gate Sym *r_rsym; /* reference symbol table entry */ 199*7c478bd9Sstevel@tonic-gate Rt_map *r_rlmp; /* reference link map */ 200*7c478bd9Sstevel@tonic-gate Rt_map *r_dlmp; /* definition link map */ 201*7c478bd9Sstevel@tonic-gate Sym *r_dsym; /* definition symbol table entry */ 202*7c478bd9Sstevel@tonic-gate void *r_radd; /* copy to address */ 203*7c478bd9Sstevel@tonic-gate const void *r_dadd; /* copy from address */ 204*7c478bd9Sstevel@tonic-gate ulong_t r_size; /* copy size bytes */ 205*7c478bd9Sstevel@tonic-gate } Rel_copy; 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate /* 208*7c478bd9Sstevel@tonic-gate * Data structure to hold initial file mapping information. Used to 209*7c478bd9Sstevel@tonic-gate * communicate during initial object mapping and provide for error recovery. 210*7c478bd9Sstevel@tonic-gate */ 211*7c478bd9Sstevel@tonic-gate typedef struct { 212*7c478bd9Sstevel@tonic-gate char *fm_maddr; /* address of initial mapping */ 213*7c478bd9Sstevel@tonic-gate size_t fm_msize; /* size of initial mapping */ 214*7c478bd9Sstevel@tonic-gate size_t fm_fsize; /* actual file size */ 215*7c478bd9Sstevel@tonic-gate ulong_t fm_etext; /* end of text segment */ 216*7c478bd9Sstevel@tonic-gate int fm_mflags; /* mapping flags */ 217*7c478bd9Sstevel@tonic-gate ulong_t fm_hwptr; /* hardware capabilities pointer */ 218*7c478bd9Sstevel@tonic-gate } Fmap; 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate /* 221*7c478bd9Sstevel@tonic-gate * Define a file descriptor, which maintains information regarding a pathname 222*7c478bd9Sstevel@tonic-gate * that has been opened and minimally inspected. 223*7c478bd9Sstevel@tonic-gate */ 224*7c478bd9Sstevel@tonic-gate typedef struct { 225*7c478bd9Sstevel@tonic-gate Rt_map *fd_lmp; /* existing link-map pointer */ 226*7c478bd9Sstevel@tonic-gate Fct *fd_ftp; /* file functions pointer */ 227*7c478bd9Sstevel@tonic-gate const char *fd_oname; /* original file name */ 228*7c478bd9Sstevel@tonic-gate const char *fd_odir; /* original directory name */ 229*7c478bd9Sstevel@tonic-gate const char *fd_nname; /* new file (expanded) name */ 230*7c478bd9Sstevel@tonic-gate const char *fd_pname; /* new path (resolved) name */ 231*7c478bd9Sstevel@tonic-gate dev_t fd_dev; /* file device number */ 232*7c478bd9Sstevel@tonic-gate ino_t fd_ino; /* file inode number */ 233*7c478bd9Sstevel@tonic-gate int fd_fd; /* open file descriptor */ 234*7c478bd9Sstevel@tonic-gate uint_t fd_flags; 235*7c478bd9Sstevel@tonic-gate avl_index_t fd_avlwhere; /* avl tree insertion index */ 236*7c478bd9Sstevel@tonic-gate Fmap fd_fmap; /* file mapping information */ 237*7c478bd9Sstevel@tonic-gate } Fdesc; 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate #define FLG_FD_ALTER 0x01 /* file is an alternate */ 240*7c478bd9Sstevel@tonic-gate #define FLG_FD_SLASH 0x02 /* file contains a "/" */ 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate /* 243*7c478bd9Sstevel@tonic-gate * File descriptor availability flag. 244*7c478bd9Sstevel@tonic-gate */ 245*7c478bd9Sstevel@tonic-gate #define FD_UNAVAIL -1 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate /* 248*7c478bd9Sstevel@tonic-gate * Disabled filter flag. Filter objects are referenced using their .dynamic 249*7c478bd9Sstevel@tonic-gate * index (DT_FILTER or DT_AUXILIARY). This index is saved and used to lookup 250*7c478bd9Sstevel@tonic-gate * the required filter. Note that 0 is a valid .dynamic index. The caller's 251*7c478bd9Sstevel@tonic-gate * OBJFLTRNDX() element is initialized using the following flag, and should 252*7c478bd9Sstevel@tonic-gate * the filter's initialization fail, is reset to this value to indicate the 253*7c478bd9Sstevel@tonic-gate * filter is disabled. UINT_MAX provides a convenient invalid .dynamic index. 254*7c478bd9Sstevel@tonic-gate */ 255*7c478bd9Sstevel@tonic-gate #define FLTR_DISABLED UINT_MAX 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate /* 258*7c478bd9Sstevel@tonic-gate * Status flags for rtld_flags 259*7c478bd9Sstevel@tonic-gate */ 260*7c478bd9Sstevel@tonic-gate #define RT_FL_THREADS 0x00000001 /* threads are enabled */ 261*7c478bd9Sstevel@tonic-gate #define RT_FL_WARNFLTR 0x00000002 /* warn of missing filtees (ldd) */ 262*7c478bd9Sstevel@tonic-gate #define RT_FL_DBNOTIF 0x00000004 /* binding activity going on */ 263*7c478bd9Sstevel@tonic-gate 264*7c478bd9Sstevel@tonic-gate #ifdef SIEBEL_DISABLE 265*7c478bd9Sstevel@tonic-gate #define RT_FL_DISFIX_1 0x00000008 /* disable fix number 1 */ 266*7c478bd9Sstevel@tonic-gate #endif 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate #define RT_FL_NOBIND 0x00000010 /* don't carry out plt binding */ 269*7c478bd9Sstevel@tonic-gate #define RT_FL_NOVERSION 0x00000020 /* disable version checking */ 270*7c478bd9Sstevel@tonic-gate #define RT_FL_SECURE 0x00000040 /* setuid/segid flag */ 271*7c478bd9Sstevel@tonic-gate #define RT_FL_APPLIC 0x00000080 /* are we executing user code */ 272*7c478bd9Sstevel@tonic-gate #define RT_FL_CONCUR 0x00000100 /* thread concurrency checks required */ 273*7c478bd9Sstevel@tonic-gate #define RT_FL_CONFGEN 0x00000200 /* don't relocate initiating object */ 274*7c478bd9Sstevel@tonic-gate /* set by crle(1). */ 275*7c478bd9Sstevel@tonic-gate #define RT_FL_CONFAPP 0x00000400 /* application specific configuration */ 276*7c478bd9Sstevel@tonic-gate /* cache required */ 277*7c478bd9Sstevel@tonic-gate #define RT_FL_DEBUGGER 0x00000800 /* a debugger is monitoring us */ 278*7c478bd9Sstevel@tonic-gate #define RT_FL_AUNOTIF 0x00001000 /* audit activity going on */ 279*7c478bd9Sstevel@tonic-gate #define RT_FL_NEWLOCALE 0x00002000 /* message locale has changed */ 280*7c478bd9Sstevel@tonic-gate #define RT_FL_NOBAPLT 0x00004000 /* sparc: don't use ba plt's */ 281*7c478bd9Sstevel@tonic-gate #define RT_FL_NOAUXFLTR 0x00008000 /* disable auxiliary filters */ 282*7c478bd9Sstevel@tonic-gate #define RT_FL_NOCONCUR 0x00010000 /* disable thread concurrency checks */ 283*7c478bd9Sstevel@tonic-gate #define RT_FL_NOAUDIT 0x00020000 /* disable auditing */ 284*7c478bd9Sstevel@tonic-gate #define RT_FL_ATEXIT 0x00040000 /* we're shutting down */ 285*7c478bd9Sstevel@tonic-gate #define RT_FL_SILENCERR 0x00080000 /* silence error messages */ 286*7c478bd9Sstevel@tonic-gate #define RT_FL_BREADTH 0x00100000 /* use breadth-first for .init/.fini */ 287*7c478bd9Sstevel@tonic-gate #define RT_FL_INITFIRST 0x00200000 /* processing a DT_INITFIRST object */ 288*7c478bd9Sstevel@tonic-gate #define RT_FL_RELATIVE 0x00400000 /* relative path expansion required */ 289*7c478bd9Sstevel@tonic-gate #define RT_FL_EXECNAME 0x00800000 /* AT_SUN_EXECNAME vector is avail */ 290*7c478bd9Sstevel@tonic-gate #define RT_FL_DEMANGLE 0x01000000 /* demangle C++ symbol names */ 291*7c478bd9Sstevel@tonic-gate #define RT_FL_NOCFG 0x02000000 /* disable config file use */ 292*7c478bd9Sstevel@tonic-gate #define RT_FL_NODIRCFG 0x04000000 /* disable directory config use */ 293*7c478bd9Sstevel@tonic-gate #define RT_FL_NOOBJALT 0x08000000 /* disable object alternative use */ 294*7c478bd9Sstevel@tonic-gate #define RT_FL_NOENVCFG 0x10000000 /* disable config envars use */ 295*7c478bd9Sstevel@tonic-gate #define RT_FL_DIRCFG 0x20000000 /* directory config info available */ 296*7c478bd9Sstevel@tonic-gate #define RT_FL_OBJALT 0x40000000 /* object alternatives are available */ 297*7c478bd9Sstevel@tonic-gate #define RT_FL_MEMRESV 0x80000000 /* memory reservation established */ 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate /* 300*7c478bd9Sstevel@tonic-gate * Status flags for rtld_flags2 301*7c478bd9Sstevel@tonic-gate */ 302*7c478bd9Sstevel@tonic-gate #define RT_FL2_HASAUDIT 0x00000001 /* We have auditing lm_list */ 303*7c478bd9Sstevel@tonic-gate #define RT_FL2_RTLDSEEN 0x00000002 /* rtldinfo has been set */ 304*7c478bd9Sstevel@tonic-gate #define RT_FL2_UNIFPROC 0x00000004 /* we're running in libc/libthread */ 305*7c478bd9Sstevel@tonic-gate /* Unified environment */ 306*7c478bd9Sstevel@tonic-gate #define RT_FL2_NOMALIGN 0x00000008 /* mmap MAP_ALIGN isn't available */ 307*7c478bd9Sstevel@tonic-gate #define RT_FL2_NOFLTCFG 0x00000010 /* disable config filter use */ 308*7c478bd9Sstevel@tonic-gate #define RT_FL2_FLTCFG 0x00000020 /* filter config info available */ 309*7c478bd9Sstevel@tonic-gate #define RT_FL2_HWCAP 0x00000040 /* hardware capabilities available */ 310*7c478bd9Sstevel@tonic-gate #define RT_FL2_FTL2WARN 0x00000080 /* convert fatal to warning messages */ 311*7c478bd9Sstevel@tonic-gate #define RT_FL2_BINDNOW 0x00000100 /* LD_BIND_NOW in effect */ 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate /* 314*7c478bd9Sstevel@tonic-gate * Information flags for env_info. 315*7c478bd9Sstevel@tonic-gate */ 316*7c478bd9Sstevel@tonic-gate #define ENV_INF_PATHCFG 0x00000001 /* replaceable LD_LIBRARY_PATH */ 317*7c478bd9Sstevel@tonic-gate /* originates from configuration */ 318*7c478bd9Sstevel@tonic-gate /* file */ 319*7c478bd9Sstevel@tonic-gate #define ENV_INF_FLAGCFG 0x00000002 /* replaceable LD_FLAGS originates */ 320*7c478bd9Sstevel@tonic-gate /* from configuration file */ 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate /* 323*7c478bd9Sstevel@tonic-gate * Binding flags for the bindguard routines 324*7c478bd9Sstevel@tonic-gate */ 325*7c478bd9Sstevel@tonic-gate #define THR_FLG_RTLD 0x00000001 /* rtldlock bind_guard() flag */ 326*7c478bd9Sstevel@tonic-gate #define THR_FLG_MASK THR_FLG_RTLD /* mask for all THR_FLG flags */ 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate #define ROUND(x, a) (((int)(x) + ((int)(a) - 1)) & \ 329*7c478bd9Sstevel@tonic-gate ~((int)(a) - 1)) 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate #define RT_SORT_FWD 0x01 /* topological sort (.fini) */ 332*7c478bd9Sstevel@tonic-gate #define RT_SORT_REV 0x02 /* reverse topological sort (.init) */ 333*7c478bd9Sstevel@tonic-gate #define RT_SORT_DELETE 0x10 /* process FLG_RT_DELNEED objects */ 334*7c478bd9Sstevel@tonic-gate /* only (called via dlclose()) */ 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gate /* 337*7c478bd9Sstevel@tonic-gate * Print buffer. 338*7c478bd9Sstevel@tonic-gate */ 339*7c478bd9Sstevel@tonic-gate typedef struct { 340*7c478bd9Sstevel@tonic-gate char *pr_buf; /* pointer to beginning of buffer */ 341*7c478bd9Sstevel@tonic-gate char *pr_cur; /* pointer to next free char in buffer */ 342*7c478bd9Sstevel@tonic-gate size_t pr_len; /* buffer size */ 343*7c478bd9Sstevel@tonic-gate int pr_fd; /* output fd */ 344*7c478bd9Sstevel@tonic-gate } Prfbuf; 345*7c478bd9Sstevel@tonic-gate 346*7c478bd9Sstevel@tonic-gate /* 347*7c478bd9Sstevel@tonic-gate * dlopen() handle list size. 348*7c478bd9Sstevel@tonic-gate */ 349*7c478bd9Sstevel@tonic-gate #define HDLIST_SZ 101 /* prime no. for hashing */ 350*7c478bd9Sstevel@tonic-gate #define HDLIST_ORP 102 /* orphan handle list */ 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * Define expansion path information. Search paths, i.e., LD_LIBRARY_PATH, 354*7c478bd9Sstevel@tonic-gate * RPATHS, etc. are defined using la_objsearch() information (see LA_SER flags 355*7c478bd9Sstevel@tonic-gate * in link.h). Definitions here extend the path information to other uses of 356*7c478bd9Sstevel@tonic-gate * pathname expansion, and are or'd together with any LA_SER_* flags. 357*7c478bd9Sstevel@tonic-gate */ 358*7c478bd9Sstevel@tonic-gate #define PN_SER_NEEDED 0x00001000 /* paths define DT_NEEDED entry */ 359*7c478bd9Sstevel@tonic-gate #define PN_SER_FILTEE 0x00002000 /* paths define filtees */ 360*7c478bd9Sstevel@tonic-gate #define PN_SER_EXTLOAD 0x00004000 /* paths define extra loaded objects */ 361*7c478bd9Sstevel@tonic-gate /* (preload, audit etc.) */ 362*7c478bd9Sstevel@tonic-gate #define PN_SER_DLOPEN 0x00008000 /* paths define dlopen() request */ 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate #define PN_SER_MASK 0x000ff000 /* mask for p_orig incorporation */ 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate /* 367*7c478bd9Sstevel@tonic-gate * Define reserved path tokens. These are used to prevent various expansions 368*7c478bd9Sstevel@tonic-gate * from occurring, and record those expansions that do. Note that any expansion 369*7c478bd9Sstevel@tonic-gate * information is also recorded in the p_orig field of a Pnode, and thus is 370*7c478bd9Sstevel@tonic-gate * or'd together with any LA_SER_* flags. 371*7c478bd9Sstevel@tonic-gate */ 372*7c478bd9Sstevel@tonic-gate #define PN_TKN_ORIGIN 0x00100000 /* $ORIGIN expansion has occurred */ 373*7c478bd9Sstevel@tonic-gate #define PN_TKN_PLATFORM 0x00200000 /* $PLATFORM expansion has occurred */ 374*7c478bd9Sstevel@tonic-gate #define PN_TKN_OSNAME 0x00400000 /* $OSNAME expansion has occurred */ 375*7c478bd9Sstevel@tonic-gate #define PN_TKN_OSREL 0x00800000 /* $OSREL expansion has occurred */ 376*7c478bd9Sstevel@tonic-gate #define PN_TKN_ISALIST 0x01000000 /* $ISALIST expansion has occurred */ 377*7c478bd9Sstevel@tonic-gate #define PN_TKN_HWCAP 0x02000000 /* $HWCAP expansion has occurred */ 378*7c478bd9Sstevel@tonic-gate 379*7c478bd9Sstevel@tonic-gate #define PN_TKN_MASK 0xfff00000 /* mask for p_orig incorporation */ 380*7c478bd9Sstevel@tonic-gate 381*7c478bd9Sstevel@tonic-gate #define TKN_NONE 0x00000001 /* no token expansion has occurred */ 382*7c478bd9Sstevel@tonic-gate #define TKN_DOTSLASH 0x00000002 /* path contains a "./" */ 383*7c478bd9Sstevel@tonic-gate 384*7c478bd9Sstevel@tonic-gate /* 385*7c478bd9Sstevel@tonic-gate * Define alist descriptor addition return values (see hdl_add()). 386*7c478bd9Sstevel@tonic-gate */ 387*7c478bd9Sstevel@tonic-gate #define ALE_EXISTS 1 /* alist entry already exists */ 388*7c478bd9Sstevel@tonic-gate #define ALE_CREATE 2 /* alist entry created */ 389*7c478bd9Sstevel@tonic-gate 390*7c478bd9Sstevel@tonic-gate /* 391*7c478bd9Sstevel@tonic-gate * Define _caller flags. 392*7c478bd9Sstevel@tonic-gate */ 393*7c478bd9Sstevel@tonic-gate #define CL_NONE 0 394*7c478bd9Sstevel@tonic-gate #define CL_EXECDEF 1 /* supply the executable as a default */ 395*7c478bd9Sstevel@tonic-gate /* if the caller can't be determined */ 396*7c478bd9Sstevel@tonic-gate 397*7c478bd9Sstevel@tonic-gate /* 398*7c478bd9Sstevel@tonic-gate * Binding information. Note, this is or'ed in with the DBG_BINFO flags to 399*7c478bd9Sstevel@tonic-gate * convey information regarding symbol bindings. 400*7c478bd9Sstevel@tonic-gate */ 401*7c478bd9Sstevel@tonic-gate #define BINFO_DIRECTDIS 0x10000 /* a direct binding has been disabled */ 402*7c478bd9Sstevel@tonic-gate 403*7c478bd9Sstevel@tonic-gate /* 404*7c478bd9Sstevel@tonic-gate * Data declarations. 405*7c478bd9Sstevel@tonic-gate */ 406*7c478bd9Sstevel@tonic-gate extern Rt_lock rtldlock; /* rtld lock */ 407*7c478bd9Sstevel@tonic-gate 408*7c478bd9Sstevel@tonic-gate extern List dynlm_list; /* dynamic list of link-maps */ 409*7c478bd9Sstevel@tonic-gate extern char **environ; /* environ pointer */ 410*7c478bd9Sstevel@tonic-gate 411*7c478bd9Sstevel@tonic-gate extern int dyn_plt_ent_size; /* Size of dynamic plt's */ 412*7c478bd9Sstevel@tonic-gate extern ulong_t at_flags; /* machine specific file flags */ 413*7c478bd9Sstevel@tonic-gate extern const char *pr_name; /* file name of executing process */ 414*7c478bd9Sstevel@tonic-gate extern Rtld_db_priv r_debug; /* debugging information */ 415*7c478bd9Sstevel@tonic-gate extern char *lasterr; /* string describing last error */ 416*7c478bd9Sstevel@tonic-gate extern Interp *interp; /* ELF executable interpreter info */ 417*7c478bd9Sstevel@tonic-gate extern const char *rt_name; /* name of the dynamic linker */ 418*7c478bd9Sstevel@tonic-gate extern List hdl_list[]; /* dlopen() handle list */ 419*7c478bd9Sstevel@tonic-gate extern size_t syspagsz; /* system page size */ 420*7c478bd9Sstevel@tonic-gate extern char *platform; /* platform name */ 421*7c478bd9Sstevel@tonic-gate extern size_t platform_sz; /* platform name string size */ 422*7c478bd9Sstevel@tonic-gate extern Isa_desc *isa; /* isalist descriptor */ 423*7c478bd9Sstevel@tonic-gate extern Uts_desc *uts; /* utsname descriptor */ 424*7c478bd9Sstevel@tonic-gate extern uint_t rtld_flags; /* status flags for RTLD */ 425*7c478bd9Sstevel@tonic-gate extern uint_t rtld_flags2; /* additional status flags for RTLD */ 426*7c478bd9Sstevel@tonic-gate extern Fmap *fmap; /* Initial file mapping info */ 427*7c478bd9Sstevel@tonic-gate extern uint32_t pltcnt21d; /* cnt of 21d PLTs */ 428*7c478bd9Sstevel@tonic-gate extern uint32_t pltcnt24d; /* cnt of 24d PLTs */ 429*7c478bd9Sstevel@tonic-gate extern uint32_t pltcntu32; /* cnt of u32 PLTs */ 430*7c478bd9Sstevel@tonic-gate extern uint32_t pltcntu44; /* cnt of u44 PLTs */ 431*7c478bd9Sstevel@tonic-gate extern uint32_t pltcntfull; /* cnt of full PLTs */ 432*7c478bd9Sstevel@tonic-gate extern uint32_t pltcntfar; /* cnt of far PLTs */ 433*7c478bd9Sstevel@tonic-gate extern uchar_t search_rules[]; /* dependency search rules */ 434*7c478bd9Sstevel@tonic-gate 435*7c478bd9Sstevel@tonic-gate extern Fct elf_fct; /* ELF file class dependent data */ 436*7c478bd9Sstevel@tonic-gate 437*7c478bd9Sstevel@tonic-gate #if defined(sparc) && !defined(__sparcv9) 438*7c478bd9Sstevel@tonic-gate extern Fct aout_fct; /* a.out (4.x) file class dependent */ 439*7c478bd9Sstevel@tonic-gate /* data */ 440*7c478bd9Sstevel@tonic-gate #endif 441*7c478bd9Sstevel@tonic-gate 442*7c478bd9Sstevel@tonic-gate extern const char *locale; /* locale environment setting */ 443*7c478bd9Sstevel@tonic-gate 444*7c478bd9Sstevel@tonic-gate extern Config *config; /* configuration structure */ 445*7c478bd9Sstevel@tonic-gate extern const char *locale; /* locale environment setting */ 446*7c478bd9Sstevel@tonic-gate 447*7c478bd9Sstevel@tonic-gate extern const char *rpl_audit; /* replaceable LD_AUDIT string */ 448*7c478bd9Sstevel@tonic-gate extern const char *rpl_debug; /* replaceable LD_DEBUG string */ 449*7c478bd9Sstevel@tonic-gate extern const char *rpl_ldflags; /* replaceable LD_FLAGS string */ 450*7c478bd9Sstevel@tonic-gate extern const char *rpl_libpath; /* replaceable LD_LIBRARY string */ 451*7c478bd9Sstevel@tonic-gate extern Pnode *rpl_libdirs; /* and its associated Pnode list */ 452*7c478bd9Sstevel@tonic-gate extern const char *rpl_preload; /* replaceable LD_PRELOAD string */ 453*7c478bd9Sstevel@tonic-gate 454*7c478bd9Sstevel@tonic-gate extern const char *prm_audit; /* permanent LD_AUDIT string */ 455*7c478bd9Sstevel@tonic-gate extern const char *prm_debug; /* permanent LD_DEBUG string */ 456*7c478bd9Sstevel@tonic-gate extern const char *prm_ldflags; /* permanent LD_FLAGS string */ 457*7c478bd9Sstevel@tonic-gate extern const char *prm_libpath; /* permanent LD_LIBRARY string */ 458*7c478bd9Sstevel@tonic-gate extern Pnode *prm_libdirs; /* and its associated Pnode list */ 459*7c478bd9Sstevel@tonic-gate extern const char *prm_preload; /* permanent LD_PRELOAD string */ 460*7c478bd9Sstevel@tonic-gate 461*7c478bd9Sstevel@tonic-gate extern uint_t env_info; /* information regarding environment */ 462*7c478bd9Sstevel@tonic-gate /* variables */ 463*7c478bd9Sstevel@tonic-gate extern int killsig; /* signal sent on fatal exit */ 464*7c478bd9Sstevel@tonic-gate 465*7c478bd9Sstevel@tonic-gate extern uint_t audit_argcnt; /* no. of stack args to copy */ 466*7c478bd9Sstevel@tonic-gate extern Audit_desc *auditors; /* global auditors */ 467*7c478bd9Sstevel@tonic-gate 468*7c478bd9Sstevel@tonic-gate extern char **_environ; 469*7c478bd9Sstevel@tonic-gate 470*7c478bd9Sstevel@tonic-gate extern const char *dbg_file; /* debugging directed to a file */ 471*7c478bd9Sstevel@tonic-gate 472*7c478bd9Sstevel@tonic-gate extern Reglist *reglist; /* list of register symbols */ 473*7c478bd9Sstevel@tonic-gate 474*7c478bd9Sstevel@tonic-gate extern const Msg err_reject[]; /* rejection error message tables */ 475*7c478bd9Sstevel@tonic-gate extern const Msg ldd_reject[]; 476*7c478bd9Sstevel@tonic-gate 477*7c478bd9Sstevel@tonic-gate extern const char *profile_name; /* object being profiled */ 478*7c478bd9Sstevel@tonic-gate extern const char *profile_out; /* profile output file */ 479*7c478bd9Sstevel@tonic-gate extern const char *profile_lib; /* audit library to perform profile */ 480*7c478bd9Sstevel@tonic-gate 481*7c478bd9Sstevel@tonic-gate extern const char *err_strs[]; /* diagnostic error string headers */ 482*7c478bd9Sstevel@tonic-gate extern const char *nosym_str; /* MSG_GEN_NOSYM message cache */ 483*7c478bd9Sstevel@tonic-gate 484*7c478bd9Sstevel@tonic-gate extern void (*thrinit)(); /* thread initialization */ 485*7c478bd9Sstevel@tonic-gate 486*7c478bd9Sstevel@tonic-gate extern ulong_t hwcap; /* hardware capabilities */ 487*7c478bd9Sstevel@tonic-gate extern ulong_t sfcap; /* software capabilities */ 488*7c478bd9Sstevel@tonic-gate 489*7c478bd9Sstevel@tonic-gate /* 490*7c478bd9Sstevel@tonic-gate * Function declarations. 491*7c478bd9Sstevel@tonic-gate */ 492*7c478bd9Sstevel@tonic-gate extern void addfree(void *, size_t); 493*7c478bd9Sstevel@tonic-gate extern void * alist_append(Alist **, const void *, size_t, int); 494*7c478bd9Sstevel@tonic-gate extern int alist_delete(Alist *, const void *, Aliste *); 495*7c478bd9Sstevel@tonic-gate extern int alist_test(Alist **, void *, size_t, int); 496*7c478bd9Sstevel@tonic-gate extern int append_alias(Rt_map *, const char *, int *); 497*7c478bd9Sstevel@tonic-gate extern int analyze_lmc(Lm_list *, Aliste, Rt_map *); 498*7c478bd9Sstevel@tonic-gate extern Am_ret anon_map(caddr_t *, size_t, int, int); 499*7c478bd9Sstevel@tonic-gate extern Fct *are_u_this(Rej_desc *, int, struct stat *, 500*7c478bd9Sstevel@tonic-gate const char *); 501*7c478bd9Sstevel@tonic-gate extern void atexit_fini(void); 502*7c478bd9Sstevel@tonic-gate extern int bind_one(Rt_map *, Rt_map *, uint_t); 503*7c478bd9Sstevel@tonic-gate extern int bufprint(Prfbuf *, const char *, ...); 504*7c478bd9Sstevel@tonic-gate extern void call_array(Addr *, uint_t, Rt_map *, uint_t); 505*7c478bd9Sstevel@tonic-gate extern void call_fini(Lm_list *, Rt_map **); 506*7c478bd9Sstevel@tonic-gate extern void call_init(Rt_map **, int); 507*7c478bd9Sstevel@tonic-gate extern int callable(Rt_map *, Rt_map *, Grp_hdl *); 508*7c478bd9Sstevel@tonic-gate extern Rt_map *_caller(caddr_t, int); 509*7c478bd9Sstevel@tonic-gate extern caddr_t caller(void); 510*7c478bd9Sstevel@tonic-gate extern void *calloc(size_t, size_t); 511*7c478bd9Sstevel@tonic-gate extern void cap_assign(Cap *, Rt_map *); 512*7c478bd9Sstevel@tonic-gate extern const char *_conv_reloc_type_str(uint_t rel); 513*7c478bd9Sstevel@tonic-gate extern uint_t dbg_setup(const char *); 514*7c478bd9Sstevel@tonic-gate extern const char *demangle(const char *); 515*7c478bd9Sstevel@tonic-gate extern int dlclose_intn(Grp_hdl *, Rt_map *); 516*7c478bd9Sstevel@tonic-gate extern int dlclose_core(Grp_hdl *, Rt_map *); 517*7c478bd9Sstevel@tonic-gate extern Sym *dlsym_handle(Grp_hdl *, Slookup *, Rt_map **, 518*7c478bd9Sstevel@tonic-gate uint_t *); 519*7c478bd9Sstevel@tonic-gate extern void *dlsym_intn(void *, const char *, Rt_map *, Rt_map **); 520*7c478bd9Sstevel@tonic-gate extern Grp_hdl *dlmopen_intn(Lm_list *, const char *, int, Rt_map *, 521*7c478bd9Sstevel@tonic-gate uint_t, int *); 522*7c478bd9Sstevel@tonic-gate extern size_t doprf(const char *, va_list, Prfbuf *); 523*7c478bd9Sstevel@tonic-gate extern int dowrite(Prfbuf *); 524*7c478bd9Sstevel@tonic-gate extern void dz_init(int); 525*7c478bd9Sstevel@tonic-gate extern caddr_t dz_map(caddr_t, size_t, int, int); 526*7c478bd9Sstevel@tonic-gate extern int elf_config(Rt_map *, int); 527*7c478bd9Sstevel@tonic-gate extern int elf_mach_flags_check(Rej_desc *, Ehdr *); 528*7c478bd9Sstevel@tonic-gate extern Rtc_obj *elf_config_ent(const char *, Word, int, const char **); 529*7c478bd9Sstevel@tonic-gate extern Pnode *elf_config_flt(const char *, const char *); 530*7c478bd9Sstevel@tonic-gate extern ulong_t elf_hash(const char *); 531*7c478bd9Sstevel@tonic-gate extern void elf_reloc_bad(Rt_map *, void *, uchar_t, ulong_t, 532*7c478bd9Sstevel@tonic-gate ulong_t); 533*7c478bd9Sstevel@tonic-gate extern ulong_t elf_reloc_relative(ulong_t, ulong_t, ulong_t, 534*7c478bd9Sstevel@tonic-gate ulong_t, ulong_t, ulong_t); 535*7c478bd9Sstevel@tonic-gate extern ulong_t elf_reloc_relacount(ulong_t, ulong_t, 536*7c478bd9Sstevel@tonic-gate ulong_t, ulong_t); 537*7c478bd9Sstevel@tonic-gate extern int enter(void); 538*7c478bd9Sstevel@tonic-gate extern void eprintf(Error, const char *, ...); 539*7c478bd9Sstevel@tonic-gate extern uint_t expand(char **, size_t *, char **, uint_t, uint_t, 540*7c478bd9Sstevel@tonic-gate Rt_map *); 541*7c478bd9Sstevel@tonic-gate extern Pnode *expand_paths(Rt_map *, const char *, uint_t, uint_t); 542*7c478bd9Sstevel@tonic-gate extern void free_hdl(Grp_hdl *); 543*7c478bd9Sstevel@tonic-gate extern void file_notfound(Lm_list *, const char *, Rt_map *, 544*7c478bd9Sstevel@tonic-gate uint_t, Rej_desc *); 545*7c478bd9Sstevel@tonic-gate extern int find_path(Lm_list *, const char *, Rt_map *, uint_t, 546*7c478bd9Sstevel@tonic-gate Fdesc *, Rej_desc *); 547*7c478bd9Sstevel@tonic-gate extern int fpavl_insert(Lm_list *, Rt_map *, const char *, 548*7c478bd9Sstevel@tonic-gate avl_index_t); 549*7c478bd9Sstevel@tonic-gate extern Rt_map *fpavl_loaded(Lm_list *, const char *, avl_index_t *); 550*7c478bd9Sstevel@tonic-gate extern void fpavl_remove(Rt_map *); 551*7c478bd9Sstevel@tonic-gate extern size_t fullpath(Rt_map *, const char *); 552*7c478bd9Sstevel@tonic-gate extern void fmap_setup(); 553*7c478bd9Sstevel@tonic-gate extern void get_lcinterface(Rt_map *, Lc_interface *); 554*7c478bd9Sstevel@tonic-gate extern Lmid_t get_linkmap_id(Lm_list *); 555*7c478bd9Sstevel@tonic-gate extern Pnode *get_next_dir(Pnode **, Rt_map *, uint_t); 556*7c478bd9Sstevel@tonic-gate int hdl_add(Grp_hdl *, Rt_map *, uint_t); 557*7c478bd9Sstevel@tonic-gate Grp_hdl *hdl_create(Lm_list *, Rt_map *, Rt_map *, uint_t); 558*7c478bd9Sstevel@tonic-gate int hdl_initialize(Grp_hdl *, Rt_map *, Rt_map *, int, int); 559*7c478bd9Sstevel@tonic-gate extern int hwcap_check(Rej_desc *, Ehdr *); 560*7c478bd9Sstevel@tonic-gate extern Pnode *hwcap_filtees(Pnode **, Aliste, Dyninfo *, Rt_map *, 561*7c478bd9Sstevel@tonic-gate const char *, int, uint_t); 562*7c478bd9Sstevel@tonic-gate void is_dep_ready(Rt_map *, Rt_map *, int); 563*7c478bd9Sstevel@tonic-gate void is_dep_init(Rt_map *, Rt_map *); 564*7c478bd9Sstevel@tonic-gate void ldso_plt_init(Rt_map *); 565*7c478bd9Sstevel@tonic-gate extern Listnode *list_append(List *, const void *); 566*7c478bd9Sstevel@tonic-gate extern Listnode *list_insert(List *, const void *, Listnode *); 567*7c478bd9Sstevel@tonic-gate extern Listnode *list_prepend(List *, const void *); 568*7c478bd9Sstevel@tonic-gate extern void list_delete(List *, void *); 569*7c478bd9Sstevel@tonic-gate extern void leave(Lm_list *); 570*7c478bd9Sstevel@tonic-gate extern void lm_append(Lm_list *, Aliste, Rt_map *); 571*7c478bd9Sstevel@tonic-gate extern void lm_delete(Lm_list *, Rt_map *); 572*7c478bd9Sstevel@tonic-gate extern void lm_move(Lm_list *, Aliste, Aliste, Lm_cntl *, 573*7c478bd9Sstevel@tonic-gate Lm_cntl *); 574*7c478bd9Sstevel@tonic-gate extern int lm_salvage(Lm_list *, int, Aliste); 575*7c478bd9Sstevel@tonic-gate extern void load_completion(Rt_map *, Rt_map *); 576*7c478bd9Sstevel@tonic-gate extern int load_finish(Lm_list *, const char *, Rt_map *, int, 577*7c478bd9Sstevel@tonic-gate uint_t, Grp_hdl **, Rt_map *); 578*7c478bd9Sstevel@tonic-gate extern Rt_map *load_hwcap(Lm_list *, Aliste, const char *, Rt_map *, 579*7c478bd9Sstevel@tonic-gate uint_t, uint_t, Grp_hdl **, Rej_desc *); 580*7c478bd9Sstevel@tonic-gate extern Rt_map *load_path(Lm_list *, Aliste, const char *, Rt_map *, 581*7c478bd9Sstevel@tonic-gate int, uint_t, Grp_hdl **, Fdesc *, Rej_desc *); 582*7c478bd9Sstevel@tonic-gate extern Rt_map *load_one(Lm_list *, Aliste, Pnode *, Rt_map *, int, 583*7c478bd9Sstevel@tonic-gate uint_t, Grp_hdl **); 584*7c478bd9Sstevel@tonic-gate extern const char *load_trace(Lm_list *, const char *, Rt_map *); 585*7c478bd9Sstevel@tonic-gate extern caddr_t nu_map(caddr_t, size_t, int, int); 586*7c478bd9Sstevel@tonic-gate extern void *malloc(size_t); 587*7c478bd9Sstevel@tonic-gate extern void move_data(Rt_map *); 588*7c478bd9Sstevel@tonic-gate extern int pr_open(void); 589*7c478bd9Sstevel@tonic-gate extern void rd_event(Lm_list *, rd_event_e, r_state_e); 590*7c478bd9Sstevel@tonic-gate extern int readenv_user(const char **, Word *, Word *, int); 591*7c478bd9Sstevel@tonic-gate extern int readenv_config(Rtc_env *, Addr, int); 592*7c478bd9Sstevel@tonic-gate extern void rejection_inherit(Rej_desc *, Rej_desc *, Fdesc *); 593*7c478bd9Sstevel@tonic-gate extern int relocate_lmc(Lm_list *, Aliste, Rt_map *); 594*7c478bd9Sstevel@tonic-gate extern int relocate_finish(Rt_map *, Alist *, int, int); 595*7c478bd9Sstevel@tonic-gate extern void remove_caller(Grp_hdl *, Rt_map *); 596*7c478bd9Sstevel@tonic-gate extern void remove_cntl(Lm_list *, Aliste); 597*7c478bd9Sstevel@tonic-gate extern int remove_hdl(Grp_hdl *, Rt_map *, int *); 598*7c478bd9Sstevel@tonic-gate extern void remove_incomplete(Lm_list *, Aliste); 599*7c478bd9Sstevel@tonic-gate extern void remove_lists(Rt_map *, int); 600*7c478bd9Sstevel@tonic-gate extern void remove_lml(Lm_list *); 601*7c478bd9Sstevel@tonic-gate extern void remove_pnode(Pnode *); 602*7c478bd9Sstevel@tonic-gate extern void remove_rej(Rej_desc *); 603*7c478bd9Sstevel@tonic-gate extern void remove_so(Lm_list *, Rt_map *); 604*7c478bd9Sstevel@tonic-gate extern int rt_cond_broadcast(Rt_cond *); 605*7c478bd9Sstevel@tonic-gate extern Rt_cond *rt_cond_create(void); 606*7c478bd9Sstevel@tonic-gate extern int rt_cond_wait(Rt_cond *, Rt_lock *); 607*7c478bd9Sstevel@tonic-gate extern int rt_bind_guard(int); 608*7c478bd9Sstevel@tonic-gate extern int rt_bind_clear(int); 609*7c478bd9Sstevel@tonic-gate extern int rt_mutex_lock(Rt_lock *); 610*7c478bd9Sstevel@tonic-gate extern int rt_mutex_unlock(Rt_lock *); 611*7c478bd9Sstevel@tonic-gate extern thread_t rt_thr_self(void); 612*7c478bd9Sstevel@tonic-gate extern void rtld_db_dlactivity(void); 613*7c478bd9Sstevel@tonic-gate extern void rtld_db_preinit(void); 614*7c478bd9Sstevel@tonic-gate extern void rtld_db_postinit(void); 615*7c478bd9Sstevel@tonic-gate extern void rtldexit(Lm_list *, int); 616*7c478bd9Sstevel@tonic-gate extern int rtld_getopt(char **, Word *, Word *, int); 617*7c478bd9Sstevel@tonic-gate extern void security(uid_t, uid_t, gid_t, gid_t, int); 618*7c478bd9Sstevel@tonic-gate extern void set_environ(Lm_list *); 619*7c478bd9Sstevel@tonic-gate extern Rt_map *setup(ulong_t, ulong_t, Word, char *, int, char *, 620*7c478bd9Sstevel@tonic-gate Dyn *, ulong_t, ulong_t, int fd, Phdr *, char *, 621*7c478bd9Sstevel@tonic-gate char **, int, uid_t, uid_t, gid_t, gid_t, void *, 622*7c478bd9Sstevel@tonic-gate int, uint_t); 623*7c478bd9Sstevel@tonic-gate extern void tls_assign_soffset(Rt_map *); 624*7c478bd9Sstevel@tonic-gate extern void tls_setroutines(Lm_list *, void *, void *, void *); 625*7c478bd9Sstevel@tonic-gate extern void tls_modactivity(Rt_map *, uint_t); 626*7c478bd9Sstevel@tonic-gate extern int tls_report_modules(); 627*7c478bd9Sstevel@tonic-gate extern Rt_map **tsort(Rt_map *, int, int); 628*7c478bd9Sstevel@tonic-gate extern void unused(Lm_list *); 629*7c478bd9Sstevel@tonic-gate extern int update_mode(Rt_map *, int, int); 630*7c478bd9Sstevel@tonic-gate extern void zero(caddr_t, size_t); 631*7c478bd9Sstevel@tonic-gate 632*7c478bd9Sstevel@tonic-gate #if defined(sparc) 633*7c478bd9Sstevel@tonic-gate /* 634*7c478bd9Sstevel@tonic-gate * SPARC Register symbol support. 635*7c478bd9Sstevel@tonic-gate */ 636*7c478bd9Sstevel@tonic-gate extern int elf_regsyms(Rt_map *); 637*7c478bd9Sstevel@tonic-gate extern void set_sparc_g1(ulong_t); 638*7c478bd9Sstevel@tonic-gate extern void set_sparc_g2(ulong_t); 639*7c478bd9Sstevel@tonic-gate extern void set_sparc_g3(ulong_t); 640*7c478bd9Sstevel@tonic-gate extern void set_sparc_g4(ulong_t); 641*7c478bd9Sstevel@tonic-gate extern void set_sparc_g5(ulong_t); 642*7c478bd9Sstevel@tonic-gate extern void set_sparc_g6(ulong_t); 643*7c478bd9Sstevel@tonic-gate extern void set_sparc_g7(ulong_t); 644*7c478bd9Sstevel@tonic-gate #endif /* defined(sparc) */ 645*7c478bd9Sstevel@tonic-gate 646*7c478bd9Sstevel@tonic-gate extern long _sysconfig(int); 647*7c478bd9Sstevel@tonic-gate 648*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 649*7c478bd9Sstevel@tonic-gate } 650*7c478bd9Sstevel@tonic-gate #endif 651*7c478bd9Sstevel@tonic-gate 652*7c478bd9Sstevel@tonic-gate #endif /* __RTLD_H */ 653