elf.h revision 25984
1272343Sngie/*- 2272343Sngie * Copyright (c) 1996-1997 John D. Polstra. 3272343Sngie * All rights reserved. 4272343Sngie * 5272343Sngie * Redistribution and use in source and binary forms, with or without 6272343Sngie * modification, are permitted provided that the following conditions 7272343Sngie * are met: 8272343Sngie * 1. Redistributions of source code must retain the above copyright 9272343Sngie * notice, this list of conditions and the following disclaimer. 10272343Sngie * 2. Redistributions in binary form must reproduce the above copyright 11272343Sngie * notice, this list of conditions and the following disclaimer in the 12272343Sngie * documentation and/or other materials provided with the distribution. 13272343Sngie * 14272343Sngie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15272343Sngie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16272343Sngie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17272343Sngie * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18272343Sngie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19272343Sngie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20272343Sngie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21272343Sngie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22272343Sngie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23272343Sngie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24272343Sngie * SUCH DAMAGE. 25272343Sngie * 26272343Sngie * $Id$ 27272343Sngie */ 28272343Sngie 29272343Sngie#ifndef _MACHINE_ELF_H_ 30272343Sngie#define _MACHINE_ELF_H_ 1 31272343Sngie 32272343Sngie/* 33272343Sngie * ELF definitions for the i386 architecture. 34272343Sngie */ 35272343Sngie 36272343Sngie#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */ 37272343Sngie 38272343Sngie/* 39272343Sngie * Auxiliary vector entries for passing information to the interpreter. 40272343Sngie * 41272343Sngie * The i386 supplement to the SVR4 ABI specification names this "auxv_t", 42272343Sngie * but POSIX lays claim to all symbols ending with "_t". 43272343Sngie */ 44272343Sngie 45272343Sngietypedef struct { /* Auxiliary vector entry on initial stack */ 46272343Sngie int a_type; /* Entry type. */ 47272343Sngie union { 48272343Sngie long a_val; /* Integer value. */ 49272343Sngie void *a_ptr; /* Address. */ 50272343Sngie void (*a_fcn)(void); /* Function pointer (not used). */ 51272343Sngie } a_un; 52272343Sngie} Elf32_Auxinfo; 53272343Sngie 54272343Sngie/* Values for a_type. */ 55272343Sngie#define AT_NULL 0 /* Terminates the vector. */ 56272343Sngie#define AT_IGNORE 1 /* Ignored entry. */ 57272343Sngie#define AT_EXECFD 2 /* File descriptor of program to load. */ 58272343Sngie#define AT_PHDR 3 /* Program header of program already loaded. */ 59272343Sngie#define AT_PHENT 4 /* Size of each program header entry. */ 60272343Sngie#define AT_PHNUM 5 /* Number of program header entries. */ 61272343Sngie#define AT_PAGESZ 6 /* Page size in bytes. */ 62272343Sngie#define AT_BASE 7 /* Interpreter's base address. */ 63272343Sngie#define AT_FLAGS 8 /* Flags (unused for i386). */ 64272343Sngie#define AT_ENTRY 9 /* Where interpreter should transfer control. */ 65272343Sngie 66272343Sngie/* 67272343Sngie * The following non-standard values are used for passing information 68272343Sngie * from John Polstra's testbed program to the dynamic linker. These 69272343Sngie * are expected to go away soon. 70272343Sngie * 71272343Sngie * Unfortunately, these overlap the Linux non-standard values, so they 72272343Sngie * must not be used in the same context. 73272343Sngie */ 74272343Sngie#define AT_BRK 10 /* Starting point for sbrk and brk. */ 75272343Sngie#define AT_DEBUG 11 /* Debugging level. */ 76272343Sngie 77272343Sngie/* 78272343Sngie * The following non-standard values are used in Linux ELF binaries. 79272343Sngie */ 80272343Sngie#define AT_NOTELF 10 /* Program is not ELF ?? */ 81272343Sngie#define AT_UID 11 /* Real uid. */ 82272343Sngie#define AT_EUID 12 /* Effective uid. */ 83272343Sngie#define AT_GID 13 /* Real gid. */ 84272343Sngie#define AT_EGID 14 /* Effective gid. */ 85272343Sngie 86272343Sngie#define AT_COUNT 15 /* Count of defined aux entry types. */ 87272343Sngie 88272343Sngie/* 89272343Sngie * Relocation types. 90272343Sngie */ 91272343Sngie 92272343Sngie#define R_386_NONE 0 /* No relocation. */ 93272343Sngie#define R_386_32 1 /* Add symbol value. */ 94272343Sngie#define R_386_PC32 2 /* Add PC-relative symbol value. */ 95272343Sngie#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ 96272343Sngie#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ 97272343Sngie#define R_386_COPY 5 /* Copy data from shared object. */ 98272343Sngie#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ 99272343Sngie#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ 100272343Sngie#define R_386_RELATIVE 8 /* Add load address of shared object. */ 101272343Sngie#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ 102272343Sngie#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ 103272343Sngie 104272343Sngie#define R_386_COUNT 11 /* Count of defined relocation types. */ 105272343Sngie 106272343Sngie#endif /* !_MACHINE_ELF_H_ */ 107272343Sngie