usr/src/cmd/sgs/include/rtld.h
author Rod Evans <Rod.Evans@Sun.COM>
Wed, 19 May 2010 22:33:49 -0700
changeset 12449 a87750d92895
parent 11827 d7ef53deac3f
child 12736 2d732c7bdbde
permissions -rw-r--r--
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW PSARC/2010/175 Deferred symbol references 6943432 dlsym(RTLD_PROBE) should only bind to symbol definitions 6668759 an external method for determining whether an ELF dependency is optional
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     1
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     2
 * CDDL HEADER START
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     3
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
     5
 * Common Development and Distribution License (the "License").
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
     6
 * You may not use this file except in compliance with the License.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     7
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    11
 * and limitations under the License.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    12
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    18
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    19
 * CDDL HEADER END
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    20
 */
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
    21
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    22
/*
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
    23
 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    24
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    25
#ifndef	_RTLD_H
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    26
#define	_RTLD_H
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    27
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    28
/*
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
    29
 * Global include file for the runtime linker.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    30
 */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
    31
#include <sys/mman.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    32
#include <time.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    33
#include <sgs.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    34
#include <thread.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    35
#include <synch.h>
6206
6b0ed502a8e7 PSARC 2008/179 cross link-editor
ab196087
parents: 6150
diff changeset
    36
#include <link.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    37
#include <sys/avl.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    38
#include <alist.h>
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
    39
#include <libc_int.h>
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
    40
