/* This file defines standard ELF types, structures, and macros.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor (ian@cygnus.com).
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifndef _ELF_H
#define _ELF_H 1
/* Standard ELF types. Using __attribute__ mode ensures that GCC
will choose the right number of bits for these types. */
/* Type for a 16-bit quantity. */
typedef unsigned int Elf32_Half __attribute__ ((mode (HI)));
typedef unsigned int Elf64_Half __attribute__ ((mode (HI)));
/* Types for signed and unsigned 32-bit quantities. */
typedef unsigned int Elf32_Word __attribute__ ((mode (SI)));
typedef int Elf32_Sword __attribute__ ((mode (SI)));
typedef unsigned int Elf64_Word __attribute__ ((mode (SI)));
typedef int Elf64_Sword __attribute__ ((mode (SI)));
/* Types for signed and unsigned 64-bit quantities. */
typedef unsigned int Elf32_Xword __attribute__ ((mode (DI)));
typedef int Elf32_Sxword __attribute__ ((mode (DI)));
typedef unsigned int Elf64_Xword __attribute__ ((mode (DI)));
typedef int Elf64_Sxword __attribute__ ((mode (DI)));
/* Type of addresses. */
typedef unsigned int Elf32_Addr __attribute__ ((mode (SI)));
typedef unsigned int Elf64_Addr __attribute__ ((mode (DI)));
/* Type of file offsets. */
typedef unsigned int Elf32_Off __attribute__ ((mode (SI)));
typedef unsigned int Elf64_Off __attribute__ ((mode (DI)));
/* Type for section indices, which are 16-bit quantities. */
typedef unsigned int Elf32_Section __attribute__ ((mode (HI)));
typedef unsigned int Elf64_Section __attribute__ ((mode (HI)));
/* Type of symbol indices. */
typedef unsigned int Elf32_Symndx __attribute__ ((mode (SI)));
typedef unsigned int Elf64_Symndx __attribute__ ((mode (DI)));
/* The ELF file header. This appears at the start of every ELF file. */
#define EI_NIDENT (16)
typedef struct
{
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
Elf32_Half e_type; /* Object file type */
Elf32_Half e_machine; /* Architecture */
Elf32_Word e_version; /* Object file version */
Elf32_Addr e_entry; /* Entry poin