xref: /titanic_44/usr/src/cmd/sgs/libld/common/globals.c (revision b0fe7b8fa79924061f3bdf7f240ea116c2c0b704)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
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  */
21 
22 /*
23  *	Copyright (c) 1988 AT&T
24  *	  All Rights Reserved
25  *
26  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Global variables
33  */
34 #include	<sys/elf.h>
35 #include	"msg.h"
36 #include	"_libld.h"
37 
38 Ld_heap		*ld_heap;	/* list of allocated blocks for */
39 				/* 	link-edit dynamic allocations */
40 List		lib_support;	/* list of support libraries specified */
41 				/*	(-S option) */
42 int		demangle_flag;	/* symbol demangling required */
43 
44 /*
45  * Paths and directories for library searches.  These are used to set up
46  * linked lists of directories which are maintained in the ofl structure.
47  */
48 char		*Plibpath;	/* User specified -YP or defaults to LIBPATH */
49 char		*Llibdir;	/* User specified -YL */
50 char		*Ulibdir;	/* User specified -YU */
51 Listnode	*insert_lib;	/* insertion point for -L libraries */
52 
53 /*
54  * A default library search path is used if one was not supplied on the command
55  * line.  Note: these strings can not use MSG_ORIG() since they are modified as
56  * part of the path processing.
57  */
58 char		def64_Plibpath[] = "/lib/64:/usr/lib/64";
59 char		def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
60 
61 /*
62  * For backward compatibility provide a /dev/zero file descriptor.
63  */
64 int		dz_fd = -1;
65 
66 /*
67  * Rejected file error messages (indexed to match FLG_RJC_ values).
68  */
69 const Msg
70 reject[] = {
71 		MSG_STR_EMPTY,
72 		MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
73 		MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
74 		MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
75 		MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
76 		MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
77 		MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
78 		MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
79 		MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
80 		MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
81 		MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
82 		MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
83 		MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
84 	};
85 
86 /*
87  * Symbol types that we include in .SUNW_ldynsym sections
88  * (indexed by STT_ values).
89  */
90 const int
91 ldynsym_symtype[STT_NUM] = {
92 		0,			/* STT_NOTYPE (not counting 1st slot) */
93 		0,			/* STT_OBJECT */
94 		1,			/* STT_FUNC */
95 		0,			/* STT_SECTION */
96 		1,			/* STT_FILE */
97 		0,			/* STT_COMMON */
98 		0,			/* STT_TLS */
99 };
100 #if STT_NUM != (STT_TLS + 1)
101 #error "STT_NUM has grown. Update ldynsym_symtype[]."
102 #endif
103 
104 /*
105  * Symbol types that we include in .SUNW_dynsymsort sections
106  * (indexed by STT_ values).
107  */
108 const int
109 dynsymsort_symtype[STT_NUM] = {
110 		0,			/* STT_NOTYPE */
111 		1,			/* STT_OBJECT */
112 		1,			/* STT_FUNC */
113 		0,			/* STT_SECTION */
114 		0,			/* STT_FILE */
115 		1,			/* STT_COMMON */
116 		0,			/* STT_TLS */
117 };
118 #if STT_NUM != (STT_TLS + 1)
119 #error "STT_NUM has grown. Update dynsymsort_symtype[]."
120 #endif
121