#include <elfcap.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    41
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    42
#ifdef	_SYSCALL32
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    43
#include <inttypes.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    44
#endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    45
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    46
#ifdef	__cplusplus
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    47
extern "C" {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    48
#endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    49
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    50
/*
8394
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    51
 * We use rtld_ino_t instead of ino_t so that we can get
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    52
 * access to large inode values from 32-bit code.
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    53
 */
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    54
#ifdef _LP64
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    55
typedef ino_t		rtld_ino_t;
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    56
#else
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    57
typedef ino64_t		rtld_ino_t;
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    58
#endif
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
    59
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    60
typedef struct rt_map	Rt_map;
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
    61
typedef struct slookup	Slookup;
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
    62
typedef struct sresult	Sresult;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    63
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    64
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    65
 * A binding descriptor.  Establishes the binding relationship between two
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
    66
 * objects, the caller (originator) and the dependency (destination).
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    67
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    68
 * Every relationship between two objects is tracked by a binding descriptor.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    69
 * This descriptor is referenced from a link-map's DEPENDS and CALLERS lists.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    70
 * Note, Aplist's are diagramed to fully expose the allocations required to
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    71
 * establish the data structure relationships.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    72
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    73
 *                                  Bnd_desc
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    74
 *                                 ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    75
 *                    ------------| b_caller |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    76
 *                   |            | b_depend | ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    77
 *                   |            |          |           |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    78
 *      Rt_map       |             ----------            |       Rt_map
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    79
 *    ----------     |                ^ ^                |     ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    80
 *   |          | <--                 | |                 --> |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    81
 *   |          |        --------     | |                     |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    82
 *   | DEPENDS  | ----> |        |    | |     --------        |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    83
 *   |          |       |        |    | |    |        | <---- | CALLERS  |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    84
 *   |          |       |        | ---  |    |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    85
 *   |          |       |        |       --- |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    86
 *   |          |        --------            |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    87
 *    ----------          Aplist              --------         ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
    88
 *                                             Aplist
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    89
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    90
typedef struct {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    91
	Rt_map		*b_caller;	/* caller (originator) of a binding */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    92
	Rt_map		*b_depend;	/* dependency (destination) of a */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    93
					/*	binding */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    94
	uint_t		b_flags;	/* relationship of caller to the */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    95
					/*	dependency */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    96
} Bnd_desc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    97
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    98
#define	BND_NEEDED	0x0001		/* caller NEEDED the dependency */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    99
#define	BND_REFER	0x0002		/* caller relocation references the */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   100
					/*	dependency */
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   101
#define	BND_FILTER	0x0004		/* binding identifies filter, used */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   102
					/*	for diagnostics only */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   103
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   104
 * Private structure for communication between rtld_db and rtld.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   105
 *
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   106
 * We must bump the version number when ever an update in one of the
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   107
 * structures/fields that rtld_db reads is updated.  This hopefully permits
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   108
 * rtld_db implementations of the future to recognize core files produced on
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   109
 * older systems and deal with these core files accordingly.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   110
 *
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   111
 * As of version 'R_RTLDDB_VERSION <= 2' the following fields were valid for
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   112
 * core file examination (basically the public Link_map):
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   113
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   114
 *		ADDR()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   115
 *		NAME()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   116
 *		DYN()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   117
 *		NEXT()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   118
 *		PREV()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   119
 *
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   120
 * Valid fields for R_RTLDDB_VERSION3
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   121
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   122
 *		PATHNAME()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   123
 *		PADSTART()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   124
 *		PADIMLEN()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   125
 *		MSIZE()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   126
 *		FLAGS()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   127
 *		FLAGS1()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   128
 *
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   129
 * Valid fields for R_RTLDDB_VERSION4
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   130
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   131
 *		TLSMODID()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   132
 *
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   133
 * Valid fields for R_RTLDDB_VERSION5
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   134
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   135
 *		Added rtld_flags & FLG_RT_RELOCED to stable flags range
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   136
 *
10167
4c8fee5f1d6a 6862967 rd_loadobj_iter() failing for core files
Rod Evans <Rod.Evans@Sun.COM>
parents: 9963
diff changeset
   137
 * Valid fields for R_RTLDDB_VERSION6
4c8fee5f1d6a 6862967 rd_loadobj_iter() failing for core files
Rod Evans <Rod.Evans@Sun.COM>
parents: 9963
diff changeset
   138
 *
4c8fee5f1d6a 6862967 rd_loadobj_iter() failing for core files
Rod Evans <Rod.Evans@Sun.COM>
parents: 9963
diff changeset
   139
 *		rtd_dynlmlst converted from a List to APlist
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   140
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   141
#define	R_RTLDDB_VERSION1	1	/* base version level - used for core */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   142
					/*	file examination */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   143
#define	R_RTLDDB_VERSION2	2	/* minor revision - not relevant for */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   144
					/*	core files */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   145
#define	R_RTLDDB_VERSION3	3
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   146
#define	R_RTLDDB_VERSION4	4
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   147
#define	R_RTLDDB_VERSION5	5
10167
4c8fee5f1d6a 6862967 rd_loadobj_iter() failing for core files
Rod Evans <Rod.Evans@Sun.COM>
parents: 9963
diff changeset
   148
#define	R_RTLDDB_VERSION6	6
4c8fee5f1d6a 6862967 rd_loadobj_iter() failing for core files
Rod Evans <Rod.Evans@Sun.COM>
parents: 9963
diff changeset
   149
#define	R_RTLDDB_VERSION	R_RTLDDB_VERSION6	/* current version */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   150
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   151
typedef struct rtld_db_priv {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   152
	struct r_debug	rtd_rdebug;	/* original r_debug structure */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   153
	Word		rtd_version;	/* version no. */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   154
	size_t		rtd_objpad;	/* padding around mmap()ed objects */
9131
d7741cc87056 6801536 ld: mapfile processing oddities unveiled through mmapobj(2) observations
Rod Evans <Rod.Evans@Sun.COM>
parents: 8598
diff changeset
   155
	APlist		**rtd_dynlmlst;	/* pointer to dynlm_list pointer */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   156
} Rtld_db_priv;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   157
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   158
#ifdef _SYSCALL32
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   159
typedef struct rtld_db_priv32 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   160
	struct r_debug32 rtd_rdebug;	/* original r_debug structure */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   161
	Elf32_Word	rtd_version;	/* version no. */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   162
	Elf32_Word	rtd_objpad;	/* padding around mmap()ed objects */
9131
d7741cc87056 6801536 ld: mapfile processing oddities unveiled through mmapobj(2) observations
Rod Evans <Rod.Evans@Sun.COM>
parents: 8598
diff changeset
   163
	Elf32_Addr	rtd_dynlmlst;	/* pointer to dynlm_list */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   164
} Rtld_db_priv32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   165
#endif	/* _SYSCALL32 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   166
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   167
/*
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   168
 * External function definitions.  ld.so.1 must convey information to libc in
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   169
 * regards to threading.  libc also provides routines for atexit() and message
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   170
 * localization.  libc provides the necessary interfaces via its RTLDINFO
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   171
 * structure and/or later _ld_libc() calls.
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   172
 *
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   173
 * These external functions are maintained for each link-map list, and used
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   174
 * where appropriate.  The functions are associated with the object that
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   175
 * provided them, so that should the object be deleted (say, from an alternative
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   176
 * link-map), the functions can be removed.
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   177
 */
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   178
typedef struct {
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   179
	Rt_map	*lc_lmp;			/* function provider */
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   180
	union {
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   181
		int		(*lc_func)();	/* external function pointer */
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   182
		uintptr_t	lc_val;		/* external value */
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   183
		char    	*lc_ptr;	/* external character pointer */
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   184
	} lc_un;
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   185
} Lc_desc;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   186
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   187
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   188
 * Link map list definition.  Link-maps are used to describe each loaded object.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   189
 * Lists of these link-maps describe the various namespaces within a process.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   190
 * The process executable and its dependencies are maintained on the lml_main
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   191
 * list.  The runtime linker, and its dependencies are maintained on the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   192
 * lml_rtld list.  Additional lists can be created (see dlmopen()) for such
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   193
 * things as auditors and their dependencies.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   194
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   195
 * Each link-map list maintains an Alist of one, or more, linked lists of
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   196
 * link-maps.  For backward compatibility, the lm_head/lm_tail elements are
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   197
 * initialized to the first linked-list of link-maps:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   198
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   199
 *      Lm_list
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   200
 *    ----------
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   201
 *   | lm_tail  | ------------------------------------
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   202
 *   | lm_head  | --------------------                |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   203
 *   |          |                     |     Rt_map    |     Rt_map
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   204
 *   |          |                     |     ------    |     ------
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   205
 *   |          |          Alist       --> |      |   |--> |      |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   206
 *   |          |        ---------    |    |      | --     |      |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   207
 *   | lm_lists | ----> |         |   |    |      |    --> |      |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   208
 *   |          |       |---------|   |    |      |   |    |      |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   209
 *   |          |       | lc_head | --      ------    |     ------
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   210
 *   |          |       | lc_tail | ------------------
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   211
 *   |          |       |---------|
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   212
 *    ----------        | lc_head |
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   213
 *                      | lc_tail |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   214
 *                      |---------|
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   215
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   216
 * Multiple link-map lists exist to support the addition of lazy loaded
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   217
 * families, filtee families, and dlopen() families.  The intent of these
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   218
 * lists is to insure that a family of objects that are to be loaded are
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   219
 * fully relocatable, and hence usable, before they become part of the main
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   220
 * (al_data[0]) link-map control list.  This main link-map control list is
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   221
 * the only list in existence when control is transferred to user code.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   222
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   223
 * During process initialization, the dynamic executable and its non-lazy
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   224
 * dependencies are maintained on al_data[0].  If a new object is loaded, then
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   225
 * this object is added to the next available control list [1], typically
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   226
 * al_data[1].  Any dependencies of this object that have not already been
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   227
 * loaded are added to the same control list.  Once all of the objects on the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   228
 * new control list have been successfully relocated, the objects are moved from
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   229
 * the new control list to the highest control list to which objects of the new
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   230
 * control list bound to, typically al_data[1] to al_data[0].
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   231
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   232
 * Each loading scenario can be broken down as follows:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   233
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   234
 *  setup() - only the initial link-map control list is used:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   235
 *   i.	  create al_data[0]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   236
 *   ii.  add new link-map for main on al_data[0]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   237
 *   iii. analyze al_data[0] to add all non-lazy dependencies
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   238
 *   iv.  relocate al_data[0] dependencies.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   239
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   240
 *  dlopen() - the initiator can only be the initial link-map control list:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   241
 *   i.   create al_data[1] from caller al_data[0]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   242
 *   ii.  add new link-map for the dlopen'ed object on al_data[1]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   243
 *   iii. analyze al_data[1] to add all non-lazy dependencies
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   244
 *   iv.  relocate al_data[1] dependencies, and move to al_data[0].
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   245
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   246
 *  filtee and lazy loading processing - the initiator can be any link-map
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   247
 *  control list that is being relocated:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   248
 *   i.   create al_data[y] from caller al_data[x]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   249
 *   ii.  add new link-map for the new object on al_data[y]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   250
 *   iii. analyze al_data[y] to add all non-lazy dependencies
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   251
 *   iv.  relocate al_data[y] dependencies, and move to al_data[x].
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   252
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   253
 * This Alist therefore maintains a stack of link-map control lists.  The newest
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   254
 * link-map control list can locate symbols within any of the former lists,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   255
 * however, control is not passed to a former list until the newest lists
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   256
 * processing is complete.  Thus, objects can't bind to new objects until they
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   257
 * have been fully analyzed and relocated.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   258
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   259
 * [1]  Note, additional link-map control list creation occurs after the head
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   260
 * link-map object (typically the dynamic executable) has been relocated.  This
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   261
 * staging is required to satisfy the binding requirements of copy relocations.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   262
 * Copy relocations, effectively, transfer the bindings of the copied data
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   263
 * (say _iob in libc.so.1) to the copy location (_iob in the application).
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   264
 * Thus an object that might bind to the original copy data must be redirected
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   265
 * to the copy reference.  As the knowledge of a copy relocation having taken
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   266
 * place is only known after relocating the application, link-map control list
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   267
 * additions are suspended until after this relocation has completed.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   268
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   269
typedef struct {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   270
	Rt_map		*lc_head;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   271
	Rt_map		*lc_tail;
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   272
	APlist		*lc_now;	/* pending promoted bind-now objects */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   273
	uint_t		lc_flags;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   274
} Lm_cntl;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   275
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   276
#define	LMC_FLG_ANALYZING	0x01	/* control list is being analyzed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   277
#define	LMC_FLG_RELOCATING	0x02	/* control list is being relocated */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   278
#define	LMC_FLG_REANALYZE	0x04	/* repeat analysis (established when */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   279
					/*	interposers are added */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   280
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   281
struct lm_list {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   282
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   283
	 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   284
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   285
	Rt_map		*lm_head;	/* linked list pointers to active */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   286
	Rt_map		*lm_tail;	/*	link-map list */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   287
	APlist		*lm_handle;	/* not used by rtld_db - but spacing */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   288
					/*	is required for flags */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   289
	Word		lm_flags;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   290
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   291
	 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   292
	 */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   293
	Alist		*lm_rti;	/* list of RTLDINFO tables */
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   294
	Audit_list	*lm_alp;	/* audit list descriptor */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   295
	avl_tree_t	*lm_fpavl;	/* avl tree of objects loaded */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   296
	Alist		*lm_lists;	/* active and pending link-map lists */
6
9049f50e2cc0 6276905 dlinfo gives inconsistent results (relative vs absolute linkname)
rie
parents: 0
diff changeset
   297
	char		***lm_environ;	/* pointer to environment array */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   298
	Word		lm_tflags;	/* transferable flags */
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   299
	uint_t		lm_obj;		/* total number of objs on link-map */
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   300
	uint_t		lm_init;	/* new obj since last init processing */
9963
d23f520cfd07 6853809 ld.so.1: rescan fallback optimization is invalid
Rod Evans <Rod.Evans@Sun.COM>
parents: 9577
diff changeset
   301
	uint_t		lm_lazy;	/* number of objects with pending */
d23f520cfd07 6853809 ld.so.1: rescan fallback optimization is invalid
Rod Evans <Rod.Evans@Sun.COM>
parents: 9577
diff changeset
   302
					/*	lazy dependencies */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   303
	uint_t		lm_tls;		/* new obj that require TLS */
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   304
	uint_t		lm_lmid;	/* unique link-map list identifier, */
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   305
	char		*lm_lmidstr;	/* and associated diagnostic string */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   306
	APlist		*lm_actaudit;	/* list of pending audit activity */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   307
	Lc_desc		lm_lcs[CI_MAX];	/* external libc functions */
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   308
};
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   309
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   310
#ifdef	_SYSCALL32
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   311
struct lm_list32 {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   312
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   313
	 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   314
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   315
	Elf32_Addr	lm_head;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   316
	Elf32_Addr	lm_tail;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   317
	Elf32_Addr	lm_handle;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   318
	Elf32_Word	lm_flags;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   319
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   320
	 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   321
	 */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   322
	Elf32_Addr	lm_rti;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   323
	Elf32_Addr	lm_fpavl;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   324
	Elf32_Addr	lm_lists;
6
9049f50e2cc0 6276905 dlinfo gives inconsistent results (relative vs absolute linkname)
rie
parents: 0
diff changeset
   325
	Elf32_Addr	lm_environ;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   326
	Elf32_Word	lm_tflags;
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   327
	uint_t		lm_obj;
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   328
	uint_t		lm_init;
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   329
	uint_t		lm_lazy;
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   330
	uint_t		lm_tls;
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   331
	uint_t		lm_lmid;
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   332
	Elf32_Addr	lm_lmidstr;
4679
3d9b5e6569cc PSARC/2007/413 Add -zglobalaudit option to ld
rie
parents: 3817
diff changeset
   333
	Elf32_Addr	lm_actaudit;
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   334
	Elf32_Addr	lm_lcs[CI_MAX];
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   335
};
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   336
#endif /* _SYSCALL32 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   337
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   338
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   339
 * Possible Link_map list flags (Lm_list.lm_flags)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   340
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   341
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   342
 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   343
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   344
#define	LML_FLG_BASELM		0x00000001	/* primary link-map */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   345
#define	LML_FLG_RTLDLM		0x00000002	/* rtld link-map */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   346
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   347
 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   348
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   349
#define	LML_FLG_NOAUDIT		0x00000004	/* symbol auditing disabled */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   350
#define	LML_FLG_PLTREL		0x00000008	/* deferred plt relocation */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   351
						/* 	initialization */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   352
						/*	(ld.so.1 only) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   353
#define	LML_FLG_HOLDLOCK	0x00000010	/* hold the rtld mutex lock */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   354
#define	LML_FLG_ENVIRON		0x00000020	/* environ var initialized */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   355
#define	LML_FLG_INTRPOSE	0x00000040	/* interposing objs on list */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   356
#define	LML_FLG_LOCAUDIT	0x00000080	/* local auditors exists for */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   357
						/*	this link-map list */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   358
