Newer
Older
ubix / src / sys / include / ubixos / elf.h
@reddawg reddawg on 3 Sep 2002 3 KB Working On Things
/**************************************************************************************
 Copyright (c) 2002 The UbixOS Project
 All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$

**************************************************************************************/

#ifndef _ELF_H
#define _ELF_H

#include <ubixos/types.h>

#define elfExecutable 0x002
#define elfLibrary    0x003

typedef struct {
  uChar  eIdent[16]; /* File identification. */
  uShort eType;      /* File type. */
  uShort eMachine;   /* Machine architecture. */
  uLong  eVersion;   /* ELF format version. */
  uLong  eEntry;     /* Entry point. */
  uLong  ePhoff;     /* Program header file offset. */
  uLong  eShoff;     /* Section header file offset. */
  uLong  eFlags;     /* Architecture-specific flags. */
  uShort eEhsize;    /* Size of ELF header in bytes. */
  uShort ePhentsize; /* Size of program header entry. */
  uShort ePhnum;     /* Number of program header entries. */
  uShort eShentsize; /* Size of section header entry. */
  uShort eShnum;     /* Number of section header entries. */
  uShort eShstrndx;  /* Section name strings section. */
  } elfHeader;

typedef struct {
  uLong phType;         /* Entry type. */
  uLong phOffset;       /* File offset of contents. */
  uLong phVaddr;        /* Virtual address in memory image. */
  uLong phPaddr;        /* Physical address (not used). */
  uLong phFilesz;       /* Size of contents in file. */
  uLong phMemsz;        /* Size of contents in memory. */
  uLong phFlags;        /* Access permission flags. */
  uLong phAlign;        /* Alignment in memory and file. */
  } elfProgramheader;

typedef struct {
  uLong shName;        /* Section name (index into the section header string table). */
  uLong shType;        /* Section type. */
  uLong shFlags;       /* Section flags. */
  uLong shAddr;        /* Address in memory image. */
  uLong shOffset;      /* Offset in file. */
  uLong shSize;        /* Size in bytes. */
  uLong shLink;        /* Index of a related section. */
  uLong shInfo;        /* Depends on section type. */
  uLong shAddralign;   /* Alignment in bytes. */
  uLong shEntsize;     /* Size of each entry in section. */
  } elfSectionheader;

typedef struct {
  uLong pltOffset;
  uLong pltInfo;
  } elfPltInfo;

typedef struct {
  uLong dynName;
  uLong dynValue;
  uLong dynSize;
  uLong dynInfo;
  } elfDynsym;

typedef struct {
  uLong a;
  uLong b;
  } elfDynamic;
  

#endif