globals.c revision 75e7992ad4e186443b61dab39f79c9d79802f295
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <dlfcn.h>
#include <synch.h>
#include <debug.h>
#include "_rtld.h"
/*
* Declarations of global variables used in ld.so.
*/
/*
* Major link-map lists.
*/
/*
* Entrance count. Each time ld.so.1 is entered this count is bumped. This
* operation can result in many symbol lookup requests (ie. loading objects and
* relocating all symbolic bindings). This count is used to protect against
* attempting to re-load a failed lazy load within a single call to ld.so.1,
* while allowing such attempts across calls. Should a lazy load fail, the
* present operation identifier is saved in the current symbol lookup data
* block (Slookup). Should a lazy load fall back operation be triggered, the
* identifier in the symbol lookup block is compared to the current ld.so.1
* entry count, and if the two are equal the fall back is skipped.
*
* With this count, there is a danger of wrap-around, although as an unsigned
* 32-bit value, it is highly unlikely that any application could usefully make
* 4.3 giga-calls into ld.so.1. The worst that can occur is that a fall back
* lazy load isn't triggered. However, most lazy loads that fail typically
* continue to fail unless the user takes corrective action (adds the necessary
* (fixed) dependencies to the system.
*/
ulong_t ld_entry_cnt = 0;
/*
* BEGIN: Exposed to rtld_db, don't change without a coordinated handshake with
* librtld_db (remembering that librtld_db must be able to read old as well as
* current core files).
*/
/*
* END: Exposed to rtld_db
*/
/*
* Initialized fmap structure.
*/
/*
* Set of integers to track how many of what type of
* PLT's have been bound. This is only really interesting
* for SPARC since ia32 basically just has the one PLT.
*/
uint32_t pltcntfull = 0;
/*
* Enable technology (via status flags for RTLD) dependent upon whether we're
* in a patch or major release build environment.
*/
#ifdef EXPAND_RELATIVE
#endif
#ifdef SIEBEL_DISABLE
#endif
uint_t rtld_flags2 = 0;
/*
* Various other global data.
*/
const char *procname = (const char *)0;
char *lasterr = (char *)0; /* string describing last error */
/* cleared by each dlerror() */
unsigned long at_flags = 0; /* machine specific file flags */
char *platform = 0; /* platform name from AT_SUN_PLATFORM */
/* is all) */
const char *rpl_audit = 0; /* replaceable LD_AUDIT string */
const char *rpl_debug = 0; /* replaceable LD_DEBUG string */
const char *rpl_ldflags = 0; /* replaceable LD_FLAGS string */
const char *rpl_libpath = 0; /* replaceable LD_LIBRARY_PATH string */
const char *rpl_preload = 0; /* replaceable LD_PRELOAD string */
const char *prm_audit = 0; /* permanent LD_AUDIT string */
const char *prm_debug = 0; /* permanent LD_DEBUG string */
const char *prm_ldflags = 0; /* permanent LD_FLAGS string */
const char *prm_libpath = 0; /* permanent LD_LIBRARY_PATH string */
const char *prm_preload = 0; /* permanent LD_PRELOAD string */
/* variables */
/*
* Note, the debugging descriptor interposes on the default definition provided
* by liblddbg. This is required as ld.so.1 must only have outstanding relative
* relocations.
*/
const char *dbg_file = 0; /* debugging directed to file */
char **_environ = 0; /* supply the pair to satisfy any */
/* libc requirements (hwmuldiv) */
const char *profile_name; /* object being profiled */
const char *profile_out; /* profile output file */
const char *profile_lib; /* audit library to perform profile */
unsigned char search_rules[] = { /* dependency search rules */
RPLENV, /* replaceable LD_LIBRARY_PATH */
PRMENV, /* permanent LD_LIBRARY_PATH */
RUNPATH, /* callers runpath */
DEFAULT, /* default library path */
0
};
/* auxv information. */
/*
* Frequently used messages are cached here to reduce _dgettext() overhead and
* also provide for resetting should the locale change (see _ld_libc()).
*/
const char *nosym_str = 0;
/*
* Rejection error message tables.
*/
const Msg
ldd_reject[] = {
MSG_LDD_REJ_MACH, /* MSG_INTL(MSG_LDD_REJ_MACH) */
MSG_LDD_REJ_CLASS, /* MSG_INTL(MSG_LDD_REJ_CLASS) */
MSG_LDD_REJ_DATA, /* MSG_INTL(MSG_LDD_REJ_DATA) */
MSG_LDD_REJ_TYPE, /* MSG_INTL(MSG_LDD_REJ_TYPE) */
MSG_LDD_REJ_BADFLAG, /* MSG_INTL(MSG_LDD_REJ_BADFLAG) */
MSG_LDD_REJ_MISFLAG, /* MSG_INTL(MSG_LDD_REJ_MISFLAG) */
MSG_LDD_REJ_VERSION, /* MSG_INTL(MSG_LDD_REJ_VERSION) */
MSG_LDD_REJ_HAL, /* MSG_INTL(MSG_LDD_REJ_HAL) */
MSG_LDD_REJ_US3, /* MSG_INTL(MSG_LDD_REJ_US3) */
MSG_LDD_REJ_STR, /* MSG_INTL(MSG_LDD_REJ_STR) */
MSG_LDD_REJ_UNKFILE, /* MSG_INTL(MSG_LDD_REJ_UNKFILE) */
MSG_LDD_REJ_HWCAP_1, /* MSG_INTL(MSG_LDD_REJ_HWCAP_1) */
};
const Msg
err_reject[] = {
MSG_ERR_REJ_MACH, /* MSG_INTL(MSG_ERR_REJ_MACH) */
MSG_ERR_REJ_CLASS, /* MSG_INTL(MSG_ERR_REJ_CLASS) */
MSG_ERR_REJ_DATA, /* MSG_INTL(MSG_ERR_REJ_DATA) */
MSG_ERR_REJ_TYPE, /* MSG_INTL(MSG_ERR_REJ_TYPE) */
MSG_ERR_REJ_BADFLAG, /* MSG_INTL(MSG_ERR_REJ_BADFLAG) */
MSG_ERR_REJ_MISFLAG, /* MSG_INTL(MSG_ERR_REJ_MISFLAG) */
MSG_ERR_REJ_VERSION, /* MSG_INTL(MSG_ERR_REJ_VERSION) */
MSG_ERR_REJ_HAL, /* MSG_INTL(MSG_ERR_REJ_HAL) */
MSG_ERR_REJ_US3, /* MSG_INTL(MSG_ERR_REJ_US3) */
MSG_ERR_REJ_STR, /* MSG_INTL(MSG_ERR_REJ_STR) */
MSG_ERR_REJ_UNKFILE, /* MSG_INTL(MSG_ERR_REJ_UNKFILE) */
MSG_ERR_REJ_HWCAP_1, /* MSG_INTL(MSG_ERR_REJ_HWCAP_1) */
};