#define	LML_FLG_LOADAVAIL	0x00000100	/* load anything available */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   359
#define	LML_FLG_IGNRELERR	0x00000200	/* ignore relocation errors - */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   360
						/*	internal for crle(1) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   361
#define	LML_FLG_DBNOTIF		0x00000400	/* binding activity going on */
280
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   362
#define	LML_FLG_STARTREL	0x00000800	/* relocation started */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   363
#define	LML_FLG_ATEXIT		0x00001000	/* atexit processing */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   364
#define	LML_FLG_OBJADDED	0x00002000	/* object(s) added */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   365
#define	LML_FLG_OBJDELETED	0x00004000	/* object(s) deleted */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   366
#define	LML_FLG_OBJREEVAL	0x00008000	/* existing object(s) needs */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   367
						/*	tsort reevaluation */
3817
e2aeb8ed177f 6533587 ld.so.1: init/fini processing needs to compensate for interposer expectations
rie
parents: 3787
diff changeset
   368
#define	LML_FLG_INTRPOSETSORT	0x00020000	/* interpose tsorting done */
4679
3d9b5e6569cc PSARC/2007/413 Add -zglobalaudit option to ld
rie
parents: 3817
diff changeset
   369
#define	LML_FLG_AUDITNOTIFY	0x00040000	/* audit consistent required */
5220
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
   370
#define	LML_FLG_GROUPSEXIST	0x00080000	/* local groups exist */
2850
689acf945b89 PSARC/2006/558 R_*_SIZE relocation support
rie
parents: 2145
diff changeset
   371
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   372
#define	LML_FLG_TRC_LDDSTUB	0x00100000	/* identify lddstub */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   373
#define	LML_FLG_TRC_ENABLE	0x00200000	/* tracing enabled (ldd) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   374
#define	LML_FLG_TRC_WARN	0x00400000	/* print warnings for undefs */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   375
#define	LML_FLG_TRC_VERBOSE	0x00800000	/* verbose (versioning) trace */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   376
#define	LML_FLG_TRC_SEARCH	0x01000000	/* trace search paths */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   377
#define	LML_FLG_TRC_UNREF	0x02000000	/* trace unreferenced */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   378
						/*	dependencies */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   379
#define	LML_FLG_TRC_UNUSED	0x04000000	/* trace unused dependencies */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   380
#define	LML_FLG_TRC_INIT	0x08000000	/* print .init order */
4947
e92895a4c96a PSARC/2007/474 new ldd(1) -w option
rie
parents: 4699
diff changeset
   381
#define	LML_FLG_TRC_NOUNRESWEAK	0x10000000	/* unresolved weak references */
e92895a4c96a PSARC/2007/474 new ldd(1) -w option
rie
parents: 4699
diff changeset
   382
						/*	are not allowed */
6150
bdc7a464af94 PSARC/2008/148: new ldd(1) -p option
rie
parents: 6117
diff changeset
   383
#define	LML_FLG_TRC_NOPAREXT	0x20000000	/* unresolved PARENT/EXTERN */
bdc7a464af94 PSARC/2008/148: new ldd(1) -p option
rie
parents: 6117
diff changeset
   384
						/*	references are not */
bdc7a464af94 PSARC/2008/148: new ldd(1) -p option
rie
parents: 6117
diff changeset
   385
						/*	allowed */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   386
#define	LML_MSK_TRC		0xfff00000	/* tracing mask */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   387
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   388
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   389
 * Possible Link_map transferable flags (Lm_list.lm_tflags), i.e., link-map
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   390
 * list flags that can be propagated to any new link-map list created.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   391
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   392
#define	LML_TFLG_NOLAZYLD	0x00000001	/* lazy loading disabled */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   393
#define	LML_TFLG_NODIRECT	0x00000002	/* direct bindings disabled */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   394
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   395
#define	LML_TFLG_LOADFLTR	0x00000008	/* trigger filtee loading */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   396
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   397
#define	LML_TFLG_AUD_PREINIT	0x00001000	/* preinit (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   398
#define	LML_TFLG_AUD_OBJSEARCH	0x00002000	/* objsearch (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   399
#define	LML_TFLG_AUD_OBJOPEN	0x00004000	/* objopen (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   400
#define	LML_TFLG_AUD_OBJFILTER	0x00008000	/* objfilter (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   401
#define	LML_TFLG_AUD_OBJCLOSE	0x00010000	/* objclose (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   402
#define	LML_TFLG_AUD_SYMBIND	0x00020000	/* symbind (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   403
#define	LML_TFLG_AUD_PLTENTER	0x00040000	/* pltenter (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   404
#define	LML_TFLG_AUD_PLTEXIT	0x00080000	/* pltexit (audit) exists */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   405
#define	LML_TFLG_AUD_ACTIVITY	0x00100000	/* activity (audit) exists */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   406
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   407
/*
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   408
 * NOTE: Each auditing module establishes a set of audit flags, AFLAGS(), that
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   409
 * define the auditing interfaces the module offers.  These auditing flags are
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   410
 * the LML_TFLG_AUD_ flags defined above.  Global auditors result in setting
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   411
 * the lm_tflags too.  Local auditors only use the AFLAGS().  All tests for
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   412
 * auditing inspect the lm_tflags and AFLAGS() for a specific auditing
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   413
 * interface, and thus use the same flag to test for both types of auditors.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   414
 */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   415
