1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2022 Oxide Computer Company
*/
/*
* Global variables
*/
#include <sys/elf.h>
#include "msg.h"
#include "_libld.h"
APlist *lib_support; /* list of support libraries specified */
/* (-S option) */
int demangle_flag; /* symbol demangling required */
/*
* Paths and directories for library searches. These are used to set up
* linked lists of directories which are maintained in the ofl structure.
*/
char *Plibpath; /* User specified -YP or defaults to LIBPATH */
char *Llibdir; /* User specified -YL */
char *Ulibdir; /* User specified -YU */
/*
* A default library search path is used if one was not supplied on the command
* line. Note: these strings can not use MSG_ORIG() since they are modified as
* part of the path processing.
*/
char def64_Plibpath[] = "/lib/64:/usr/lib/64";
char def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
/*
* Rejected file error messages (indexed to match SGS_REJ_ values).
*/
const Msg
reject[SGS_REJ_NUM] = {
MSG_STR_EMPTY,
MSG_REJ_MACH, /* MSG_INTL(MSG_REJ_MACH) */
MSG_REJ_CLASS, /* MSG_INTL(MSG_REJ_CLASS) */
MSG_REJ_DATA, /* MSG_INTL(MSG_REJ_DATA) */
MSG_REJ_TYPE, /* MSG_INTL(MSG_REJ_TYPE) */
MSG_REJ_BADFLAG, /* MSG_INTL(MSG_REJ_BADFLAG) */
MSG_REJ_MISFLAG, /* MSG_INTL(MSG_REJ_MISFLAG) */
MSG_REJ_VERSION, /* MSG_INTL(MSG_REJ_VERSION) */
MSG_REJ_HAL, /* MSG_INTL(MSG_REJ_HAL) */
MSG_REJ_US3, /* MSG_INTL(MSG_REJ_US3) */
MSG_REJ_STR, /* MSG_INTL(MSG_REJ_STR) */
MSG_REJ_UNKFILE, /* MSG_INTL(MSG_REJ_UNKFILE) */
MSG_REJ_UNKCAP, /* MSG_INTL(MSG_REJ_UNKCAP) */
MSG_REJ_HWCAP_1, /* MSG_INTL(MSG_REJ_HWCAP_1) */
MSG_REJ_SFCAP_1, /* MSG_INTL(MSG_REJ_SFCAP_1) */
MSG_REJ_MACHCAP, /* MSG_INTL(MSG_REJ_MACHCAP) */
MSG_REJ_PLATCAP, /* MSG_INTL(MSG_REJ_PLATCAP) */
MSG_REJ_HWCAP_2, /* MSG_INTL(MSG_REJ_HWCAP_2) */
MSG_REJ_ARCHIVE, /* MSG_INTL(MSG_REJ_ARCHIVE) */
MSG_REJ_KMOD, /* MSG_INTL(MSG_REJ_KMOD) */
MSG_REJ_HWCAP_3 /* MSG_INTL(MSG_REJ_HWCAP_3) */
};
#if SGS_REJ_NUM != (SGS_REJ_HWCAP_3 + 1)
#error SGS_REJ_NUM has changed
#endif
/*
* Symbol types that we include in .SUNW_ldynsym sections
* (indexed by STT_ values).
*/
const int
ldynsym_symtype[] = {
0, /* STT_NOTYPE (not counting 1st slot) */
0, /* STT_OBJECT */
1, /* STT_FUNC */
0, /* STT_SECTION */
1, /* STT_FILE */
0, /* STT_COMMON */
0, /* STT_TLS */
0, /* 7 */
0, /* 8 */
0, /* 9 */
0, /* 10 */
0, /* 11 */
0, /* 12 */
0, /* STT_SPARC_REGISTER */
0, /* 14 */
0, /* 15 */
};
#if STT_NUM != (STT_TLS + 1)
#error "STT_NUM has grown. Update ldynsym_symtype[]."
#endif
/*
* Symbol types that we include in .SUNW_dynsymsort sections
* (indexed by STT_ values).
*/
const int
dynsymsort_symtype[] = {
0, /* STT_NOTYPE */
1, /* STT_OBJECT */
1, /* STT_FUNC */
0, /* STT_SECTION */
0, /* STT_FILE */
1, /* STT_COMMON */
0, /* STT_TLS */
0, /* 7 */
0, /* 8 */
0, /* 9 */
0, /* 10 */
0, /* 11 */
0, /* 12 */
0, /* STT_SPARC_REGISTER */
0, /* 14 */
0, /* 15 */
};
#if STT_NUM != (STT_TLS + 1)
#error "STT_NUM has grown. Update dynsymsort_symtype[]."
#endif
|