globals.c revision 8598:0867fc633d66
1234370Sjasone/*
2234370Sjasone * CDDL HEADER START
3234370Sjasone *
4234370Sjasone * The contents of this file are subject to the terms of the
5234370Sjasone * Common Development and Distribution License (the "License").
6234370Sjasone * You may not use this file except in compliance with the License.
7234370Sjasone *
8234370Sjasone * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9234370Sjasone * or http://www.opensolaris.org/os/licensing.
10234370Sjasone * See the License for the specific language governing permissions
11234370Sjasone * and limitations under the License.
12234370Sjasone *
13234370Sjasone * When distributing Covered Code, include this CDDL HEADER in each
14234370Sjasone * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15234370Sjasone * If applicable, add the following below this CDDL HEADER, with the
16234370Sjasone * fields enclosed by brackets "[]" replaced with your own identifying
17234370Sjasone * information: Portions Copyright [yyyy] [name of copyright owner]
18234370Sjasone *
19234370Sjasone * CDDL HEADER END
20234370Sjasone */
21234370Sjasone
22234370Sjasone/*
23234370Sjasone *	Copyright (c) 1988 AT&T
24261071Sjasone *	  All Rights Reserved
25261071Sjasone *
26261071Sjasone * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27261071Sjasone * Use is subject to license terms.
28261071Sjasone */
29261071Sjasone
30234370Sjasone/*
31234370Sjasone * Global variables
32234370Sjasone */
33234370Sjasone#include	<sys/elf.h>
34234370Sjasone#include	"msg.h"
35250991Smarcel#include	"_libld.h"
36250991Smarcel
37250991SmarcelLd_heap		*ld_heap;	/* list of allocated blocks for */
38250991Smarcel				/* 	link-edit dynamic allocations */
39250991SmarcelList		lib_support;	/* list of support libraries specified */
40250991Smarcel				/*	(-S option) */
41261071Sjasoneint		demangle_flag;	/* symbol demangling required */
42261071Sjasone
43261071Sjasone/*
44261071Sjasone * Paths and directories for library searches.  These are used to set up
45261071Sjasone * linked lists of directories which are maintained in the ofl structure.
46261071Sjasone */
47250991Smarcelchar		*Plibpath;	/* User specified -YP or defaults to LIBPATH */
48250991Smarcelchar		*Llibdir;	/* User specified -YL */
49250991Smarcelchar		*Ulibdir;	/* User specified -YU */
50250991SmarcelListnode	*insert_lib;	/* insertion point for -L libraries */
51250991Smarcel
52234370Sjasone/*
53234370Sjasone * A default library search path is used if one was not supplied on the command
54234370Sjasone * line.  Note: these strings can not use MSG_ORIG() since they are modified as
55234370Sjasone * part of the path processing.
56234370Sjasone */
57234370Sjasonechar		def64_Plibpath[] = "/lib/64:/usr/lib/64";
58276630Skibchar		def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
59234370Sjasone
60/*
61 * Rejected file error messages (indexed to match FLG_RJC_ values).
62 */
63const Msg
64reject[] = {
65		MSG_STR_EMPTY,
66		MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
67		MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
68		MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
69		MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
70		MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
71		MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
72		MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
73		MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
74		MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
75		MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
76		MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
77		MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
78	};
79
80/*
81 * Symbol types that we include in .SUNW_ldynsym sections
82 * (indexed by STT_ values).
83 */
84const int
85ldynsym_symtype[STT_NUM] = {
86		0,			/* STT_NOTYPE (not counting 1st slot) */
87		0,			/* STT_OBJECT */
88		1,			/* STT_FUNC */
89		0,			/* STT_SECTION */
90		1,			/* STT_FILE */
91		0,			/* STT_COMMON */
92		0,			/* STT_TLS */
93};
94#if STT_NUM != (STT_TLS + 1)
95#error "STT_NUM has grown. Update ldynsym_symtype[]."
96#endif
97
98/*
99 * Symbol types that we include in .SUNW_dynsymsort sections
100 * (indexed by STT_ values).
101 */
102const int
103dynsymsort_symtype[STT_NUM] = {
104		0,			/* STT_NOTYPE */
105		1,			/* STT_OBJECT */
106		1,			/* STT_FUNC */
107		0,			/* STT_SECTION */
108		0,			/* STT_FILE */
109		1,			/* STT_COMMON */
110		0,			/* STT_TLS */
111};
112#if STT_NUM != (STT_TLS + 1)
113#error "STT_NUM has grown. Update dynsymsort_symtype[]."
114#endif
115