#define	LML_TFLG_AUD_MASK	0x0ffff000	/* audit interfaces mask */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   416
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   417
/*
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   418
 * Define a Group Handle.
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   419
 *
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   420
 * The capability of ld.so.1 to associate a group of objects, look for symbols
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   421
 * within that group, ensure that groups are isolated from one another (with
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   422
 * regard to relocations), and to unload a group, centers around a handle.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   423
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   424
 * Dependencies can be added to an existing handle as the dependencies are
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   425
 * lazily loaded.  The core dependencies on the handle are the ldd(1) list of
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   426
 * the referenced object.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   427
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   428
 * Handles can be created from:
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   429
 *
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   430
 *  -	a dlopen() request.  This associates a caller to a reference object,
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   431
 * 	and the referenced objects dependencies.  This group of objects can
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   432
 *	then be inspected for symbols (dlsym()).
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   433
 *  -	a filtering request.  This associates a filter (caller) to a referenced
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   434
 *	object (filtee).  The redirection of filter symbols to their filtee
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   435
 *	counterpart is essentially a dlsym() using the filtee's handle.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   436
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   437
 * The handle created for these events is referred to as a public handle.  This
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   438
 * handle tracks the referenced object, all of the dependencies of the
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   439
 * referenced object, and the caller (parent).
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   440
 *
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   441
 * Presently, an object may have two handles, one requested with RTLD_FIRST
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   442
 * and one without.
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   443
 *
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   444
 * A handle may be referenced by any number of callers (parents).  A reference
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   445
 * count tracks the number.  A dlclose() operation drops the reference count,
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   446
 * and when the count is zero, the handle is used to determine the family of
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   447
 * objects to unload.  As bindings may occur to objects on the handle from
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   448
 * other handles, it may not be possible to remove a complete family of objects
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   449
 * or the handle itself.  Handles in this state are moved to an orphan list.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   450
 * A handle on the orphan list is taken off the orphan list if the associated
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   451
 * object is reopened.  Otherwise, the handle remains on the orphan list for
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   452
 * the duration of the process.  The orphan list is inspected any time objects
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   453
 * are unloaded, to determine if the orphaned objects can also be unloaded.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   454
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   455
 * Handles can also be created for internal uses:
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   456
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   457
 *  -	to promote objects to RTLD_NOW.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   458
 *  -	to establish families for symbol binding fallback, required when lazy
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   459
 *	loadable objects are still pending.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   460
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   461
 * The handle created for these events is referred to as a private handle.  This
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   462
 * handle does not need to track the caller (parent), and because of this, does
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   463
 * not need to be considered during dlclose() operations, as the handle can not
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   464
 * be referenced by callers outside of the referenced objects family.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   465
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   466
 * Note, a private handle is essentially a subset of a public handle.  Should
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   467
 * an internal operation require a private handle, and a public handle already
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   468
 * exist, the public handle can be used.  Should an external operation require
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   469
 * a public handle, and a private handle exist, the private handle is promoted
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   470
 * to a public handle.  Any handle that gets created will remain in existence
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   471
 * for the life time of the referenced object.
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   472
 *
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   473
 * Objects can be dlopened using RTLD_NOW.  This attribute requires that all
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   474
 * relocations of the object, and its dependencies are processed immediately,
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   475
 * before return to the caller.  Typically, an object is loaded without
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   476
 * RTLD_NOW, and procedure linkage relocations are satisfied when their
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   477
 * associated function is first called.  If an object is already loaded, and an
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   478
 * RTLD_NOW request is made, then the object, and its dependencies, most undergo
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   479
 * additional relocation processing.   This promotion from lazy binding to
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   480
 * immediate binding is carried out using handles, as the handle defines the
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   481
 * dependencies that must be processed.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   482
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   483
 * To ensure that objects within a lazy loadable environment can be relocated,
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   484
 * no matter whether the objects have their dependencies described completely,
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   485
 * a symbol lookup fallback is employed.  Any pending lazy loadable objects are
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   486
 * loaded, and a handle established to search the object and it's dependencies
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   487
 * for the required symbol.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   488
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   489
 * A group handle (and its associated group descriptors), is referenced from
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   490
 * a link-map's HANDLES and GROUPS lists.  Note, Aplist's are diagramed to
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   491
 * fully expose the allocations required to establish the data structure
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   492
 * relationships.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   493
 *
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   494
 *                                  Grp_desc
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   495
 *                                   Alist
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   496
 *                                 -----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   497
 *                            --> |           |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   498
 *                           |    |-----------|
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   499
 *                           |    | gd_depend | ---------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   500
 *                           |    |           |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   501
 *                           |    |-----------|          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   502
 *                   --------|--- | gd_depend |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   503
 *                  |        |    | (parent)  |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   504
 *                  |        |    |-----------|          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   505
 *                  |        |    | gd_depend |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   506
 *                  |        |    |           |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   507
 *                  |        |    |           |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   508
 *                  |        |     -----------           |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   509
 *                  |        |                           |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   510
 *                  |        |      Grp_hdl              |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   511
 *                  |        |    -----------            |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   512
 *                  |         -- | gh_depends |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   513
 *                  |  --------- | gh_ownlmp  |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   514
 *                  | |          |            |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   515
 *                  | |          |            |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   516
 *                  | |          |            |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   517
 *      Rt_map      | |           ------------           |       Rt_map
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   518
 *    ----------    | |               ^ ^                |     ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   519
 *   |          | <-  |               | |                 --> |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   520
 *   |          | <---   --------     | |                     |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   521
 *   | HANDLES  | ----> |        |    | |     --------        |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   522
 *   |          |       |        |    | |    |        | <---- |  GROUPS  |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   523
 *   |          |       |        | ---  |    |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   524
 *   |          |       |        |       --- |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   525
 *   |          |        --------            |        |       |          |
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   526
 *    ----------          Aplist              --------         ----------
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   527
 *                                             Aplist
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   528
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   529
typedef struct {
1618
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   530
	Alist		*gh_depends;	/* handle dependency list */
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   531
	Rt_map		*gh_ownlmp;	/* handle owners link-map */
8c9a4f31d225 6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents: 502
diff changeset
   532
	Lm_list		*gh_ownlml;	/* handle owners link-map list */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   533
	uint_t		gh_refcnt;	/* handle reference count */
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   534
	uint_t		gh_flags;	/* handle flags (GPH_ values) */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   535
} Grp_hdl;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   536
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   537
/*
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   538
 * Define the two categories of handle.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   539
 */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   540
#define	GPH_PUBLIC	0x0001		/* handle returned to caller(s) */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   541
#define	GPH_PRIVATE	0x0002		/* handle used internally */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   542
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   543
/*
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   544
 * Define any flags that affects how the handle is used.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   545
 */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   546
#define	GPH_ZERO	0x0010		/* special handle for dlopen(0) */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   547
#define	GPH_LDSO	0x0020		/* special handle for ld.so.1 */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   548
#define	GPH_FIRST	0x0040		/* dlsym() can only use originating */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   549
					/*	dependency */
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   550
#define	GPH_FILTEE	0x0080		/* handle identifies a filtee, used */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   551
					/*	for diagnostics only */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   552
/*
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   553
 * Define any state that is associated with the handle.
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   554
 */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   555
#define	GPH_INITIAL	0x0100		/* handle is initialized */
9963
d23f520cfd07 6853809 ld.so.1: rescan fallback optimization is invalid
Rod Evans <Rod.Evans@Sun.COM>
parents: 9577
diff changeset
   556
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   557
/*
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   558
 * Define a Group Descriptor.
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   559
 *
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   560
 * Each dependency associated with a group handle is maintained by a group
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   561
 * descriptor.  The descriptor defines the associated dependency together with
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   562
 * flags that indicate how the dependency can be used.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   563
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   564
typedef struct {
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   565
	Rt_map		*gd_depend;	/* dependency */
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   566
	uint_t		gd_flags;	/* dependency flags (GPD_ values) */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   567
} Grp_desc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   568
4699
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   569
#define	GPD_DLSYM	0x0001		/* dependency available to dlsym() */
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   570
#define	GPD_RELOC	0x0002		/* dependency available to satisfy */
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   571
					/*	relocation binding */
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   572
#define	GPD_ADDEPS	0x0004		/* dependencies of this dependency */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   573
					/*	should be added to handle */
4699
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   574
#define	GPD_PARENT	0x0008		/* dependency is a parent */
ba3c3e75e70c 6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
rie
parents: 4679
diff changeset
   575
#define	GPD_FILTER	0x0010		/* dependency is our filter */
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   576
#define	GPD_REMOVE	0x0100		/* descriptor is a candidate for */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   577
					/*	removal from the group */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   578
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   579
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   580
 * Define threading structures.  For compatibility with libthread (T1_VERSION 1
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   581
 * and TI_VERSION 2) our locking structure is sufficient to hold a mutex or a
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   582
 * readers/writers lock.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   583
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   584
typedef struct {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   585
	union {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   586
		mutex_t		l_mutex;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   587
		rwlock_t	l_rwlock;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   588
	} u;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   589
} Rt_lock;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   590
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   591
typedef	cond_t	Rt_cond;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   592
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   593
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   594
 * Define a dynamic section information descriptor.  This parallels the entries
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   595
 * in the .dynamic section and holds auxiliary information to implement lazy
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   596
 * loading and filtee processing.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   597
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   598
typedef struct {
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   599
	uint_t		di_flags;
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   600
	void		*di_info;
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   601
	const char	*di_name;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   602
} Dyninfo;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   603
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   604
#define	FLG_DI_STDFLTR	0x00001		/* .dynamic entry for DT_FILTER */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   605
#define	FLG_DI_AUXFLTR	0x00002		/* .dynamic entry for DT_AUXILIARY */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   606
#define	FLG_DI_SYMFLTR	0x00004		/* .dynamic entry for DT_SYMFILTER */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   607
					/*	and DT_SYMAUXILIARY */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   608
#define	MSK_DI_FILTER	0x0000f		/* mask for all filter possibilities */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   609
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
   610
#define	FLG_DI_POSFLAG1	0x00010		/* .dynamic entry for DT_POSFLAG_1 */
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
   611
