author | Rod Evans <Rod.Evans@Sun.COM> |
Wed, 19 May 2010 22:33:49 -0700 | |
changeset 12449 | a87750d92895 |
parent 12029 | 3202400f09a4 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
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:
0
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
0 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
21 |
|
0 | 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:
12029
diff
changeset
|
23 |
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 24 |
*/ |
25 |
||
26 |
#include <string.h> |
|
27 |
#include "_conv.h" |
|
28 |
#include "dl_msg.h" |
|
29 |
||
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
30 |
#define MODESZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
31 |
MSG_RTLD_LAZY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
32 |
MSG_RTLD_GLOBAL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
33 |
MSG_RTLD_NOLOAD_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
34 |
MSG_RTLD_PARENT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
35 |
MSG_RTLD_GROUP_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
36 |
MSG_RTLD_WORLD_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
37 |
MSG_RTLD_NODELETE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
38 |
MSG_RTLD_FIRST_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
39 |
MSG_RTLD_CONFGEN_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \ |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
40 |
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
41 |
|
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
42 |
|
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
43 |
/* |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
44 |
* Ensure that Conv_dl_mode_buf_t is large enough: |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
45 |
* |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
46 |
* MODESZ is the real minimum size of the buffer required by conv_dl_mode(). |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
47 |
* However, Conv_dl_mode_buf_t uses CONV_DL_MODE_BUFSIZE to set the |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
48 |
* buffer size. We do things this way because the definition of MODESZ uses |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
49 |
* information that is not available in the environment of other programs |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
50 |
* that include the conv.h header file. |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
51 |
*/ |
5152
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
52 |
#if (CONV_DL_MODE_BUFSIZE != MODESZ) && !defined(__lint) |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
53 |
#define REPORT_BUFSIZE MODESZ |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
54 |
#include "report_bufsize.h" |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
55 |
#error "CONV_DL_MODE_BUFSIZE does not match MODESZ" |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
56 |
#endif |
0 | 57 |
|
58 |
/* |
|
59 |
* String conversion routine for dlopen() attributes. |
|
60 |
*/ |
|
61 |
const char * |
|
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
62 |
conv_dl_mode(int mode, int fabricate, Conv_dl_mode_buf_t *dl_mode_buf) |
0 | 63 |
{ |
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
64 |
static const Val_desc vda[] = { |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
65 |
{ RTLD_NOLOAD, MSG_RTLD_NOLOAD }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
66 |
{ RTLD_PARENT, MSG_RTLD_PARENT }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
67 |
{ RTLD_GROUP, MSG_RTLD_GROUP }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
68 |
{ RTLD_WORLD, MSG_RTLD_WORLD }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
69 |
{ RTLD_NODELETE, MSG_RTLD_NODELETE }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
70 |
{ RTLD_FIRST, MSG_RTLD_FIRST }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
71 |
{ RTLD_CONFGEN, MSG_RTLD_CONFGEN }, |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
72 |
{ 0, 0 } |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
73 |
}; |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
74 |
static const char *leading_str_arr[3]; |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
75 |
static CONV_EXPN_FIELD_ARG conv_arg = { |
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
76 |
NULL, sizeof (dl_mode_buf->buf), leading_str_arr }; |
0 | 77 |
|
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
78 |
const char **lstr = leading_str_arr; |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
79 |
|
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
80 |
conv_arg.buf = dl_mode_buf->buf; |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
81 |
conv_arg.oflags = conv_arg.rflags = mode; |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
82 |
|
0 | 83 |
|
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
84 |
if (mode & RTLD_NOW) { |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
85 |
*lstr++ = MSG_ORIG(MSG_RTLD_NOW); |
8140
5932af7fc25c
6763342 sloppy relocations need to get sloppier
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
5152
diff
changeset
|
86 |
} else if ((mode & RTLD_LAZY) || fabricate) { |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
87 |
*lstr++ = MSG_ORIG(MSG_RTLD_LAZY); |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
88 |
} |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
89 |
if (mode & RTLD_GLOBAL) { |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
90 |
*lstr++ = MSG_ORIG(MSG_RTLD_GLOBAL); |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
91 |
} else if (fabricate) { |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
92 |
*lstr++ = MSG_ORIG(MSG_RTLD_LOCAL); |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
93 |
} |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
94 |
*lstr = NULL; |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
95 |
conv_arg.oflags = mode; |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
96 |
conv_arg.rflags = mode & ~(RTLD_LAZY | RTLD_NOW | RTLD_GLOBAL); |
0 | 97 |
|
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
98 |
(void) conv_expn_field(&conv_arg, vda, 0); |
0 | 99 |
|
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
100 |
return ((const char *)dl_mode_buf->buf); |
0 | 101 |
} |
102 |
||
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
103 |
/* |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
104 |
* Note: We can use two different sets of prefix/separator/suffix |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
105 |
* strings in conv_dl_flag(), depending on the value of the separator |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
106 |
* argument. To size the buffer, I use the default prefix and suffix |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
107 |
* sizes, and the alternate separator size, because they are larger. |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
108 |
*/ |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
109 |
|
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
110 |
#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \ |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
111 |
MSG_RTLD_REL_RELATIVE_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
112 |
MSG_RTLD_REL_EXEC_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
113 |
MSG_RTLD_REL_DEPENDS_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
114 |
MSG_RTLD_REL_PRELOAD_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
115 |
MSG_RTLD_REL_SELF_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
116 |
MSG_RTLD_REL_WEAK_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
117 |
MSG_RTLD_MEMORY_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
118 |
MSG_RTLD_STRIP_SIZE + MSG_GBL_SEP_SIZE + \ |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
119 |
MSG_RTLD_NOHEAP_SIZE + MSG_GBL_SEP_SIZE + \ |
0 | 120 |
MSG_RTLD_CONFSET_SIZE + \ |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
121 |
CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
122 |
|
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
123 |
/* |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
124 |
* Ensure that Conv_dl_flag_buf_t is large enough: |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
125 |
* |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
126 |
* FLAGSZ is the real minimum size of the buffer required by conv_dl_flag(). |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
127 |
* However, Conv_dl_flag_buf_t uses CONV_DL_FLAG_BUFSIZE to set the |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
128 |
* buffer size. We do things this way because the definition of FLAGSZ uses |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
129 |
* information that is not available in the environment of other programs |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
130 |
* that include the conv.h header file. |
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
131 |
*/ |
5152
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
132 |
#if (CONV_DL_FLAG_BUFSIZE != FLAGSZ) && !defined(__lint) |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
133 |
#define REPORT_BUFSIZE FLAGSZ |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
134 |
#include "report_bufsize.h" |
fa5ab16f3606
5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents:
5088
diff
changeset
|
135 |
#error "CONV_DL_FLAG_BUFSIZE does not match FLAGSZ" |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
136 |
#endif |
0 | 137 |
|
138 |
/* |
|
139 |
* String conversion routine for dldump() flags. |
|
140 |
* crle(1) uses this routine to generate update information, and in this case |
|
141 |
* we build a "|" separated string. |
|
142 |
*/ |
|
143 |
const char * |
|
5088 | 144 |
conv_dl_flag(int flags, Conv_fmt_flags_t fmt_flags, |
145 |
Conv_dl_flag_buf_t *dl_flag_buf) |
|
0 | 146 |
{ |
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
147 |
static const Val_desc vda[] = { |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
148 |
{ RTLD_REL_RELATIVE, MSG_RTLD_REL_RELATIVE }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
149 |
{ RTLD_REL_EXEC, MSG_RTLD_REL_EXEC }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
150 |
{ RTLD_REL_DEPENDS, MSG_RTLD_REL_DEPENDS }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
151 |
{ RTLD_REL_PRELOAD, MSG_RTLD_REL_PRELOAD }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
152 |
{ RTLD_REL_SELF, MSG_RTLD_REL_SELF }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
153 |
{ RTLD_REL_WEAK, MSG_RTLD_REL_WEAK }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
154 |
{ RTLD_MEMORY, MSG_RTLD_MEMORY }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
155 |
{ RTLD_STRIP, MSG_RTLD_STRIP }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
156 |
{ RTLD_NOHEAP, MSG_RTLD_NOHEAP }, |
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
157 |
{ RTLD_CONFSET, MSG_RTLD_CONFSET }, |
1618
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
158 |
{ 0, 0 } |
8c9a4f31d225
6316708 LD_DEBUG should provide a means of identifying/isolating individual
rie
parents:
0
diff
changeset
|
159 |
}; |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
160 |
static const char *leading_str_arr[2]; |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
161 |
static CONV_EXPN_FIELD_ARG conv_arg = { |
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
162 |
NULL, sizeof (dl_flag_buf->buf), leading_str_arr }; |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
163 |
|
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
164 |
const char **lstr = leading_str_arr; |
0 | 165 |
|
166 |
if (flags == 0) |
|
167 |
return (MSG_ORIG(MSG_GBL_ZERO)); |
|
168 |
||
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
169 |
conv_arg.buf = dl_flag_buf->buf; |
5088 | 170 |
if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_CRLE) { |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
171 |
conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_GBL_QUOTE); |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
172 |
conv_arg.sep = MSG_ORIG(MSG_GBL_SEP); |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
173 |
} else { /* Use default delimiters */ |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
174 |
conv_arg.prefix = conv_arg.suffix = conv_arg.sep = NULL; |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
175 |
} |
0 | 176 |
|
177 |
if ((flags & RTLD_REL_ALL) == RTLD_REL_ALL) { |
|
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
178 |
*lstr++ = MSG_ORIG(MSG_RTLD_REL_ALL); |
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
179 |
flags &= ~RTLD_REL_ALL; |
0 | 180 |
} |
2352
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
181 |
*lstr = NULL; |
9cdfed81bb1c
6421380 nm uses too many digits when formatting 64-bit hex values
ab196087
parents:
1618
diff
changeset
|
182 |
conv_arg.oflags = conv_arg.rflags = flags; |
0 | 183 |
|
9273
9a0603d78ad3
6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
8140
diff
changeset
|
184 |
(void) conv_expn_field(&conv_arg, vda, fmt_flags); |
0 | 185 |
|
4734
a4708faa3e85
6583742 ELF string conversion library needs to lose static writable buffers
ab196087
parents:
2352
diff
changeset
|
186 |
return ((const char *)dl_flag_buf->buf); |
0 | 187 |
} |
12029
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
188 |
|
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
189 |
const char * |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
190 |
conv_dl_info(int request) |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
191 |
{ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
192 |
static const Msg requests[RTLD_DI_MAX] = { |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
193 |
MSG_RTLD_DI_LMID, /* MSG_ORIG(MSG_RTLD_DI_LMID) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
194 |
MSG_RTLD_DI_LINKMAP, /* MSG_ORIG(MSG_RTLD_DI_LINKMAP) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
195 |
MSG_RTLD_DI_CONFIGADDR, /* MSG_ORIG(MSG_RTLD_DI_CONFIGADDR) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
196 |
MSG_RTLD_DI_SERINFO, /* MSG_ORIG(MSG_RTLD_DI_SERINFO) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
197 |
MSG_RTLD_DI_SERINFOSIZE, /* MSG_ORIG(MSG_RTLD_DI_SERINFOSIZE) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
198 |
MSG_RTLD_DI_ORIGIN, /* MSG_ORIG(MSG_RTLD_DI_ORIGIN) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
199 |
MSG_RTLD_DI_PROFILENAME, /* MSG_ORIG(MSG_RTLD_DI_PROFILENAME) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
200 |
MSG_RTLD_DI_PROFILEOUT, /* MSG_ORIG(MSG_RTLD_DI_PROFILEOUT) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
201 |
MSG_RTLD_DI_GETSIGNAL, /* MSG_ORIG(MSG_RTLD_DI_GETSIGNAL) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
202 |
MSG_RTLD_DI_SETSIGNAL, /* MSG_ORIG(MSG_RTLD_DI_SETSIGNAL) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
203 |
MSG_RTLD_DI_ARGSINFO, /* MSG_ORIG(MSG_RTLD_DI_ARGSINFO) */ |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
204 |
MSG_RTLD_DI_MMAPS, /* MSG_ORIG(MSG_RTLD_DI_MMAPS) */ |
12449
a87750d92895
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents:
12029
diff
changeset
|
205 |
MSG_RTLD_DI_MMAPCNT, /* MSG_ORIG(MSG_RTLD_DI_MMAPCNT) */ |
a87750d92895
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents:
12029
diff
changeset
|
206 |
MSG_RTLD_DI_DEFERRED, /* MSG_ORIG(MSG_RTLD_DI_DEFERRED) */ |
a87750d92895
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents:
12029
diff
changeset
|
207 |
MSG_RTLD_DI_DEFERRED_SYM |
a87750d92895
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents:
12029
diff
changeset
|
208 |
/* MSG_ORIG(MSG_RTLD_DI_DEFERRED_SYM) */ |
12029
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
209 |
}; |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
210 |
static Conv_inv_buf_t inv_buf; |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
211 |
|
12449
a87750d92895
6943772 Testing for a symbols existence with RTLD_PROBE is compromised by RTLD_BIND_NOW
Rod Evans <Rod.Evans@Sun.COM>
parents:
12029
diff
changeset
|
212 |
#if (RTLD_DI_MAX != RTLD_DI_DEFERRED_SYM) |
12029
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
213 |
#error "RTLD_DI_MAX has grown" |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
214 |
#endif |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
215 |
if (request && (request <= RTLD_DI_MAX)) |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
216 |
return (MSG_ORIG(requests[request - 1])); |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
217 |
|
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
218 |
(void) conv_invalid_val(&inv_buf, EC_NATPTR(request), 0); |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
219 |
return (inv_buf.buf); |
3202400f09a4
6938628 ld.so.1 should produce diagnostics for all dl*() entry points
Rod Evans <Rod.Evans@Sun.COM>
parents:
9273
diff
changeset
|
220 |
} |