1116742Ssam/*- 2116904Ssam * Copyright (c) 2006 Joseph Koshy 3178354Ssam * All rights reserved. 4116742Ssam * 5116742Ssam * Redistribution and use in source and binary forms, with or without 6116742Ssam * modification, are permitted provided that the following conditions 7116742Ssam * are met: 8116742Ssam * 1. Redistributions of source code must retain the above copyright 9116742Ssam * notice, this list of conditions and the following disclaimer. 10116904Ssam * 2. Redistributions in binary form must reproduce the above copyright 11116904Ssam * notice, this list of conditions and the following disclaimer in the 12116904Ssam * documentation and/or other materials provided with the distribution. 13116904Ssam * 14116742Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15116904Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16116904Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17116904Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18116904Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19116904Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20116904Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21116904Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22116904Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23116904Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24116904Ssam * SUCH DAMAGE. 25116742Ssam */ 26116742Ssam 27116742Ssam#include <sys/cdefs.h> 28116742Ssam__FBSDID("$FreeBSD$"); 29116742Ssam 30116742Ssam#include <sys/param.h> 31116742Ssam 32116742Ssam#include <machine/elf.h> 33116742Ssam#include <machine/endian.h> 34116742Ssam 35178354Ssam#include <libelf.h> 36116742Ssam 37116742Ssam#include "_libelf.h" 38138568Ssam 39170530Ssamstruct _libelf_globals _libelf = { 40170530Ssam .libelf_arch = ELF_ARCH, 41116742Ssam .libelf_byteorder = ELF_TARG_DATA, 42178354Ssam .libelf_class = ELF_TARG_CLASS, 43116742Ssam .libelf_error = 0, 44116742Ssam .libelf_fillchar = 0, 45116742Ssam .libelf_version = EV_NONE 46138568Ssam}; 47116742Ssam 48116742Ssam 49178354Ssam#if defined(LIBELF_TEST_HOOKS) 50178354Ssamint 51178354Ssam_libelf_get_elf_class(Elf *elf) 52178354Ssam{ 53195618Srpaulo return elf->e_class; 54195618Srpaulo} 55195618Srpaulo 56178354Ssamvoid 57178354Ssam_libelf_set_elf_class(Elf *elf, int c) 58116742Ssam{ 59138568Ssam elf->e_class = c; 60138568Ssam} 61138568Ssam#endif /* LIBELF_TEST_HOOKS */ 62116742Ssam