#define	FLG_DI_NEEDED	0x00020		/* .dynamic entry for DT_NEEDED */
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   612
#define	FLG_DI_REGISTER	0x00040		/* .dynamic entry for DT_REGISTER */
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   613
#define	FLG_DI_IGNORE	0x00080		/* .dynamic entry should be ignored */
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   614
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   615
#define	FLG_DI_LAZY	0x00100		/* lazy needed entry, preceded by */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
   616
					/*    DF_P1_LAZYLOAD (DT_POSFLAG_1) */
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   617
#define	FLG_DI_GROUP	0x00200		/* group needed entry, preceded by */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
   618
					/*    DF_P1_GROUPPERM (DT_POSFLAG_1) */
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   619
#define	FLG_DI_DEFERRED	0x00400		/* deferred needed entry, preceded by */
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   620
					/*    DF_P1_DEFERRED (DT_POSFLAG_1) */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   621
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   622
#define	FLG_DI_LAZYFAIL	0x01000		/* the lazy loading of this entry */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
   623
					/*    failed */
12449
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   624
#define	FLG_DI_LDD_DONE	0x02000		/* entry has been processed (ldd) */
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   625
#define	FLG_DI_DEF_DONE	0x04000		/* entry has been processed (dlinfo) */
a87750d92895 6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents: 11827
diff changeset
   626
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   627
/*
6387
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   628
 * Data structure to track AVL tree of pathnames.  This structure provides the
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   629
 * basis of both the "not-found" node tree, and the "full-path" node tree.  Both
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   630
 * of these trees persist for the life of a process, although the "not-found"
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   631
 * tree may be moved aside during a dlopen() or dlsym() fall back operation.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   632
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   633
typedef struct {
6387
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   634
	const char	*pn_name;	/* path name */
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   635
	avl_node_t	pn_avl;		/* avl book-keeping (see SGSOFFSETOF) */
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   636
	uint_t		pn_hash;	/* path name hash value */
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   637
} PathNode;
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   638
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   639
/*
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   640
 * Data structure to track AVL tree for full path names of objects that are
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   641
 * loaded into memory.
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   642
 */
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   643
typedef struct {
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   644
	PathNode	fpn_node;	/* path node */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   645
	Rt_map		*fpn_lmp;	/* object link-map */
6387
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
   646
} FullPathNode;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   647
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   648
/*
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   649
 * A given link-map can hold either a supplier or receiver copy
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   650
 * relocation list, but not both. This union is used to overlap
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   651
 * the space used for the two lists.
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   652
 */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   653
typedef union {
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   654
	Alist	*rtc_r;		/* receiver list (Rel_copy) */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   655
	APlist	*rtc_s;		/* supplier list (Rt_map *) */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   656
} Rt_map_copy;
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   657
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   658
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   659
/*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   660
 * Link-map definition.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   661
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   662
struct rt_map {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   663
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   664
	 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   665
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   666
	Link_map	rt_public;	/* public data */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   667
	const char	*rt_pathname;	/* full pathname of loaded object */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   668
	ulong_t		rt_padstart;	/* start of image (including padding) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   669
	ulong_t		rt_padimlen;	/* size of image (including padding */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   670
	ulong_t		rt_msize;	/* total memory reservation range */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   671
	uint_t		rt_flags;	/* state flags, see FLG below */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   672
	uint_t		rt_flags1;	/* state flags1, see FL1 below */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   673
	ulong_t		rt_tlsmodid;	/* TLS module id */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   674
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   675
	 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   676
	 */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   677
	APlist		*rt_alias;	/* list of linked file names */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   678
	APlist		*rt_fpnode;	/* list of FullPathNode AVL nodes */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   679
	char		*rt_runpath;	/* LD_RUN_PATH and its equivalent */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   680
	Alist		*rt_runlist;	/*	Pdesc structures */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   681
	APlist		*rt_depends;	/* list of dependencies */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   682
	APlist		*rt_callers;	/* list of callers */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   683
	APlist		*rt_handles;	/* dlopen handles */
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   684
	APlist		*rt_groups;	/* groups we're a member of */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   685
	struct fct	*rt_fct;	/* file class table for this object */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   686
	void		*rt_priv;	/* private data, object type specific */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   687
	Lm_list		*rt_list;	/* link map list we belong to */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   688
	uint_t		rt_objfltrndx;	/* object filtees .dynamic index */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   689
	uint_t		rt_symsfltrcnt;	/* number of standard symbol filtees */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   690
	uint_t		rt_symafltrcnt;	/* number of auxiliary symbol filtees */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   691
	int		rt_mode;	/* usage mode, see RTLD mode flags */
280
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   692
	int		rt_sortval;	/* temporary buffer to traverse graph */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   693
	uint_t		rt_cycgroup;	/* cyclic group */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   694
	dev_t		rt_stdev;	/* device id and inode number for .so */
8394
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   695
	rtld_ino_t	rt_stino;	/*	multiple inclusion checks */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   696
	const char	*rt_origname;	/* original pathname of loaded object */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   697
	size_t		rt_dirsz;	/*	and its size */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   698
	size_t		rt_lmsize;	/* size of the link-map allocation */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   699
	Rt_map_copy	rt_copy;	/* list of copy relocations */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   700
	Audit_desc	*rt_auditors;	/* audit descriptor array */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   701
	Audit_info	*rt_audinfo;	/* audit information descriptor */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   702
	Syminfo		*rt_syminfo;	/* elf .syminfo section - here */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   703
					/*	because it is checked in */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   704
					/*	common code */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   705
	Addr		*rt_initarray;	/* .initarray table */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   706
	Addr		*rt_finiarray;	/* .finiarray table */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   707
	Addr		*rt_preinitarray; /* .preinitarray table */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   708
	mmapobj_result_t *rt_mmaps;	/* array of mapping information */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   709
	uint_t		rt_mmapcnt;	/*	and associated number */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   710
	uint_t		rt_initarraysz;	/* size of .initarray table */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   711
	uint_t		rt_finiarraysz;	/* size of .finiarray table */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   712
	uint_t		rt_preinitarraysz; /* size of .preinitarray table */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   713
	Dyninfo		*rt_dyninfo;	/* .dynamic information descriptors */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   714
	uint_t		rt_dyninfocnt;	/* count of dyninfo entries */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   715
	uint_t		rt_relacount;	/* no. of RELATIVE relocations */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   716
	uint_t		rt_idx;		/* hold index within linkmap list */
9963
d23f520cfd07 6853809 ld.so.1: rescan fallback optimization is invalid
Rod Evans <Rod.Evans@Sun.COM>
parents: 9577
diff changeset
   717
	uint_t		rt_lazy;	/* number of lazy dependencies */
d23f520cfd07 6853809 ld.so.1: rescan fallback optimization is invalid
Rod Evans <Rod.Evans@Sun.COM>
parents: 9577
diff changeset
   718
					/*	pending */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   719
	Cap		*rt_cap;	/* capabilities data */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   720
	Capchain	*rt_capchain;	/* capabilities chain data */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   721
	uint_t		rt_cntl;	/* link-map control list we belong to */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   722
	uint_t		rt_aflags;	/* auditor flags, see LML_TFLG_AUD_ */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   723
					/* address of _init */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   724
	void		(*rt_init)(void);
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   725
					/* address of _fini */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   726
	void		(*rt_fini)(void);
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   727
					/* link map symbol interpreter */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   728
	int		(*rt_symintp)(Slookup *, Sresult *, uint_t *, int *);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   729
};
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   730
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   731
#ifdef _SYSCALL32
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   732
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   733
 * Structure to allow 64-bit rtld_db to read 32-bit processes out of procfs.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   734
 */
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   735
typedef union {
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   736
	uint32_t	rtc_r;
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   737
	uint32_t	rtc_s;
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   738
} Rt_map_copy32;
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   739
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   740
typedef struct rt_map32 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   741
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   742
	 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   743
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   744
	Link_map32	rt_public;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   745
	uint32_t	rt_pathname;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   746
	uint32_t	rt_padstart;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   747
	uint32_t	rt_padimlen;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   748
	uint32_t	rt_msize;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   749
	uint32_t	rt_flags;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   750
	uint32_t	rt_flags1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   751
	uint32_t	rt_tlsmodid;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   752
	/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   753
	 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   754
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   755
	uint32_t	rt_alias;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   756
	uint32_t	rt_fpnode;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   757
	uint32_t	rt_runpath;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   758
	uint32_t	rt_runlist;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   759
	uint32_t	rt_depends;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   760
	uint32_t	rt_callers;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   761
	uint32_t	rt_handles;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   762
	uint32_t	rt_groups;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   763
	uint32_t	rt_fct;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   764
	uint32_t	rt_priv;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   765
	uint32_t 	rt_list;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   766
	uint32_t 	rt_objfltrndx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   767
	uint32_t 	rt_symsfltrcnt;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   768
	uint32_t 	rt_symafltrcnt;
