xref: /illumos-gate/usr/src/cmd/sgs/libelf/common/data.c (revision 4e5b757f)
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 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 /*
26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
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  * __libc_threaded is a private symbol exported from libc in Solaris 10.
55  * It is used to tell if we are running in a threaded world or not.
56  * Between Solaris 2.5 and Solaris 9, this was named __threaded.
57  * The name had to be changed because the Sun Workshop 6 update 1
58  * compilation system used it to mean "we are linked with libthread"
59  * rather than its true meaning in Solaris 10, "more than one thread exists".
60  */
61 #pragma weak		__libc_threaded
62 extern int		__libc_threaded;
63 
64 int			_elf_byte = 0;
65 const Elf32_Ehdr	_elf32_ehdr_init = { 0 };
66 const Elf64_Ehdr	_elf64_ehdr_init = { 0 };
67 unsigned		_elf_encode = ELFDATANONE;
68 const Snode32		_elf32_snode_init = { 0 };
69 const Snode64		_elf64_snode_init = { 0 };
70 const Dnode		_elf_dnode_init = { 0 };
71 unsigned		_elf_work = EV_NONE;
72 mutex_t			_elf_globals_mutex = DEFAULTMUTEX;
73 
74 int			*_elf_libc_threaded = &__libc_threaded;
75