xref: /titanic_41/usr/src/cmd/sgs/libelf/common/data.c (revision 35a5a3587fd94b666239c157d3722745250ccbd7)
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 2009 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 #include <libelf.h>
31 #include "decl.h"
32 
33 /*
34  * Global data
35  * _elf_byte		Fill byte for file padding.  See elf_fill().
36  * _elf32_ehdr_init	Clean copy for to initialize new headers.
37  * _elf64_ehdr_init	Clean copy for to initialize new class-64 headers.
38  * _elf_encode		Host/internal data encoding.  If the host has
39  *			an encoding that matches one known for the
40  *			ELF format, this changes.  An machine with an
41  *			unknown encoding keeps ELFDATANONE and forces
42  *			conversion for host/target translation.
43  * _elf_work		Working version given to the lib by application.
44  *			See elf_version().
45  * _elf_globals_mutex	mutex to protect access to all global data items.
46  * _elf_execfill_func	Fill function for file padding of SHF_EXECINSTR
47  *			sections. See _elf_execfill().
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 _elf_execfill_func_t	*_elf_execfill_func = NULL;
66 const Snode32		_elf32_snode_init = { 0 };
67 const Snode64		_elf64_snode_init = { 0 };
68 const Dnode		_elf_dnode_init = { 0 };
69 unsigned		_elf_work = EV_NONE;
70 mutex_t			_elf_globals_mutex = DEFAULTMUTEX;
71 
72 int			*_elf_libc_threaded = &__libc_threaded;
73