280
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   769
	int32_t		rt_mode;
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   770
	int32_t		rt_sortval;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   771
	uint32_t	rt_cycgroup;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   772
	uint32_t	rt_stdev;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   773
	uint32_t	rt_stino;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   774
	uint32_t	rt_origname;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   775
	uint32_t	rt_dirsz;
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   776
	Rt_map_copy32	rt_copy;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   777
	uint32_t 	rt_auditors;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   778
	uint32_t 	rt_audinfo;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   779
	uint32_t	rt_syminfo;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   780
	uint32_t	rt_initarray;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   781
	uint32_t	rt_finiarray;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   782
	uint32_t	rt_preinitarray;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   783
	uint32_t	rt_mmaps;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   784
	uint32_t	rt_mmapcnt;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   785
	uint32_t	rt_initarraysz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   786
	uint32_t	rt_finiarraysz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   787
	uint32_t	rt_preinitarraysz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   788
	uint32_t 	rt_dyninfo;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   789
	uint32_t 	rt_dyninfocnt;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   790
	uint32_t	rt_relacount;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   791
	uint32_t	rt_idx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   792
	uint32_t	rt_lazy;
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   793
	uint32_t	rt_cap;
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   794
	uint32_t	rt_capchain;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   795
	uint32_t	rt_cntl;
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   796
	uint32_t	rt_aflags;
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   797
	uint32_t 	rt_init;
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   798
	uint32_t	rt_fini;
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   799
	uint32_t	rt_symintp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   800
} Rt_map32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   801
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   802
#endif	/* _SYSCALL32 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   803
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   804
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   805
 * Link map state flags.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   806
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   807
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   808
 * BEGIN: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   809
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   810
#define	FLG_RT_ISMAIN	0x00000001	/* object represents main executable */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   811
#define	FLG_RT_IMGALLOC	0x00000002	/* image is allocated (not mmap'ed) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   812
	/*
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   813
	 * Available for r_debug version >= R_RTLDDB_VERSION5
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   814
	 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   815
#define	FLG_RT_RELOCED	0x00000004	/* object has been relocated */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   816
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   817
 * END: Exposed to rtld_db - don't move, don't delete
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   818
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   819
#define	FLG_RT_SETGROUP	0x00000008	/* group establishment required */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   820
#define	FLG_RT_CAP	0x00000010	/* process $CAPABILITY expansion */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   821
#define	FLG_RT_OBJECT	0x00000020	/* object processing (ie. .o's) */
64
c7fd7a5492d7 6280467 dlclose() unmaps shared library before library's _fini() has finished
rie
parents: 6
diff changeset
   822
#define	FLG_RT_NEWLOAD	0x00000040	/* object is newly loaded */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   823
#define	FLG_RT_NODUMP	0x00000080	/* object can't be dldump(3x)'ed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   824
#define	FLG_RT_DELETE	0x00000100	/* object can be deleted */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   825
#define	FLG_RT_ANALYZED	0x00000200	/* object has been analyzed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   826
#define	FLG_RT_INITDONE	0x00000400	/* objects .init has been completed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   827
#define	FLG_RT_TRANS	0x00000800	/* object is acting as a translator */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   828
#define	FLG_RT_FIXED	0x00001000	/* image location is fixed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   829
#define	FLG_RT_PRELOAD	0x00002000	/* object was preloaded */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   830
#define	FLG_RT_ALTER	0x00004000	/* alternative object used */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   831
#define	FLG_RT_LOADFLTR	0x00008000	/* trigger filtee loading */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   832
#define	FLG_RT_AUDIT	0x00010000	/* object is an auditor */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   833
#define	FLG_RT_MODESET	0x00020000	/* MODE() has been initialized */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   834
#define	FLG_RT_ANALZING	0x00040000	/* object is being analyzed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   835
#define	FLG_RT_INITFRST 0x00080000	/* execute .init first */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   836
#define	FLG_RT_NOOPEN	0x00100000	/* dlopen() not allowed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   837
#define	FLG_RT_FINICLCT	0x00200000	/* fini has been collected (tsort) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   838
#define	FLG_RT_INITCALL	0x00400000	/* objects .init has been called */
8159
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   839
#define	FLG_RT_OBJINTPO	0x00800000	/* object is a global interposer */
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   840
#define	FLG_RT_SYMINTPO	0x01000000	/* object contains symbol interposer */
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   841
#define	MSK_RT_INTPOSE	0x01800000	/* mask for all interposer */
3466
4cc6ca6917b5 PSARC/2006/714 ld(1) mapfile: symbol interpose definition
rie
parents: 2850
diff changeset
   842
					/*	possibilities */
8159
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   843
#define	FLG_RT_MOVE	0x02000000	/* object needs move operation */
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   844
#define	FLG_RT_RELOCING	0x04000000	/* object is being relocated */
8159
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   845
#define	FLG_RT_REGSYMS	0x08000000	/* object has DT_REGISTER entries */
89ffa23f2543 6736890 PT_SUNWBSS should be disabled
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6387
diff changeset
   846
#define	FLG_RT_INITCLCT	0x10000000	/* init has been collected (tsort) */
9577
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   847
#define	FLG_RT_PUBHDL	0x20000000	/* generate a handle for this object */
dca915fd85d3 6831308 ld.so.1: symbol rescanning does a little too much work
Rod Evans <Rod.Evans@Sun.COM>
parents: 9131
diff changeset
   848
#define	FLG_RT_PRIHDL	0x40000000	/*	either public or private */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   849
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   850
#define	FL1_RT_COPYTOOK	0x00000001	/* copy relocation taken */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   851
#define	FL1_RT_ALTCHECK	0x00000002	/* alternative system capabilities */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   852
					/*	checked */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   853
#define	FL1_RT_ALTCAP	0x00000004	/* alternative system capabilities */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   854
					/*	should be used */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   855
#define	FL1_RT_CONFSET	0x00000008	/* object was loaded by crle(1) */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   856
#define	FL1_RT_NODEFLIB	0x00000010	/* ignore default library search */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   857
#define	FL1_RT_ENDFILTE	0x00000020	/* filtee terminates filters search */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   858
#define	FL1_RT_DISPREL	0x00000040	/* object has *disp* relocation */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   859
#define	FL1_RT_DTFLAGS	0x00000080	/* DT_FLAGS element exists */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   860
#define	FL1_RT_LDDSTUB	0x00000100	/* identify lddstub */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   861
#define	FL1_RT_NOINIFIN	0x00000200	/* no .init or .fini exists */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   862
#define	FL1_RT_USED	0x00000400	/* symbol referenced from this object */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   863
#define	FL1_RT_SYMBOLIC	0x00000800	/* DF_SYMBOLIC was set - use */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   864
					/*	symbolic sym resolution */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   865
#define	FL1_RT_OBJSFLTR	0x00001000	/* object is acting as a standard */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   866
#define	FL1_RT_OBJAFLTR	0x00002000	/*	or auxiliary filter */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   867
#define	FL1_RT_SYMSFLTR	0x00004000	/* symbol is acting as a standard */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   868
#define	FL1_RT_SYMAFLTR	0x00008000	/*	or auxiliary filter */
5067
d64dc195fe92 6603313 dlclose() can fail to unload objects after fix for 6573641
rie
parents: 4947
diff changeset
   869
#define	MSK_RT_FILTER	0x0000f000	/* mask for all filter possibilities */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   870
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   871
#define	FL1_RT_TLSADD	0x00010000	/* objects TLS has been registered */
2145
f3828f946507 6423051 static TLS support within the link-editors needs a major face lift
rie
parents: 1824
diff changeset
   872
#define	FL1_RT_TLSSTAT	0x00020000	/* object requires static TLS */
3466
4cc6ca6917b5 PSARC/2006/714 ld(1) mapfile: symbol interpose definition
rie
parents: 2850
diff changeset
   873
#define	FL1_RT_DIRECT	0x00040000	/* object has DIRECT bindings enabled */
4679
3d9b5e6569cc PSARC/2007/413 Add -zglobalaudit option to ld
rie
parents: 3817
diff changeset
   874
