xref: /titanic_44/usr/src/cmd/sgs/libelf/common/data.c (revision 9c9af2590af49bb395bc8d2eace0f2d4ea16d165)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1988 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <libelf.h>
33 #include "decl.h"
34 
35 /*
36  * Global data
37  * _elf_byte		Fill byte for file padding.  See elf_fill().
38  * _elf32_ehdr_init	Clean copy for to initialize new headers.
39  * _elf64_ehdr_init	Clean copy for to initialize new class-64 headers.
40  * _elf_encode		Host/internal data encoding.  If the host has
41  *			an encoding that matches one known for the
42  *			ELF format, this changes.  An machine with an
43  *			unknown encoding keeps ELFDATANONE and forces
44  *			conversion for host/target translation.
45  * _elf_work		Working version given to the lib by application.
46  *			See elf_version().
47  * _elf_globals_mutex	mutex to protect access to all global data items.
48  */
49 
50 /*
51  * __libc_threaded is a private symbol exported from libc in Solaris 10.
52  * It is used to tell if we are running in a threaded world or not.
53  * Between Solaris 2.5 and Solaris 9, this was named __threaded.
54  * The name had to be changed because the Sun Workshop 6 update 1
55  * compilation system used it to mean "we are linked with libthread"
56  * rather than its true meaning in Solaris 10, "more than one thread exists".
57  */
58 #pragma weak		__libc_threaded
59 extern int		__libc_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 = &__libc_threaded;
72