xref: /onnv-gate/usr/src/cmd/sgs/libelf/common/data.c (revision 10809:c7cff361425e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51672Sraf  * Common Development and Distribution License (the "License").
61672Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211672Sraf 
220Sstevel@tonic-gate /*
23*10809SAli.Bahrami@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
241672Sraf  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
276812Sraf /*	Copyright (c) 1988 AT&T	*/
286812Sraf /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <libelf.h>
310Sstevel@tonic-gate #include "decl.h"
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * Global data
350Sstevel@tonic-gate  * _elf_byte		Fill byte for file padding.  See elf_fill().
360Sstevel@tonic-gate  * _elf32_ehdr_init	Clean copy for to initialize new headers.
370Sstevel@tonic-gate  * _elf64_ehdr_init	Clean copy for to initialize new class-64 headers.
380Sstevel@tonic-gate  * _elf_encode		Host/internal data encoding.  If the host has
390Sstevel@tonic-gate  *			an encoding that matches one known for the
400Sstevel@tonic-gate  *			ELF format, this changes.  An machine with an
410Sstevel@tonic-gate  *			unknown encoding keeps ELFDATANONE and forces
420Sstevel@tonic-gate  *			conversion for host/target translation.
430Sstevel@tonic-gate  * _elf_work		Working version given to the lib by application.
440Sstevel@tonic-gate  *			See elf_version().
450Sstevel@tonic-gate  * _elf_globals_mutex	mutex to protect access to all global data items.
46*10809SAli.Bahrami@Sun.COM  * _elf_execfill_func	Fill function for file padding of SHF_EXECINSTR
47*10809SAli.Bahrami@Sun.COM  *			sections. See _elf_execfill().
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate /*
511672Sraf  * __libc_threaded is a private symbol exported from libc in Solaris 10.
521672Sraf  * It is used to tell if we are running in a threaded world or not.
531672Sraf  * Between Solaris 2.5 and Solaris 9, this was named __threaded.
541672Sraf  * The name had to be changed because the Sun Workshop 6 update 1
551672Sraf  * compilation system used it to mean "we are linked with libthread"
561672Sraf  * rather than its true meaning in Solaris 10, "more than one thread exists".
570Sstevel@tonic-gate  */
581672Sraf #pragma weak		__libc_threaded
591672Sraf extern int		__libc_threaded;
600Sstevel@tonic-gate 
610Sstevel@tonic-gate int			_elf_byte = 0;
620Sstevel@tonic-gate const Elf32_Ehdr	_elf32_ehdr_init = { 0 };
630Sstevel@tonic-gate const Elf64_Ehdr	_elf64_ehdr_init = { 0 };
640Sstevel@tonic-gate unsigned		_elf_encode = ELFDATANONE;
65*10809SAli.Bahrami@Sun.COM _elf_execfill_func_t	*_elf_execfill_func = NULL;
660Sstevel@tonic-gate const Snode32		_elf32_snode_init = { 0 };
670Sstevel@tonic-gate const Snode64		_elf64_snode_init = { 0 };
680Sstevel@tonic-gate const Dnode		_elf_dnode_init = { 0 };
690Sstevel@tonic-gate unsigned		_elf_work = EV_NONE;
700Sstevel@tonic-gate mutex_t			_elf_globals_mutex = DEFAULTMUTEX;
710Sstevel@tonic-gate 
721672Sraf int			*_elf_libc_threaded = &__libc_threaded;
73