#define	FL1_RT_GLOBAUD	0x00080000	/* establish global auditing */
1824
9cc314774a20 6262333 init section of .so dlopened from audit interface not being called
rie
parents: 1618
diff changeset
   875
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   876
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   877
 * Flags for the tls_modactivity() routine
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   878
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   879
#define	TM_FLG_MODADD	0x01		/* call tls_modadd() interface */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   880
#define	TM_FLG_MODREM	0x02		/* call tls_modrem() interface */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   881
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   882
/*
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   883
 * Macros for getting to exposed, link_map data (R_RTLDDB_VERSION <= 2).
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   884
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   885
#define	ADDR(X)		((X)->rt_public.l_addr)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   886
#define	NAME(X)		((X)->rt_public.l_name)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   887
#define	DYN(X)		((X)->rt_public.l_ld)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   888
#define	NEXT(X)		((X)->rt_public.l_next)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   889
#define	PREV(X)		((X)->rt_public.l_prev)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   890
#define	REFNAME(X)	((X)->rt_public.l_refname)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   891
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   892
/*
8394
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   893
 * An Rt_map starts with a Link_map, followed by other information.
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   894
 * ld.so.1 allocates Rt_map structures, and then casts them to Link_map,
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   895
 * and back, depending on context.
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   896
 *
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   897
 * On some platforms, Rt_map can have a higher alignment requirement
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   898
 * than Link_map. On such platforms, the cast from Link_map to Rt_map will
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   899
 * draw an E_BAD_PTR_CAST_ALIGN warning from lint. Since we allocate
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   900
 * the memory as the higher alignment Rt_map, we know that this is a safe
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   901
 * conversion. The LINKMAP_TO_RTMAP macro is used to handle the conversion
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   902
 * in a manner that satisfies lint.
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   903
 */
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   904
#ifdef lint
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   905
#define	LINKMAP_TO_RTMAP(X)	(Rt_map *)(void *)(X)
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   906
#else
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   907
#define	LINKMAP_TO_RTMAP(X)	(Rt_map *)(X)
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   908
#endif
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   909
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   910
/*
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   911
 * Convenience macros for the common case of using
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   912
 * NEXT()/PREV() and casting the result to (Rt_map *)
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   913
 */
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   914
#define	NEXT_RT_MAP(X)	LINKMAP_TO_RTMAP(NEXT(X))
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   915
#define	PREV_RT_MAP(X)	LINKMAP_TO_RTMAP(PREV(X))
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   916
cfddc4c3786c 6782597 32-bit ld.so.1 needs to accept objects with large inode number
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 8388
diff changeset
   917
/*
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   918
 * Macros for getting to exposed, link_map data (R_RTLDDB_VERSION3).
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   919
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   920
#define	PATHNAME(X)	((X)->rt_pathname)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   921
#define	PADSTART(X)	((X)->rt_padstart)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   922
#define	PADIMLEN(X)	((X)->rt_padimlen)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   923
#define	MSIZE(X)	((X)->rt_msize)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   924
#define	FLAGS(X)	((X)->rt_flags)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   925
#define	FLAGS1(X)	((X)->rt_flags1)
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   926
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   927
/*
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   928
 * Macros for getting to exposed, link_map data (R_RTLDDB_VERSION4).
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   929
 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   930
#define	TLSMODID(X)	((X)->rt_tlsmodid)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   931
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   932
/*
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   933
 * Macros for getting to unexposed, link-map data.
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   934
 */
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   935
#define	LMSIZE(X)	((X)->rt_lmsize)
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   936
#define	AFLAGS(X)	((X)->rt_aflags)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   937
#define	ALIAS(X)	((X)->rt_alias)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   938
#define	FPNODE(X)	((X)->rt_fpnode)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   939
#define	INIT(X)		((X)->rt_init)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   940
#define	FINI(X)		((X)->rt_fini)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   941
#define	RPATH(X)	((X)->rt_runpath)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   942
#define	RLIST(X)	((X)->rt_runlist)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   943
#define	DEPENDS(X)	((X)->rt_depends)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   944
#define	CALLERS(X)	((X)->rt_callers)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   945
#define	HANDLES(X)	((X)->rt_handles)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   946
#define	GROUPS(X)	((X)->rt_groups)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   947
#define	FCT(X)		((X)->rt_fct)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   948
#define	SYMINTP(X)	((X)->rt_symintp)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   949
#define	LIST(X)		((X)->rt_list)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   950
#define	OBJFLTRNDX(X)	((X)->rt_objfltrndx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   951
#define	SYMSFLTRCNT(X)	((X)->rt_symsfltrcnt)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   952
#define	SYMAFLTRCNT(X)	((X)->rt_symafltrcnt)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   953
#define	MODE(X)		((X)->rt_mode)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   954
#define	SORTVAL(X)	((X)->rt_sortval)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   955
#define	CYCGROUP(X)	((X)->rt_cycgroup)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   956
#define	STDEV(X)	((X)->rt_stdev)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   957
#define	STINO(X)	((X)->rt_stino)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   958
#define	ORIGNAME(X)	((X)->rt_origname)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   959
#define	DIRSZ(X)	((X)->rt_dirsz)
5892
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   960
#define	COPY_R(X)	((X)->rt_copy.rtc_r)
b863dde33f1b 6492726 Merge SHF_MERGE|SHF_STRINGS input sections
ab196087
parents: 5220
diff changeset
   961
#define	COPY_S(X)	((X)->rt_copy.rtc_s)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   962
#define	AUDITORS(X)	((X)->rt_auditors)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   963
#define	AUDINFO(X)	((X)->rt_audinfo)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   964
#define	SYMINFO(X)	((X)->rt_syminfo)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   965
#define	INITARRAY(X)	((X)->rt_initarray)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   966
#define	FINIARRAY(X)	((X)->rt_finiarray)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   967
#define	PREINITARRAY(X)	((X)->rt_preinitarray)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   968
#define	MMAPS(X)	((X)->rt_mmaps)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   969
#define	MMAPCNT(X)	((X)->rt_mmapcnt)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   970
#define	INITARRAYSZ(X)	((X)->rt_initarraysz)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   971
#define	FINIARRAYSZ(X)	((X)->rt_finiarraysz)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   972
#define	PREINITARRAYSZ(X) ((X)->rt_preinitarraysz)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   973
#define	DYNINFO(X)	((X)->rt_dyninfo)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   974
#define	DYNINFOCNT(X)	((X)->rt_dyninfocnt)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   975
#define	RELACOUNT(X)	((X)->rt_relacount)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   976
#define	IDX(X)		((X)->rt_idx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   977
#define	LAZY(X)		((X)->rt_lazy)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   978
#define	CNTL(X)		((X)->rt_cntl)
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   979
#define	CAP(X)		((X)->rt_cap)
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
   980
#define	CAPCHAIN(X)	((X)->rt_capchain)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   981
280
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   982
/*
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   983
 * Flags for tsorting.
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   984
 */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   985
#define	RT_SORT_FWD	0x01		/* topological sort (.fini) */
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   986
#define	RT_SORT_REV	0x02		/* reverse topological sort (.init) */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
   987
#define	RT_SORT_DELETE	0x10		/* process FLG_RT_DELETE objects */
280
ffd6f0e5ac00 6301218 Matlab dumps core on startup when running on 112963-22
rie
parents: 64
diff changeset
   988
					/*	only (called via dlclose()) */
3817
e2aeb8ed177f 6533587 ld.so.1: init/fini processing needs to compensate for interposer expectations
rie
parents: 3787
diff changeset
   989
#define	RT_SORT_INTPOSE	0x20		/* process interposer objects */
e2aeb8ed177f 6533587 ld.so.1: init/fini processing needs to compensate for interposer expectations
rie
parents: 3787
diff changeset
   990
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   991
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   992
 * Flags for lookup_sym (and hence find_sym) routines.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   993
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   994
#define	LKUP_DEFT	0x0000		/* simple lookup request */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   995
#define	LKUP_SPEC	0x0001		/* special ELF lookup (allows address */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   996
					/*	resolutions to plt[] entries) */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   997
#define	LKUP_LDOT	0x0002		/* indicates the original A_OUT */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   998
					/*	symbol had a leading `.' */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
   999
#define	LKUP_FIRST	0x0004		/* lookup symbol in first link map */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1000
					/*	only */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1001
#define	LKUP_COPY	0x0008		/* lookup symbol for a COPY reloc, do */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1002
					/*	not bind to symbol at head */
5220
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1003
#define	LKUP_STDRELOC	0x0010		/* lookup originates from a standard */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1004
					/*	relocation (elf_reloc()) */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1005
#define	LKUP_SELF	0x0020		/* lookup symbol in ourself - undef */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1006
					/*	is valid */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1007
#define	LKUP_WEAK	0x0040		/* relocation reference is weak */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1008
#define	LKUP_NEXT	0x0080		/* request originates from RTLD_NEXT */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1009
#define	LKUP_NODESCENT	0x0100		/* don't descend through dependencies */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1010
#define	LKUP_NOFALLBACK	0x0200		/* don't fall back to loading */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1011
					/*	pending lazy dependencies */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1012
#define	LKUP_DIRECT	0x0400		/* direct binding request */
502
425ac83c9448 6318306 a dlsym() from a filter should be redirected to an associated filtee
rie
parents: 280
diff changeset
  1013
