mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-17 21:09:03 +00:00
131 lines
5.6 KiB
C
131 lines
5.6 KiB
C
|
/*
|
||
|
* Copyright (c) 2006, Swedish Institute of Computer Science
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* Redistribution and use in source and binary forms, with or without
|
||
|
* modification, are permitted provided that the following conditions
|
||
|
* are met:
|
||
|
* 1. Redistributions of source code must retain the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer.
|
||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer in the
|
||
|
* documentation and/or other materials provided with the distribution.
|
||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||
|
* may be used to endorse or promote products derived from this software
|
||
|
* without specific prior written permission.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
|
* SUCH DAMAGE.
|
||
|
*
|
||
|
* @(#)$Id: elf32.h,v 1.1 2006/12/01 15:12:27 bg- Exp $
|
||
|
*/
|
||
|
|
||
|
/* @(#)$Id: elf32.h,v 1.1 2006/12/01 15:12:27 bg- Exp $ */
|
||
|
|
||
|
#ifndef ELF32_H
|
||
|
#define ELF32_H
|
||
|
|
||
|
/*
|
||
|
* ELF definitions common to all 32-bit architectures.
|
||
|
*/
|
||
|
|
||
|
#define EI_NIDENT 16
|
||
|
|
||
|
typedef unsigned long elf32_word;
|
||
|
typedef signed long elf32_sword;
|
||
|
typedef unsigned short elf32_half;
|
||
|
typedef unsigned long elf32_off;
|
||
|
typedef unsigned long elf32_addr;
|
||
|
|
||
|
struct elf32_ehdr {
|
||
|
unsigned char e_ident[EI_NIDENT]; /* ident bytes */
|
||
|
elf32_half e_type; /* file type */
|
||
|
elf32_half e_machine; /* target machine */
|
||
|
elf32_word e_version; /* file version */
|
||
|
elf32_addr e_entry; /* start address */
|
||
|
elf32_off e_phoff; /* phdr file offset */
|
||
|
elf32_off e_shoff; /* shdr file offset */
|
||
|
elf32_word e_flags; /* file flags */
|
||
|
elf32_half e_ehsize; /* sizeof ehdr */
|
||
|
elf32_half e_phentsize; /* sizeof phdr */
|
||
|
elf32_half e_phnum; /* number phdrs */
|
||
|
elf32_half e_shentsize; /* sizeof shdr */
|
||
|
elf32_half e_shnum; /* number shdrs */
|
||
|
elf32_half e_shstrndx; /* shdr string index */
|
||
|
};
|
||
|
|
||
|
/* Values for e_type. */
|
||
|
#define ET_NONE 0 /* Unknown type. */
|
||
|
#define ET_REL 1 /* Relocatable. */
|
||
|
#define ET_EXEC 2 /* Executable. */
|
||
|
#define ET_DYN 3 /* Shared object. */
|
||
|
#define ET_CORE 4 /* Core file. */
|
||
|
|
||
|
struct elf32_shdr {
|
||
|
elf32_word sh_name; /* section name */
|
||
|
elf32_word sh_type; /* SHT_... */
|
||
|
elf32_word sh_flags; /* SHF_... */
|
||
|
elf32_addr sh_addr; /* virtual address */
|
||
|
elf32_off sh_offset; /* file offset */
|
||
|
elf32_word sh_size; /* section size */
|
||
|
elf32_word sh_link; /* misc info */
|
||
|
elf32_word sh_info; /* misc info */
|
||
|
elf32_word sh_addralign; /* memory alignment */
|
||
|
elf32_word sh_entsize; /* entry size if table */
|
||
|
};
|
||
|
|
||
|
/* sh_type */
|
||
|
#define SHT_NULL 0 /* inactive */
|
||
|
#define SHT_PROGBITS 1 /* program defined information */
|
||
|
#define SHT_SYMTAB 2 /* symbol table section */
|
||
|
#define SHT_STRTAB 3 /* string table section */
|
||
|
#define SHT_RELA 4 /* relocation section with addends*/
|
||
|
#define SHT_HASH 5 /* symbol hash table section */
|
||
|
#define SHT_DYNAMIC 6 /* dynamic section */
|
||
|
#define SHT_NOTE 7 /* note section */
|
||
|
#define SHT_NOBITS 8 /* no space section */
|
||
|
#define SHT_REL 9 /* relation section without addends */
|
||
|
#define SHT_SHLIB 10 /* reserved - purpose unknown */
|
||
|
#define SHT_DYNSYM 11 /* dynamic symbol table section */
|
||
|
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
|
||
|
#define SHT_HIPROC 0x7fffffff /* specific section header types */
|
||
|
#define SHT_LOUSER 0x80000000 /* reserved range for application */
|
||
|
#define SHT_HIUSER 0xffffffff /* specific indexes */
|
||
|
|
||
|
struct elf32_rel {
|
||
|
elf32_addr r_offset; /* Location to be relocated. */
|
||
|
elf32_word r_info; /* Relocation type and symbol index. */
|
||
|
};
|
||
|
|
||
|
struct elf32_rela {
|
||
|
elf32_addr r_offset; /* Location to be relocated. */
|
||
|
elf32_word r_info; /* Relocation type and symbol index. */
|
||
|
elf32_sword r_addend; /* Addend. */
|
||
|
};
|
||
|
|
||
|
struct elf32_sym {
|
||
|
elf32_word st_name; /* String table index of name. */
|
||
|
elf32_addr st_value; /* Symbol value. */
|
||
|
elf32_word st_size; /* Size of associated object. */
|
||
|
unsigned char st_info; /* Type and binding information. */
|
||
|
unsigned char st_other; /* Reserved (not used). */
|
||
|
elf32_half st_shndx; /* Section index of symbol. */
|
||
|
};
|
||
|
|
||
|
#define ELF32_R_SYM(info) ((info) >> 8)
|
||
|
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||
|
|
||
|
#define ELF_MAGIC_HEADER "\177ELF\001\001\001"
|
||
|
#define ELF_MAGIC_HEADER_SIZE 7
|
||
|
|
||
|
#endif /* ELF32_H */
|