1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Shamelessly taken from elf.h (copyright header below)
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* This file defines standard ELF types, structures, and macros.
23 Copyright (C) 1995-2003,2004,2005,2006,2007 Free Software Foundation, Inc.
24 This file is part of the GNU C Library.
26 The GNU C Library is free software; you can redistribute it and/or
27 modify it under the terms of the GNU Lesser General Public
28 License as published by the Free Software Foundation; either
29 version 2.1 of the License, or (at your option) any later version.
31 The GNU C Library is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 Lesser General Public License for more details.
36 You should have received a copy of the GNU Lesser General Public
37 License along with the GNU C Library; if not, write to the Free
38 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
46 /* Type for a 16-bit quantity. */
47 typedef uint16_t Elf32_Half
;
49 /* Types for signed and unsigned 32-bit quantities. */
50 typedef uint32_t Elf32_Word
;
51 typedef int32_t Elf32_Sword
;
53 /* Types for signed and unsigned 64-bit quantities. */
54 typedef uint64_t Elf32_Xword
;
55 typedef int64_t Elf32_Sxword
;
57 /* Type of addresses. */
58 typedef uint32_t Elf32_Addr
;
60 /* Type of file offsets. */
61 typedef uint32_t Elf32_Off
;
63 /* Type for section indices, which are 16-bit quantities. */
64 typedef uint16_t Elf32_Section
;
66 #define EI_NIDENT (16)
70 unsigned char e_ident
[EI_NIDENT
]; /* Magic number and other info */
71 Elf32_Half e_type
; /* Object file type */
72 Elf32_Half e_machine
; /* Architecture */
73 Elf32_Word e_version
; /* Object file version */
74 Elf32_Addr e_entry
; /* Entry point virtual address */
75 Elf32_Off e_phoff
; /* Program header table file offset */
76 Elf32_Off e_shoff
; /* Section header table file offset */
77 Elf32_Word e_flags
; /* Processor-specific flags */
78 Elf32_Half e_ehsize
; /* ELF header size in bytes */
79 Elf32_Half e_phentsize
; /* Program header table entry size */
80 Elf32_Half e_phnum
; /* Program header table entry count */
81 Elf32_Half e_shentsize
; /* Section header table entry size */
82 Elf32_Half e_shnum
; /* Section header table entry count */
83 Elf32_Half e_shstrndx
; /* Section header string table index */
88 Elf32_Word sh_name
; /* Section name (string tbl index) */
89 Elf32_Word sh_type
; /* Section type */
90 Elf32_Word sh_flags
; /* Section flags */
91 Elf32_Addr sh_addr
; /* Section virtual addr at execution */
92 Elf32_Off sh_offset
; /* Section file offset */
93 Elf32_Word sh_size
; /* Section size in bytes */
94 Elf32_Word sh_link
; /* Link to another section */
95 Elf32_Word sh_info
; /* Additional section information */
96 Elf32_Word sh_addralign
; /* Section alignment */
97 Elf32_Word sh_entsize
; /* Entry size if section holds table */
100 #define ELFMAG0 0x7f /* Magic number byte 0 */
101 #define ELFMAG1 'E' /* Magic number byte 1 */
102 #define ELFMAG2 'L' /* Magic number byte 2 */
103 #define ELFMAG3 'F' /* Magic number byte 3 */
105 #define SHF_WRITE (1 << 0) /* Writable */
106 #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
107 #define SHF_EXECINSTR (1 << 2) /* Executable */
109 #define SHT_NOBITS 8 /* Program space with no data (bss) */
111 #endif /* _MAC_ELF_H */