#define	LKUP_SYMNDX	0x0800		/* establish symbol index */
5220
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1014
#define	LKUP_SINGLETON	0x1000		/* search for a singleton symbol */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1015
#define	LKUP_STANDARD	0x2000		/* standard lookup - originated from */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1016
					/* 	head link-map element */
8388
20ee5c31e1a4 6778453 RTLD_GROUP prevents use of application defined malloc
Rod Evans <Rod.Evans@Sun.COM>
parents: 8159
diff changeset
  1017
#define	LKUP_WORLD	0x4000		/* ensure world lookup */
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1018
#define	LKUP_DLSYM	0x8000		/* lookup stems from dlsym() request */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1019
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1020
/*
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1021
 * For the runtime linker to perform a symbol search, a number of data items
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1022
 * related to the search are required.  An Slookup data structure is used to
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1023
 * convey this data to lookup_sym(), and in special cases, to other core
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1024
 * routines that provide the implementation details for lookup_sym()
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1025
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1026
 * The symbol name (sl_name), the caller (sl_cmap), and the link-map from which
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1027
 * to start the search (sl_imap) are fundamental to the symbol search.  The
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1028
 * initial search link-map might get modified by the core routines that provide
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1029
 * the implementation details for lookup_sym().  This modification accommodates
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1030
 * requirements such as processing a handle, direct binding and interposition.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1031
 * The association between the caller and the potential destination also
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1032
 * determines whether the destination is a candidate to search.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1033
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1034
 * The lookup identifier (sl_id) is used to identify a runtime linker operation.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1035
 * Within this operation, any lazy loads that fail are not re-examined.  This
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1036
 * technique keeps the overhead of processing a failed lazy load to a minimum.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1037
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1038
 * Symbol searches that originate from a relocation record are accompanied by
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1039
 * the relocation index (sl_rsymndx), the symbol reference (sl_rsym) and
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1040
 * possibly the relocation type (sl_rtype).  This data provides for determining
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1041
 * lazy loading, direct binding, and special symbol processing requirements
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1042
 * such as copy relocations and singleton lookup.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1043
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1044
 * The symbols hash value is computed by lookup_sym, and propagated throughout
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1045
 * the search engine.  Note, occasionally the Slookup data is passed to a core
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1046
 * routine that provides the implementation details for lookup_sym(), ie.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1047
 * elf_find_sym(), in which case the caller must initialize the hash value.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1048
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1049
 * The symbols binding information is established by lookup_sym() when the
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1050
 * symbols relocation type is supplied.  Weak bindings allow relocations to
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1051
 * be set to zero should a symbol lookup fail.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1052
 *
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1053
 * The flags allow the caller to control aspects of the search, including the
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1054
 * interpretation of copy relocations, etc.  Note, a number of flag settings
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1055
 * are established in lookup_sym() from attributes of the symbol reference.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1056
 */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
  1057
struct slookup {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1058
	const char	*sl_name;	/* symbol name */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1059
	Rt_map		*sl_cmap;	/* callers link-map */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1060
	Rt_map		*sl_imap;	/* initial link-map to search */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1061
	ulong_t		sl_id;		/* identifier for this lookup */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1062
	ulong_t		sl_hash;	/* symbol hash value */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1063
	ulong_t		sl_rsymndx;	/* referencing reloc symndx */
5220
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1064
	Sym		*sl_rsym;	/* referencing symbol */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1065
	uchar_t		sl_rtype;	/* relocation type associate with */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1066
					/*    symbol */
caa2c0074088 PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and ELIMINATE
rie
parents: 5067
diff changeset
  1067
	uchar_t		sl_bind;	/* symbols binding (returned) */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1068
	uint_t		sl_flags;	/* lookup flags */
8598
0867fc633d66 6686372 ld.so.1 should use mmapobj(2)
Rod Evans <Rod.Evans@Sun.COM>
parents: 8394
diff changeset
  1069
};
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1070
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1071
#define	SLOOKUP_INIT(sl, name, cmap, imap, id, hash, rsymndx, rsym, rtype, \
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1072
    flags) \
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1073
	(void) (sl.sl_name = (name), sl.sl_cmap = (cmap), sl.sl_imap = (imap), \
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1074
	    sl.sl_id = (id), sl.sl_hash = (hash), sl.sl_rsymndx = (rsymndx), \
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1075
	    sl.sl_rsym = (rsym), sl.sl_rtype = (rtype), sl.sl_bind = 0, \
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1076
	    sl.sl_flags = (flags))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1077
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1078
/*
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1079
 * After a symbol lookup has been resolved, the runtime linker needs to retain
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1080
 * information regarding the bound definition.  An Sresult data structure is
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1081
 * used to provide this information.
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1082
 *
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1083
 * The symbol name (sr_name) may differ from the original referenced symbol if
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1084
 * a symbol capabilities family member has resolved the binding.  The defining
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1085
 * object (sr_dmap) indicates the object in which the definition has been found.
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1086
 * The symbol table entry (sr_sym) defines the bound symbol definition.
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1087
 *
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1088
 * Note, a symbol lookup may start with one Sresult buffer, but underlying
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1089
 * routines (for example, those that probe filters) might employ their own
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1090
 * Sresult buffer.  If a binding is allowed, the latter buffer may get inherited
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1091
 * by the former.  Along with this chain of requests, binding info (binfo) and
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1092
 * not-found information (in_nfavl), may be passed between all the associated
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1093
 * functions.  Hence, the binfo and in_nfavl data is not maintained as part of
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1094
 * a Sresult structure.
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1095
 */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1096
struct sresult {
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1097
	const char	*sr_name;	/* symbol definition name */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1098
	Rt_map		*sr_dmap;	/* defining objects link-map */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1099
	Sym		*sr_sym;	/* symbol table pointer */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1100
};
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1101
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1102
#define	SRESULT_INIT(sr, name) \
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1103
	(void) (sr.sr_name = (name), sr.sr_dmap = NULL, sr.sr_sym = NULL)
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1104
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1105
/*
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1106
 * Define a system capabilities structure for maintaining the various
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1107
 * capabilities of the system.  This structure follows the Objcapset definition
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1108
 * from libld.h, however the system can only have one platform or machine
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1109
 * hardware name, thus this structure is a little simpler.
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1110
 */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1111
typedef	struct {
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1112
	elfcap_mask_t	sc_hw_1;	/* CA_SUNW_HW_1 capabilities */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1113
	elfcap_mask_t	sc_sf_1;	/* CA_SUNW_SF_1 capabilities */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1114
	elfcap_mask_t	sc_hw_2;	/* CA_SUNW_HW_2 capabilities */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1115
	char		*sc_plat;	/* CA_SUNW_PLAT capability */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1116
	size_t		sc_platsz;	/*	and size */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1117
	char		*sc_mach;	/* CA_SUNW_MACH capability */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1118
	size_t		sc_machsz;	/*	and size */
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1119
} Syscapset;
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1120
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1121
/*
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1122
 * Define a number of .plt lookup outcomes, for use in binding diagnostics.
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1123
 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1124
typedef	enum {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1125
	PLT_T_NONE = 0,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1126
	PLT_T_21D,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1127
	PLT_T_24D,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1128
	PLT_T_U32,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1129
	PLT_T_U44,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1130
	PLT_T_FULL,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1131
	PLT_T_FAR,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1132
	PLT_T_NUM			/* Must be last */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1133
} Pltbindtype;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1134
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1135
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1136
 * Prototypes.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1137
 */
5950
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1138
extern ulong_t		ld_entry_cnt;	/* counter bumped on each entry to */
a449a24f9be0 6654381 lazy loading fall-back needs optimizing
rie
parents: 5892
diff changeset
  1139
					/*    ld.so.1. */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1140
extern Lm_list		lml_main;	/* main's link map list */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1141
extern Lm_list		lml_rtld;	/* rtld's link map list */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1142
extern Lm_list		*lml_list[];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1143
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1144
extern Pltbindtype	elf_plt_write(uintptr_t, uintptr_t, void *, uintptr_t,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1145
			    Xword);
6387
4977cc444d39 6509323 Need to disable the Multiple Files loading - same name, different directories (or its stat() use)
rie
parents: 6206
diff changeset
  1146
extern Rt_map		*is_so_loaded(Lm_list *, const char *, int *);
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 10167
diff changeset
  1147
extern int		lookup_sym(Slookup *, Sresult *, uint_t *, int *);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1148
extern int		rt_dldump(Rt_map *, const char *, int, Addr);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1149
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1150
#ifdef	__cplusplus
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1151
}
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1152
#endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1153
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
  1154
#endif /* _RTLD_H */