xref: /illumos-gate/usr/src/cmd/sgs/libelf/common/data.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 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 /*
26  * Copyright (c) 1998 by Sun Microsystems, Inc.
27  * All rights reserved.
28  */
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI" 	/* SVr4.0 1.3	*/
31 
32 
33 #include "syn.h"
34 #include <libelf.h>
35 #include "decl.h"
36 
37 
38 /*
39  * Global data
40  * _elf_byte		Fill byte for file padding.  See elf_fill().
41  * _elf32_ehdr_init	Clean copy for to initialize new headers.
42  * _elf64_ehdr_init	Clean copy for to initialize new class-64 headers.
43  * _elf_encode		Host/internal data encoding.  If the host has
44  *			an encoding that matches one known for the
45  *			ELF format, this changes.  An machine with an
46  *			unknown encoding keeps ELFDATANONE and forces
47  *			conversion for host/target translation.
48  * _elf_work		Working version given to the lib by application.
49  *			See elf_version().
50  * _elf_globals_mutex	mutex to protect access to all global data items.
51  */
52 
53 /*
54  * __threaded is a private symbol exported on Solaris2.5 systems and
55  * later.  It is used to tell if we are running in a threaded world or
56  * not.
57  */
58 #pragma weak		__threaded
59 extern int		__threaded;
60 
61 int			_elf_byte = 0;
62 const Elf32_Ehdr	_elf32_ehdr_init = { 0 };
63 const Elf64_Ehdr	_elf64_ehdr_init = { 0 };
64 unsigned		_elf_encode = ELFDATANONE;
65 const Snode32		_elf32_snode_init = { 0 };
66 const Snode64		_elf64_snode_init = { 0 };
67 const Dnode		_elf_dnode_init = { 0 };
68 unsigned		_elf_work = EV_NONE;
69 mutex_t			_elf_globals_mutex = DEFAULTMUTEX;
70 
71 int *			_elf_libc_threaded = &__threaded;
72