usr/src/cmd/sgs/libconv/common/syminfo.c
author Rod Evans <Rod.Evans@Sun.COM>
Wed, 19 May 2010 22:33:49 -0700
changeset 12449 a87750d92895
parent 11827 d7ef53deac3f
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:
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     1
/*
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     2
 * CDDL HEADER START
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     3
 *
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     7
 *
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    11
 * and limitations under the License.
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    12
 *
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    18
 *
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    19
 * CDDL HEADER END
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    20
 */
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    21
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
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) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    24
 */
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    25
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    26
/*
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    27
 * String conversion routines for syminfo attributes.
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    28
 */
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    29
#include	<stdio.h>
6206
6b0ed502a8e7 PSARC 2008/179 cross link-editor
ab196087
parents: 5152
diff changeset
    30
#include	<_machelf.h>
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    31
#include	"_conv.h"
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    32
#include	"syminfo_msg.h"
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    33
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    34
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    35
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    36
static const Val_desc *
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    37
conv_syminfo_flags_strings(Conv_fmt_flags_t fmt_flags)
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    38
{
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    39
#define	FLAGSZ	CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    40
	MSG_SYMINFO_FLG_DIRECT_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    41
	MSG_SYMINFO_FLG_FILTER_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    42
	MSG_SYMINFO_FLG_COPY_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    43
	MSG_SYMINFO_FLG_LAZYLOAD_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    44
	MSG_SYMINFO_FLG_DIRECTBIND_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    45
	MSG_SYMINFO_FLG_NOEXTDIRECT_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    46
	MSG_SYMINFO_FLG_AUXILIARY_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    47
	MSG_SYMINFO_FLG_INTERPOSE_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
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
    48
	MSG_SYMINFO_FLG_CAP_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
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
    49
	MSG_SYMINFO_FLG_DEFERRED_CF_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    50
	CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    51
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    52
	/*
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    53
	 * Ensure that Conv_syminfo_flags_buf_t is large enough:
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    54
	 *
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    55
	 * FLAGSZ is the real minimum size of the buffer required by
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    56
	 * conv_syminfo_flags(). However, Conv_syminfo_flags_buf_t uses
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    57
	 * CONV_SYMINFO_FLAGS_BUFSIZE to set the buffer size. We do things
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    58
	 * this way because the definition of FLAGSZ uses information that
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    59
	 * is not available in the environment of other programs that include
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    60
	 * the conv.h header file.
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    61
	 */
5152
fa5ab16f3606 5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents: 5088
diff changeset
    62
#if (CONV_SYMINFO_FLAGS_BUFSIZE != FLAGSZ) && !defined(__lint)
fa5ab16f3606 5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents: 5088
diff changeset
    63
#define	REPORT_BUFSIZE FLAGSZ
fa5ab16f3606 5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents: 5088
diff changeset
    64
#include "report_bufsize.h"
fa5ab16f3606 5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
ab196087
parents: 5088
diff changeset
    65
#error "CONV_SYMINFO_FLAGS_BUFSIZE does not match FLAGSZ"
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    66
#endif
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
    67
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    68
	static const Val_desc vda_cf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    69
		{ SYMINFO_FLG_DIRECT,	MSG_SYMINFO_FLG_DIRECT_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    70
		{ SYMINFO_FLG_FILTER,	MSG_SYMINFO_FLG_FILTER_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    71
		{ SYMINFO_FLG_COPY,	MSG_SYMINFO_FLG_COPY_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    72
		{ SYMINFO_FLG_LAZYLOAD,	MSG_SYMINFO_FLG_LAZYLOAD_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    73
		{ SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    74
		{ SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    75
		{ SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_CF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    76
		{ SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_CF },
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 9273
diff changeset
    77
		{ SYMINFO_FLG_CAP,	MSG_SYMINFO_FLG_CAP_CF },
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
    78
		{ SYMINFO_FLG_DEFERRED,	MSG_SYMINFO_FLG_DEFERRED_CF },
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    79
		{ 0 }
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    80
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    81
	static const Val_desc vda_cfnp[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    82
		{ SYMINFO_FLG_DIRECT,	MSG_SYMINFO_FLG_DIRECT_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    83
		{ SYMINFO_FLG_FILTER,	MSG_SYMINFO_FLG_FILTER_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    84
		{ SYMINFO_FLG_COPY,	MSG_SYMINFO_FLG_COPY_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    85
		{ SYMINFO_FLG_LAZYLOAD,	MSG_SYMINFO_FLG_LAZYLOAD_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    86
		{ SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    87
		{ SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    88
		{ SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_CFNP },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    89
		{ SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_CFNP },
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 9273
diff changeset
    90
		{ SYMINFO_FLG_CAP,	MSG_SYMINFO_FLG_CAP_CFNP },
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
    91
		{ SYMINFO_FLG_DEFERRED,	MSG_SYMINFO_FLG_DEFERRED_CFNP },
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    92
		{ 0 }
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    93
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    94
	static const Val_desc vda_nf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    95
		{ SYMINFO_FLG_DIRECT,	MSG_SYMINFO_FLG_DIRECT_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    96
		{ SYMINFO_FLG_FILTER,	MSG_SYMINFO_FLG_FILTER_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    97
		{ SYMINFO_FLG_COPY,	MSG_SYMINFO_FLG_COPY_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    98
		{ SYMINFO_FLG_LAZYLOAD,	MSG_SYMINFO_FLG_LAZYLOAD_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
    99
		{ SYMINFO_FLG_DIRECTBIND, MSG_SYMINFO_FLG_DIRECTBIND_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   100
		{ SYMINFO_FLG_NOEXTDIRECT, MSG_SYMINFO_FLG_NOEXTDIRECT_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   101
		{ SYMINFO_FLG_AUXILIARY, MSG_SYMINFO_FLG_AUXILIARY_NF },
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   102
		{ SYMINFO_FLG_INTERPOSE, MSG_SYMINFO_FLG_INTERPOSE_NF },
11827
d7ef53deac3f 6918143 symbol capabilities
Rod Evans <Rod.Evans@Sun.COM>
parents: 9273
diff changeset
   103
		{ SYMINFO_FLG_CAP,	MSG_SYMINFO_FLG_CAP_NF },
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
   104
		{ SYMINFO_FLG_DEFERRED,	MSG_SYMINFO_FLG_DEFERRED_NF },
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   105
		{ 0 }
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   106
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   107
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   108
	switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   109
	case CONV_FMT_ALT_CF:
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   110
		return (vda_cf);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   111
	case CONV_FMT_ALT_NF:
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   112
		return (vda_nf);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   113
	}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   114
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   115
	return (vda_cfnp);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   116
}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   117
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   118
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   119
const char *
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   120
conv_syminfo_flags(Half flags, Conv_fmt_flags_t fmt_flags,
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   121
    Conv_syminfo_flags_buf_t *syminfo_flags_buf)
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   122
{
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   123
	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: 6206
diff changeset
   124
	    NULL, sizeof (syminfo_flags_buf->buf) };
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   125
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   126
	if (flags == 0)
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   127
		return (MSG_ORIG(MSG_GBL_ZERO));
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   128
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   129
	conv_arg.buf = syminfo_flags_buf->buf;
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   130
	conv_arg.oflags = conv_arg.rflags = flags;
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   131
	conv_arg.prefix = conv_arg.suffix = NULL;
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   132
	(void) conv_expn_field(&conv_arg,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   133
	    conv_syminfo_flags_strings(fmt_flags), fmt_flags);
5088
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   134
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   135
	return ((const char *)syminfo_flags_buf->buf);
26c540f30cd3 PSARC 2007/509 elfedit
ab196087
parents:
diff changeset
   136
}
9273
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   137
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   138
conv_iter_ret_t
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   139
conv_iter_syminfo_flags(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   140
    void *uvalue)
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   141
{
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   142
	return (conv_iter_vd(conv_syminfo_flags_strings(fmt_flags),
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   143
	    func, uvalue));
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   144
}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   145
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   146
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   147
static const conv_ds_t **
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   148
conv_syminfo_boundto_strings(Conv_fmt_flags_t fmt_flags)
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   149
{
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   150
	static const Msg	boundto_cf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   151
		MSG_SYMINFO_BT_EXTERN_CF,	MSG_SYMINFO_BT_NONE_CF,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   152
		MSG_SYMINFO_BT_PARENT_CF,	MSG_SYMINFO_BT_SELF_CF
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   153
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   154
	static const Msg	boundto_cfnp[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   155
		MSG_SYMINFO_BT_EXTERN_CFNP,	MSG_SYMINFO_BT_NONE_CFNP,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   156
		MSG_SYMINFO_BT_PARENT_CFNP,	MSG_SYMINFO_BT_SELF_CFNP
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   157
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   158
	static const Msg	boundto_nf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   159
		MSG_SYMINFO_BT_EXTERN_NF,	MSG_SYMINFO_BT_NONE_NF,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   160
		MSG_SYMINFO_BT_PARENT_NF,	MSG_SYMINFO_BT_SELF_NF
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   161
	};
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   162
	static const conv_ds_msg_t ds_boundto_cf = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   163
	    CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_cf) };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   164
	static const conv_ds_msg_t ds_boundto_cfnp = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   165
	    CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_cfnp) };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   166
	static const conv_ds_msg_t ds_boundto_nf = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   167
	    CONV_DS_MSG_INIT(SYMINFO_BT_EXTERN, boundto_nf) };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   168
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   169
	/* Build NULL terminated return arrays for each string style */
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   170
	static const const conv_ds_t	*ds_cf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   171
		CONV_DS_ADDR(ds_boundto_cf), NULL };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   172
	static const const conv_ds_t	*ds_cfnp[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   173
		CONV_DS_ADDR(ds_boundto_cfnp), NULL };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   174
	static const const conv_ds_t	*ds_nf[] = {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   175
		CONV_DS_ADDR(ds_boundto_nf), NULL };
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   176
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   177
	/* Select the strings to use */
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   178
	switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   179
	case CONV_FMT_ALT_CF:
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   180
		return (ds_cf);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   181
	case CONV_FMT_ALT_NF:
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   182
		return (ds_nf);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   183
	}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   184
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   185
	return (ds_cfnp);
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   186
}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   187
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   188
const char *
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   189
conv_syminfo_boundto(Half value, Conv_fmt_flags_t fmt_flags,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   190
    Conv_inv_buf_t *inv_buf)
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   191
{
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   192
	return (conv_map_ds(ELFOSABI_NONE, EM_NONE, value,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   193
	    conv_syminfo_boundto_strings(fmt_flags), fmt_flags, inv_buf));
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   194
}
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   195
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   196
conv_iter_ret_t
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   197
conv_iter_syminfo_boundto(Conv_fmt_flags_t fmt_flags, conv_iter_cb_t func,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   198
    void *uvalue)
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   199
{
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   200
	return (conv_iter_ds(ELFOSABI_NONE, EM_NONE,
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   201
	    conv_syminfo_boundto_strings(fmt_flags), func, uvalue));
9a0603d78ad3 6821619 Solaris linkers need systematic approach to ELF OSABI
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents: 6206
diff changeset
   202
}