xref: /illumos-gate/usr/src/cmd/sgs/libld/common/globals.c (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	Copyright (c) 1988 AT&T
24  *	  All Rights Reserved
25  *
26  *
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Global variables
34  */
35 #include	<sys/elf.h>
36 #include	"msg.h"
37 #include	"_libld.h"
38 
39 Ofl_desc	Ofl;		/* provided for signal handler */
40 Ld_heap *	ld_heap;	/* list of allocated blocks for */
41 				/* 	link-edit dynamic allocations */
42 List		lib_support;	/* List of support libraries specified */
43 				/*	(-S option) */
44 
45 uint_t		dbg_mask = 0;	/* liblddbg enabled */
46 
47 /*
48  * Paths and directories for library searches.  These are used to set up
49  * linked lists of directories which are maintained in the ofl structure.
50  */
51 char		*Plibpath;	/* User specified -YP or defaults to LIBPATH */
52 char		*Llibdir;	/* User specified -YL */
53 char		*Ulibdir;	/* User specified -YU */
54 Listnode	*insert_lib;	/* insertion point for -L libraries */
55 
56 /*
57  * liblddbg sometimes takes an ehdr in order to figure out the elf class or
58  * machine type.  Symbols that are added by ld, such as _etext, don't have a
59  * corresponding ehdr, so we pass this instead.
60  */
61 Ehdr		def_ehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3,
62 			M_CLASS, M_DATA }, 0, M_MACH };
63 
64 /*
65  * For backward compatibility provide a /dev/zero file descriptor.
66  */
67 int		dz_fd = -1;
68 
69 /*
70  * Rejected file error messages (indexed to match FLG_RJC_ values).
71  */
72 const Msg
73 reject[] = {
74 		MSG_STR_EMPTY,
75 		MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
76 		MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
77 		MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
78 		MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
79 		MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
80 		MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
81 		MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
82 		MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
83 		MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
84 		MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
85 		MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
86 		MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
87 	};
88