Renamed build.tests to build.test1

git-svn-id: svn://svn.berlios.de/openocd/trunk@1276 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
duane
2008-12-27 01:30:06 +00:00
parent f7274784a2
commit 92c9d46449
13 changed files with 0 additions and 0 deletions

90
testing/build.test1/Makefile Executable file
View File

@@ -0,0 +1,90 @@
# -*- mode: makefile -*-
#
default: _complain_
include ./local.uses
%: _complain_
_complain_:
@echo ""
@echo " Try the target: cygwin.buildtest or linux.buildtest "
@echo ""
remove.install:
rm -rf ${INSTALL_DIR}
.PHONY: remove.install
cygwin.buildtest:
${MAKE} -f Makefile.ftd2xx clean all
${MAKE} -f Makefile.openocd cygwin.easy.permutations
${MAKE} -f Makefile.openocd mingw32.easy.permutations
${MAKE} -f Makefile.libftdi all
${MAKE} -f Makefile.openocd cygwin.libftdi
linux.buildtest:
${MAKE} linux.easy.buildtest
${MAKE} linux.ftd2xx_installed
${MAKE} linux.ft2232_libftdi
@echo ""
@echo ""
@echo "========================================"
@echo " Linux Build Tests Complete "
@echo "========================================"
@echo ""
@echo ""
linux.easy.buildtest:
@test -d openocd || (echo "Where the source to openocd?" && exit 1)
${MAKE} -f Makefile.openocd bootstrap
${MAKE} -f Makefile.ftd2xx all
${MAKE} -f Makefile.openocd linux.easy.permutations
linux.ftd2xx_installed:
${MAKE} remove.install
${MAKE} linux.ftd2xx_installed.setup
${MAKE} -f Makefile.openocd $@
linux.ft2232_libftdi:
${MAKE} remove.install
${MAKE} -f Makefile.libusb all
${MAKE} -f Makefile.confuse all
${MAKE} -f Makefile.libftdi all
${MAKE} -f Makefile.openocd $@
# This target is used to "install" files from
# the FTDICHIP.COM tar.gz unpack directory
# into "a proper place" - where they should be found.
linux.ftd2xx_installed.setup:
mkdir -p ${INSTALL_DIR}/include
mkdir -p ${EXEC_PREFIX}/lib
@#
@# Sanity check - make sure the .H file is findable
@#
@f=$(FTD2XX_LINUX_DIR)/ftd2xx.h && \
test -f $$f || (echo "Error: $$f not found" ; exit 1)
@#
@# Header files are simple... just copy them.
@#
cp $(FTD2XX_LINUX_DIR)/ftd2xx.h $(PREFIX)/include/.
cp $(FTD2XX_LINUX_DIR)/WinTypes.h $(PREFIX)/include/.
@#
@# .SO files are harder.
@# (1) copy them, (2) make links
@#
cp $(FTD2XX_LINUX_DIR)/libftd2xx.so.$(FTD2XX_LINUX_VERSION) $(EXEC_PREFIX)/lib/.
cd $(EXEC_PREFIX)/lib && rm -f libftd2xx.so.0
cd $(EXEC_PREFIX)/lib && ln -s libftd2xx.so.$(FTD2XX_LINUX_VERSION) libftd2xx.so.0
cd $(EXEC_PREFIX)/lib && rm -f libftd2xx.so
cd $(EXEC_PREFIX)/lib && ln -s libftd2xx.so.$(FTD2XX_LINUX_VERSION) libftd2xx.so
.PHONY: linux.buildtest \
linux.easy.buildtest \
linux.ftd2xx_installed \
linux.ft22232_libftdi \
linux.ftd2xx_installed.setup

View File

@@ -0,0 +1,46 @@
# -*- mode: makefile -*-
default: _complain_
include ./local.uses
TARFILE_LOCAL=${VIRGINS}/confuse-${LIBCONFUSE_VERSION}.tar.gz
TARFILE_URL =http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/confuse-${LIBCONFUSE_VERSION}.tar.gz
CONFUSE_SRC_DIR =${HERE}/confuse-${LIBCONFUSE_VERSION}
CONFUSE_BUILD_DIR =${HERE}/confuse-build
download:
wget -O ${TARFILE_LOCAL} ${TARFILE_URL}
unpack:
rm -rf ${CONFUSE_SRC_DIR}
tar xfz ${TARFILE_LOCAL}
clean::
rm -rf ${CONFUSE_SRC_DIR}
configure:
rm -rf ${CONFUSE_BUILD_DIR}
mkdir ${CONFUSE_BUILD_DIR}
cd ${CONFUSE_BUILD_DIR} && ${CONFUSE_SRC_DIR}/configure \
--prefix=${PREFIX} \
--exec-prefix=${EXEC_PREFIX}
clean::
rm -rf ${CONFUSE_BUILD_DIR}
build:
cd ${CONFUSE_BUILD_DIR} && ${MAKE}
install:
cd ${CONFUSE_BUILD_DIR} && ${MAKE} install
all: unpack configure build install
_complain_:
@echo ""
@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
@echo " Or read the makefile and learn about the permutation test targets"
@echo ""
@echo "You also might find the download and unpack targets helpful."
@echo ""
@exit 1

View File

@@ -0,0 +1,88 @@
# -*- mode: makefile -*-
#
default: _complain_
include ./local.uses
# WARNING... the file on the ftdi chip site has a SPACE in the filename GRRR!!!
# We fix that with the "-O" option to wget.
ZIPFILE_LOCAL=${VIRGINS}/cdm.${FTD2XX_WIN32_VERSION}.zip
ZIPFILE_URL ="http://www.ftdichip.com/Drivers/CDM/CDM ${FTD2XX_WIN32_VERSION}.zip"
TARFILE_LOCAL=${VIRGINS}/libftd2xx${FTD2XX_LINUX_VERSION}.tar.gz
TARFILE_URL =http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx${FTD2XX_LINUX_VERSION}.tar.gz
TARFILE_64_LOCAL=${VIRGINS}/libftd2xx${FTD2XX_LINUX_VERSION}_x86_64.tar.gz
TARFILE_64_URL =http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx${FTD2XX_LINUX_VERSION}_x86_64.tar.gz
download.win32:
mkdir -p ${VIRGINS}
wget -O ${ZIPFILE_LOCAL} ${ZIPFILE_URL}
unpack.win32:
rm -rf ${FTD2XX_WIN32_DIR}
mkdir -p ${FTD2XX_WIN32_DIR}
cd ${FTD2XX_WIN32_DIR} && unzip ${ZIPFILE_LOCAL}
clean::
rm -rf ${FTD2XX_WIN32_DIR}
download.linux:
mkdir -p ${VIRGINS}
wget -O ${TARFILE_LOCAL} ${TARFILE_URL}
clean::
rm -rf ${FTD2XX_LINUX_DIR}
unpack.linux:
rm -rf ${FTD2XX_LINUX_DIR}
mkdir -p ${FTD2XX_LINUX_DIR}
tar xfz ${TARFILE_LOCAL}
download.linux.x86_64:
mkdir -p ${VIRGINS}
wget -O ${TARFILE_LOCAL} ${TARFILE_URL}
unpack.linux.x86_64:
rm -rf ${FTD2XX_LINUX_64_DIR}
mkdir -p ${FTD2XX_LINUX_64_DIR}
tar xfz ${TARFILE_64_LOCAL}
clean::
rm -rf ${FTD2XX_LINUX_64_DIR}
download: download.win32 download.linux
unpack.cygwin unpack.mingw32: unpack.win32
unpack: unpack.${BUILD_SYSNAME}
# Nothing to do here
build:
@echo "Done"
#Nothing to do here
configure:
@echo "Done"
# Nothing to do here
install:
@echo "Done"
all: unpack configure build install
.PHONY: install
# Nothing to do here
clean::
@echo "Done"
_complain_:
@echo ""
@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
@echo " Or read the makefile and learn about the permutation test targets"
@echo ""
@echo "You also might find the download and unpack targets helpful."
@echo ""
@exit 1

View File

@@ -0,0 +1,51 @@
# -*- mode: makefile -*-
default: _complain_
include ./local.uses
TARFILE_LOCAL = ${VIRGINS}/libftdi-${LIBFTDI_VERSION}.tar.gz
TARFILE_URL = http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/libftdi-${LIBFTDI_VERSION}.tar.gz
LIBFTDI_SRC_DIR = ${HERE}/libftdi-${LIBFTDI_VERSION}
LIBFTDI_BUILD_DIR= ${HERE}/libftdi-build
download:
mkdir -p virgins
wget -O ${TARFILE_LOCAL} ${TARFILE_URL}
clean::
rm -rf ${LIBFTDI_SRC_DIR}
unpack:
tar xf ${TARFILE_LOCAL}
PATH := ${EXEC_PREFIX}/bin:${PATH}
export PATH
clean::
rm -rf ${LIBFTDI_BUILD_DIR}
configure:
rm -rf ${LIBFTDI_BUILD_DIR}
mkdir -p ${LIBFTDI_BUILD_DIR}
cd ${LIBFTDI_BUILD_DIR} && ${LIBFTDI_SRC_DIR}/configure \
--prefix=${PREFIX} \
--exec-prefix=${EXEC_PREFIX}
build:
cd ${LIBFTDI_BUILD_DIR} && ${MAKE}
install:
cd ${LIBFTDI_BUILD_DIR} && ${MAKE} install
all: unpack configure build install
.PHONY: install
_complain_:
@echo ""
@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
@echo " Or read the makefile and learn about the permutation test targets"
@echo ""
@echo "You also might find the download and unpack targets helpful."
@echo ""
@exit 1

View File

@@ -0,0 +1,55 @@
# -*- mode: makefile -*-
default: _complain_
include ./local.uses
ifeq (x"$BUILD_SYSNAME",x"cygwin")
$(error Please use the Win32 specific port of LibUSB not the Unix version)
endif
ifeq (x"$BUILD_SYSNAME",x"mingw32")
$(error Please use the win32 specific port of LibUSB not the Unix version)
endif
TARFILE_LOCAL = ${VIRGINS}/libusb-${LIBUSB_VERSION}.tar.bz2
TARFILE_URL = http://downloads.sourceforge.net/libusb/libusb-${LIBUSB_VERSION}.tar.gz
LIBUSB_SRC_DIR = ${HERE}/libusb-${LIBUSB_VERSION}
LIBUSB_BUILD_DIR = ${HERE}/libusb-build
download:
wget -O ${TARFILE_LOCAL} ${TARFILE_URL}
unpack:
rm -rf ${LIBUSB_SRC_DIR}
tar xfz ${TARFILE_LOCAL}
clean::
rm -rf ${LIBUSB_SRC_DIR}
configure:
rm -rf ${LIBUSB_BUILD_DIR}
mkdir -p ${LIBUSB_BUILD_DIR}
cd ${LIBUSB_BUILD_DIR} && ${LIBUSB_SRC_DIR}/configure \
--prefix=${PREFIX} --exec-prefix=${EXEC_PREFIX}
clean::
rm -rf ${LIBUSB_BUILD_DIR}
build:
cd ${LIBUSB_BUILD_DIR} && ${MAKE}
install:
cd ${LIBUSB_BUILD_DIR} && ${MAKE} install
all: unpack configure build install
.PHONY: install
_complain_:
@echo ""
@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
@echo " Or read the makefile and learn about the permutation test targets"
@echo ""
@echo "You also might find the download and unpack targets helpful."
@echo ""
@exit 1

View File

@@ -0,0 +1,193 @@
# -*- mode: makefile -*-
#
default: _complain_
include ./local.uses
SRC_DIR ?= $(HERE)/openocd
BUILD_SUFFIX ?= $(BUILD_MACHINE)
BUILD_DIR =$(HERE)/openocd.$(BUILD_SUFFIX)
checkout:
svn co https://svn.berlios.de/svnroot/repos/openocd/trunk openocd
remove.install:
rm -rf ${INSTALL_DIR}
#========================================
# Win32 Build Permutations
# none
# parport
# ftd2xx - (ftdichip)
# libftd
CONFIG_OPTIONS_win32_none =
CONFIG_OPTIONS_win32_parport = --enable-parport
CONFIG_OPTIONS_win32_ftd2xx = --enable-parport --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_WIN32_DIR)
CYGWIN_EASY_PERMUTATIONS += none
CYGWIN_EASY_PERMUTATIONS += parport
CYGWIN_EASY_PERMUTATIONS += ftd2xx
MINGW32_EASY_PERMUTATIONS += none
MINGW32_EASY_PERMUTATIONS += parport
MINGW32_EASY_PERMUTATIONS += ftd2xx
# This is not a possible permutation, it is manual :-(
# Why? Because "libftdi" installs things into install/include
# which would efect the 'ftd2xx' win32 build
CONFIG_OPTIONS_win32_libftdi = --enable-parport --enable-ft2232_libftdi
# Default build for win32... is the ftd2xx type build.
PERMUTE_win32 ?= $(BUILD_SYSNAME)_ftd2xx
CONFIG_OPTIONS_win32 ?= $(CONFIG_OPTIONS_win32_$(PERMUTE_win32))
CONFIG_OPTIONS_cygwin = $(CONFIG_OPTIONS_win32)
CONFIG_OPTIONS_mingw32 = $(CONFIG_OPTIONS_win32)
#========================================
# Linux Build Permuatations
# none
# parport
# ft2232_ftd2xx
# ft2232_libftdi
CONFIG_OPTIONS_linux_none =
LINUX_EASY_PERMUTATIONS += none
CONFIG_OPTIONS_linux_parport = --enable-parport
LINUX_EASY_PERMUTATIONS += parport
CONFIG_OPTIONS_linux_ft2232_libftdi = --enable-parport --enable-ft2232-libftdi
#this cannot be done as part of the permutations.
#LINUX_EASY_PERMUTATIONS += ft2232_libftdi
CONFIG_OPTIONS_linux_ft2232_ftd2xx_static = \
--enable-parport \
--enable-ft2232-ftd2xx --with-ftd2xx-lib=static --with-ftd2xx-linux-tardir=$(FTD2XX_LINUX_DIR)
LINUX_EASY_PERMUTATIONS += ft2232_ftd2xx_static
# this is not a possible permutation it is manual :-(
# why? because it interfers with the other permutations
# by "installing files" in the $(INSTALL_DIR)
CONFIG_OPTIONS_linux_ftd2xx_installed = \
--enable-parport \
--enable-ft2232-ftd2xx \
--with-ftd2xx-lib=shared
# The default build permutation is
PERMUTE_linux ?= ft2232_ftd2xx_static
CONFIG_OPTIONS_linux = $(CONFIG_OPTIONS_linux_$(PERMUTE_linux))
CONFIG_OPTIONS_darwin=\
--enable-ftd2232-libftdi
# Which build are we doing?
CONFIG_OPTIONS := $(CONFIG_OPTIONS_$(BUILD_SYSNAME))
bootstrap:
cd $(SRC_DIR) && bash ./bootstrap
clean::
rm -rf $(BUILD_DIR)
ifndef CFLAGS
_CFLAGS=true
else
_CFLAGS=export CFLAGS="${CFLAGS}"
endif
# if this was given... then pass it on
configure:
@echo " Build Sysname: $(BUILD_SYSNAME)"
@echo " Config Options: $(CONFIG_OPTIONS)"
rm -rf $(BUILD_DIR)
mkdir $(BUILD_DIR)
${_CFLAGS} && \
cd $(BUILD_DIR) && \
$(SRC_DIR)/configure \
--prefix=$(PREFIX) \
--exec-prefix=$(EXEC_PREFIX) \
$(CONFIG_OPTIONS)
build:
cd $(BUILD_DIR) && $(MAKE)
install:
cd $(BUILD_DIR) && $(MAKE) install
all: configure build install
.PHONY: install
# The "cygwin.libftdi" requires that libftdi be built
# and installed *PRIOR* to running this target.
# it is not part of the permutations because ...
# it interfers with the ftd2xx based builds
cygwin.libftdi:
$(MAKE) -f Makefile.openocd bootstrap
$(MAKE) BUILD_SUFFIX=$@ PERMUTE_win32=libftdi -f Makefile.openocd all
cygwin.easy.permutations: remove.install ${CYGWIN_EASY_PERMUTATIONS:%=_cygwin.%}
_cygwin.%:
@echo ""
@echo ""
@echo "========================================"
@echo "Permutation Build... $@"
@echo "========================================"
@echo ""
@echo ""
$(MAKE) PERMUTE_win32=$* BUILD_SUFFIX=cygwin.$* -f Makefile.openocd all
$(EXEC_PREFIX)/bin/openocd -v
mingw32.easy.permutations: remove.install ${MINGW32_EASY_PERMUTATIONS:%=_mingw32.%}
# I (duane) build openocd-mingw32 via Cygwin.
# Sadly, the "mingw32" buid for cygwin does not include
# the required "elf.h" header files... so ...
# we have them in our own private helper place.
_mingw32.%:
@echo ""
@echo ""
@echo "========================================"
@echo "Permutation Build... $@"
@echo "========================================"
@echo ""
@echo ""
CFLAGS="-mno-cygwin -I$(HERE)/mingw32_help/include" \
$(MAKE) -f Makefile.openocd all ;\
$(EXEC_PREFIX)/bin/openocd -v
win32.permutations: mingw32.permutations cygwin.permutations
# SMOKE TEST - Build every linux permuation...
# If "openocd -v" does exit(0) we are good enough.
linux.easy.permutations: remove.install ${LINUX_EASY_PERMUTATIONS:%=_linux.%}
_linux.%:
@echo ""
@echo ""
@echo "========================================"
@echo "Permutation Build... $@"
@echo "========================================"
@echo ""
@echo ""
$(MAKE) PERMUTE_linux=$* BUILD_SUFFIX=linux.$* -f Makefile.openocd all
$(EXEC_PREFIX)/bin/openocd -v
linux.ftd2xx_installed:
${MAKE} -f Makefile.openocd _$@
linux.ft2232_libftdi:
${MAKE} -f Makefile.openocd _$@
_complain_:
@echo ""
@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
@echo " Or read the makefile and learn about the permutation test targets"
@echo ""
@exit 1

39
testing/build.test1/local.uses Executable file
View File

@@ -0,0 +1,39 @@
# -*- mode: makefile -*-
HERE := $(shell pwd)
# Solve problems on systems with DASH.. Grrr...
SHELL=/bin/bash
export SHELL
VIRGINS=${HERE}/virgins
# Determine the build platform.
BUILD_SYSNAME_Linux =linux
BUILD_SYSNAME_linux =linux
BUILD_SYSNAME_CYGWIN_NT =cygwin
BUILD_SYSNAME_MINGW32_NT =mingw32
BUILD_SYSNAME_Darwin =darwin
BUILD_SYSNAME_darwin =darwin
BUILD_SYSNAME :=$(BUILD_SYSNAME_$(shell uname --sysname | cut -d'-' -f1))
# And machine (ie: i686, x86_64, or what)
BUILD_MACHINE :=$(BUILD_SYSNAME).$(shell uname -m)
INSTALL_DIR := $(HERE)/install
PREFIX := ${INSTALL_DIR}
EXEC_PREFIX := ${INSTALL_DIR}/${BUILD_MACHINE}
LIBFTDI_VERSION=0.14
LIBCONFUSE_VERSION=2.5
LIBUSB_VERSION_linux=0.1.12
LIBUSB_VERSION=${LIBUSB_VERSION_${BUILD_SYSNAME}}
FTD2XX_WIN32_VERSION=2.04.14
FTD2XX_WIN32_DIR = ${HERE}/ftd2xx.win32
FTD2XX_LINUX_VERSION=0.4.16
FTD2XX_LINUX_DIR = ${HERE}/libftd2xx${FTD2XX_LINUX_VERSION}
FTD2XX_LINUX_64_DIR = ${HERE}/libftd2xx${FTD2XX_LINUX_VERSION}_x86_64

View File

@@ -0,0 +1,38 @@
/* elf.h
Copyright 2005 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#ifndef _ELF_H_
#define _ELF_H_
#include <stdint.h>
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
typedef int32_t register_t;
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/elf32.h>
#include <sys/elf64.h>
#include <sys/elf_generic.h>
#ifdef __cplusplus
}
#endif
#endif /*_ELF_H_*/

View File

@@ -0,0 +1,23 @@
/* sys/cdefs.h
Copyright 1998, 2000, 2001 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
#define __P(protos) protos /* full-blown ANSI C */
#define __CONCAT(__x,__y) __x##__y
#endif

View File

@@ -0,0 +1,156 @@
/*-
* Copyright (c) 1996-1998 John D. Polstra.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD: src/sys/sys/elf32.h,v 1.8 2002/05/30 08:32:18 dfr Exp $
*/
#ifndef _SYS_ELF32_H_
#define _SYS_ELF32_H_ 1
#include <sys/elf_common.h>
/*
* ELF definitions common to all 32-bit architectures.
*/
typedef u_int32_t Elf32_Addr;
typedef u_int16_t Elf32_Half;
typedef u_int32_t Elf32_Off;
typedef int32_t Elf32_Sword;
typedef u_int32_t Elf32_Word;
typedef u_int32_t Elf32_Size;
typedef Elf32_Off Elf32_Hashelt;
/*
* ELF header.
*/
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* File identification. */
Elf32_Half e_type; /* File type. */
Elf32_Half e_machine; /* Machine architecture. */
Elf32_Word e_version; /* ELF format version. */
Elf32_Addr e_entry; /* Entry point. */
Elf32_Off e_phoff; /* Program header file offset. */
Elf32_Off e_shoff; /* Section header file offset. */
Elf32_Word e_flags; /* Architecture-specific flags. */
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
Elf32_Half e_phentsize; /* Size of program header entry. */
Elf32_Half e_phnum; /* Number of program header entries. */
Elf32_Half e_shentsize; /* Size of section header entry. */
Elf32_Half e_shnum; /* Number of section header entries. */
Elf32_Half e_shstrndx; /* Section name strings section. */
} Elf32_Ehdr;
/*
* Section header.
*/
typedef struct {
Elf32_Word sh_name; /* Section name (index into the
section header string table). */
Elf32_Word sh_type; /* Section type. */
Elf32_Word sh_flags; /* Section flags. */
Elf32_Addr sh_addr; /* Address in memory image. */
Elf32_Off sh_offset; /* Offset in file. */
Elf32_Size sh_size; /* Size in bytes. */
Elf32_Word sh_link; /* Index of a related section. */
Elf32_Word sh_info; /* Depends on section type. */
Elf32_Size sh_addralign; /* Alignment in bytes. */
Elf32_Size sh_entsize; /* Size of each entry in section. */
} Elf32_Shdr;
/*
* Program header.
*/
typedef struct {
Elf32_Word p_type; /* Entry type. */
Elf32_Off p_offset; /* File offset of contents. */
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
Elf32_Addr p_paddr; /* Physical address (not used). */
Elf32_Size p_filesz; /* Size of contents in file. */
Elf32_Size p_memsz; /* Size of contents in memory. */
Elf32_Word p_flags; /* Access permission flags. */
Elf32_Size p_align; /* Alignment in memory and file. */
} Elf32_Phdr;
/*
* Dynamic structure. The ".dynamic" section contains an array of them.
*/
typedef struct {
Elf32_Sword d_tag; /* Entry type. */
union {
Elf32_Size d_val; /* Integer value. */
Elf32_Addr d_ptr; /* Address value. */
} d_un;
} Elf32_Dyn;
/*
* Relocation entries.
*/
/* Relocations that don't need an addend field. */
typedef struct {
Elf32_Addr r_offset; /* Location to be relocated. */
Elf32_Word r_info; /* Relocation type and symbol index. */
} Elf32_Rel;
/* Relocations that need an addend field. */
typedef struct {
Elf32_Addr r_offset; /* Location to be relocated. */
Elf32_Word r_info; /* Relocation type and symbol index. */
Elf32_Sword r_addend; /* Addend. */
} Elf32_Rela;
/* Macros for accessing the fields of r_info. */
#define ELF32_R_SYM(info) ((info) >> 8)
#define ELF32_R_TYPE(info) ((unsigned char)(info))
/* Macro for constructing r_info from field values. */
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
/*
* Symbol table entries.
*/
typedef struct {
Elf32_Word st_name; /* String table index of name. */
Elf32_Addr st_value; /* Symbol value. */
Elf32_Size 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. */
} Elf32_Sym;
/* Macros for accessing the fields of st_info. */
#define ELF32_ST_BIND(info) ((info) >> 4)
#define ELF32_ST_TYPE(info) ((info) & 0xf)
/* Macro for constructing st_info from field values. */
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
#endif /* !_SYS_ELF32_H_ */

View File

@@ -0,0 +1,172 @@
/*-
* Copyright (c) 1996-1998 John D. Polstra.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD: src/sys/sys/elf64.h,v 1.10 2002/05/30 08:32:18 dfr Exp $
*/
#ifndef _SYS_ELF64_H_
#define _SYS_ELF64_H_ 1
#include <sys/elf_common.h>
/*
* ELF definitions common to all 64-bit architectures.
*/
typedef uint64_t Elf64_Addr;
typedef uint16_t Elf64_Half;
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf64_Sxword;
typedef uint64_t Elf64_Off;
typedef uint16_t Elf64_Section;
typedef Elf64_Half Elf64_Versym;
typedef uint16_t Elf64_Quarter;
/*
* Types of dynamic symbol hash table bucket and chain elements.
*
* This is inconsistent among 64 bit architectures, so a machine dependent
* typedef is required.
*/
#ifdef __alpha__
typedef Elf64_Off Elf64_Hashelt;
#else
typedef Elf64_Half Elf64_Hashelt;
#endif
/*
* ELF header.
*/
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* File identification. */
Elf64_Half e_type; /* File type. */
Elf64_Half e_machine; /* Machine architecture. */
Elf64_Word e_version; /* ELF format version. */
Elf64_Addr e_entry; /* Entry point. */
Elf64_Off e_phoff; /* Program header file offset. */
Elf64_Off e_shoff; /* Section header file offset. */
Elf64_Word e_flags; /* Architecture-specific flags. */
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
Elf64_Half e_phentsize; /* Size of program header entry. */
Elf64_Half e_phnum; /* Number of program header entries. */
Elf64_Half e_shentsize; /* Size of section header entry. */
Elf64_Half e_shnum; /* Number of section header entries. */
Elf64_Half e_shstrndx; /* Section name strings section. */
} Elf64_Ehdr;
/*
* Section header.
*/
typedef struct {
Elf64_Word sh_name; /* Section name (index into the
section header string table). */
Elf64_Word sh_type; /* Section type. */
Elf64_Xword sh_flags; /* Section flags. */
Elf64_Addr sh_addr; /* Address in memory image. */
Elf64_Off sh_offset; /* Offset in file. */
Elf64_Xword sh_size; /* Size in bytes. */
Elf64_Word sh_link; /* Index of a related section. */
Elf64_Word sh_info; /* Depends on section type. */
Elf64_Xword sh_addralign; /* Alignment in bytes. */
Elf64_Xword sh_entsize; /* Size of each entry in section. */
} Elf64_Shdr;
/*
* Program header.
*/
typedef struct {
Elf64_Word p_type; /* Entry type. */
Elf64_Word p_flags; /* Access permission flags. */
Elf64_Off p_offset; /* File offset of contents. */
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
Elf64_Addr p_paddr; /* Physical address (not used). */
Elf64_Xword p_filesz; /* Size of contents in file. */
Elf64_Xword p_memsz; /* Size of contents in memory. */
Elf64_Xword p_align; /* Alignment in memory and file. */
} Elf64_Phdr;
/*
* Dynamic structure. The ".dynamic" section contains an array of them.
*/
typedef struct {
Elf64_Sxword d_tag; /* Entry type. */
union {
Elf64_Xword d_val; /* Integer value. */
Elf64_Addr d_ptr; /* Address value. */
} d_un;
} Elf64_Dyn;
/*
* Relocation entries.
*/
/* Relocations that don't need an addend field. */
typedef struct {
Elf64_Addr r_offset; /* Location to be relocated. */
Elf64_Xword r_info; /* Relocation type and symbol index. */
} Elf64_Rel;
/* Relocations that need an addend field. */
typedef struct {
Elf64_Addr r_offset; /* Location to be relocated. */
Elf64_Xword r_info; /* Relocation type and symbol index. */
Elf64_Sxword r_addend; /* Addend. */
} Elf64_Rela;
/* Macros for accessing the fields of r_info. */
#define ELF64_R_SYM(info) ((info) >> 32)
#define ELF64_R_TYPE(info) ((unsigned char)(info))
/* Macro for constructing r_info from field values. */
#define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type))
/*
* Symbol table entries.
*/
typedef struct {
Elf64_Word st_name; /* String table index of name. */
unsigned char st_info; /* Type and binding information. */
unsigned char st_other; /* Reserved (not used). */
Elf64_Section st_shndx; /* Section index of symbol. */
Elf64_Addr st_value; /* Symbol value. */
Elf64_Xword st_size; /* Size of associated object. */
} Elf64_Sym;
/* Macros for accessing the fields of st_info. */
#define ELF64_ST_BIND(info) ((info) >> 4)
#define ELF64_ST_TYPE(info) ((info) & 0xf)
/* Macro for constructing st_info from field values. */
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
#endif /* !_SYS_ELF64_H_ */

View File

@@ -0,0 +1,299 @@
/*-
* Copyright (c) 1998 John D. Polstra.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD: src/sys/sys/elf_common.h,v 1.15 2004/05/05 02:38:54 marcel Exp $
*/
#ifndef _SYS_ELF_COMMON_H_
#define _SYS_ELF_COMMON_H_ 1
/*
* ELF definitions that are independent of architecture or word size.
*/
/*
* Note header. The ".note" section contains an array of notes. Each
* begins with this header, aligned to a word boundary. Immediately
* following the note header is n_namesz bytes of name, padded to the
* next word boundary. Then comes n_descsz bytes of descriptor, again
* padded to a word boundary. The values of n_namesz and n_descsz do
* not include the padding.
*/
typedef struct {
u_int32_t n_namesz; /* Length of name. */
u_int32_t n_descsz; /* Length of descriptor. */
u_int32_t n_type; /* Type of this note. */
} Elf_Note;
/* Indexes into the e_ident array. Keep synced with
http://www.sco.com/developer/gabi/ch4.eheader.html */
#define EI_MAG0 0 /* Magic number, byte 0. */
#define EI_MAG1 1 /* Magic number, byte 1. */
#define EI_MAG2 2 /* Magic number, byte 2. */
#define EI_MAG3 3 /* Magic number, byte 3. */
#define EI_CLASS 4 /* Class of machine. */
#define EI_DATA 5 /* Data format. */
#define EI_VERSION 6 /* ELF format version. */
#define EI_OSABI 7 /* Operating system / ABI identification */
#define EI_ABIVERSION 8 /* ABI version */
#define OLD_EI_BRAND 8 /* Start of architecture identification. */
#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */
#define EI_NIDENT 16 /* Size of e_ident array. */
/* Values for the magic number bytes. */
#define ELFMAG0 0x7f
#define ELFMAG1 'E'
#define ELFMAG2 'L'
#define ELFMAG3 'F'
#define ELFMAG "\177ELF" /* magic string */
#define SELFMAG 4 /* magic string size */
/* Values for e_ident[EI_VERSION] and e_version. */
#define EV_NONE 0
#define EV_CURRENT 1
/* Values for e_ident[EI_CLASS]. */
#define ELFCLASSNONE 0 /* Unknown class. */
#define ELFCLASS32 1 /* 32-bit architecture. */
#define ELFCLASS64 2 /* 64-bit architecture. */
/* Values for e_ident[EI_DATA]. */
#define ELFDATANONE 0 /* Unknown data format. */
#define ELFDATA2LSB 1 /* 2's complement little-endian. */
#define ELFDATA2MSB 2 /* 2's complement big-endian. */
/* Values for e_ident[EI_OSABI]. */
#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
#define ELFOSABI_NONE ELFOSABI_SYSV /* symbol used in old spec */
#define ELFOSABI_HPUX 1 /* HP-UX operating system */
#define ELFOSABI_NETBSD 2 /* NetBSD */
#define ELFOSABI_LINUX 3 /* GNU/Linux */
#define ELFOSABI_HURD 4 /* GNU/Hurd */
#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
#define ELFOSABI_SOLARIS 6 /* Solaris */
#define ELFOSABI_MONTEREY 7 /* Monterey */
#define ELFOSABI_IRIX 8 /* IRIX */
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
#define ELFOSABI_OPENBSD 12 /* OpenBSD */
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* 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. */
/* Values for e_machine. */
#define EM_NONE 0 /* Unknown machine. */
#define EM_M32 1 /* AT&T WE32100. */
#define EM_SPARC 2 /* Sun SPARC. */
#define EM_386 3 /* Intel i386. */
#define EM_68K 4 /* Motorola 68000. */
#define EM_88K 5 /* Motorola 88000. */
#define EM_486 6 /* Intel i486. */
#define EM_860 7 /* Intel i860. */
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
/* Extensions. This list is not complete. */
#define EM_S370 9 /* IBM System/370 */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ /* Depreciated */
#define EM_PARISC 15 /* HPPA */
#define EM_SPARC32PLUS 18 /* SPARC v8plus */
#define EM_PPC 20 /* PowerPC 32-bit */
#define EM_PPC64 21 /* PowerPC 64-bit */
#define EM_ARM 40 /* ARM */
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
#define EM_IA_64 50 /* Intel IA-64 Processor */
#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */
#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI */
/* Special section indexes. */
#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */
#define SHN_LORESERVE 0xff00 /* First of reserved range. */
#define SHN_LOPROC 0xff00 /* First processor-specific. */
#define SHN_HIPROC 0xff1f /* Last processor-specific. */
#define SHN_ABS 0xfff1 /* Absolute values. */
#define SHN_COMMON 0xfff2 /* Common data. */
#define SHN_HIRESERVE 0xffff /* Last of reserved range. */
/* 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 /* relocation section - no addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_NUM 12 /* number of section types */
#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
#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 */
/* Flags for sh_flags. */
#define SHF_WRITE 0x1 /* Section contains writable data. */
#define SHF_ALLOC 0x2 /* Section occupies memory. */
#define SHF_EXECINSTR 0x4 /* Section contains instructions. */
#define SHF_TLS 0x400 /* Section contains TLS data. */
#define SHF_MASKPROC 0xf0000000 /* Reserved for processor-specific. */
/* Values for p_type. */
#define PT_NULL 0 /* Unused entry. */
#define PT_LOAD 1 /* Loadable segment. */
#define PT_DYNAMIC 2 /* Dynamic linking information segment. */
#define PT_INTERP 3 /* Pathname of interpreter. */
#define PT_NOTE 4 /* Auxiliary information. */
#define PT_SHLIB 5 /* Reserved (not used). */
#define PT_PHDR 6 /* Location of program header itself. */
#define PT_TLS 7 /* Thread local storage segment */
#define PT_COUNT 8 /* Number of defined p_type values. */
#define PT_LOOS 0x60000000 /* OS-specific */
#define PT_HIOS 0x6fffffff /* OS-specific */
#define PT_LOPROC 0x70000000 /* First processor-specific type. */
#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
/* Values for p_flags. */
#define PF_X 0x1 /* Executable. */
#define PF_W 0x2 /* Writable. */
#define PF_R 0x4 /* Readable. */
/* Values for d_tag. */
#define DT_NULL 0 /* Terminating entry. */
#define DT_NEEDED 1 /* String table offset of a needed shared
library. */
#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */
#define DT_PLTGOT 3 /* Processor-dependent address. */
#define DT_HASH 4 /* Address of symbol hash table. */
#define DT_STRTAB 5 /* Address of string table. */
#define DT_SYMTAB 6 /* Address of symbol table. */
#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */
#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */
#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */
#define DT_STRSZ 10 /* Size of string table. */
#define DT_SYMENT 11 /* Size of each symbol table entry. */
#define DT_INIT 12 /* Address of initialization function. */
#define DT_FINI 13 /* Address of finalization function. */
#define DT_SONAME 14 /* String table offset of shared object
name. */
#define DT_RPATH 15 /* String table offset of library path. [sup] */
#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */
#define DT_REL 17 /* Address of ElfNN_Rel relocations. */
#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */
#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */
#define DT_PLTREL 20 /* Type of relocation used for PLT. */
#define DT_DEBUG 21 /* Reserved (not used). */
#define DT_TEXTREL 22 /* Indicates there may be relocations in
non-writable segments. [sup] */
#define DT_JMPREL 23 /* Address of PLT relocations. */
#define DT_BIND_NOW 24 /* [sup] */
#define DT_INIT_ARRAY 25 /* Address of the array of pointers to
initialization functions */
#define DT_FINI_ARRAY 26 /* Address of the array of pointers to
termination functions */
#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of
initialization functions. */
#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of
terminationfunctions. */
#define DT_RUNPATH 29 /* String table offset of a null-terminated
library search path string. */
#define DT_FLAGS 30 /* Object specific flag values. */
#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING
and less than DT_LOOS follow the rules for
the interpretation of the d_un union
as follows: even == 'd_ptr', even == 'd_val'
or none */
#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to
pre-initialization functions. */
#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of
pre-initialization functions. */
#define DT_COUNT 33 /* Number of defined d_tag values. */
#define DT_LOOS 0x6000000d /* First OS-specific */
#define DT_HIOS 0x6fff0000 /* Last OS-specific */
#define DT_LOPROC 0x70000000 /* First processor-specific type. */
#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */
/* Values for DT_FLAGS */
#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may
make reference to the $ORIGIN substitution
string */
#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */
#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in
non-writable segments. */
#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should
process all relocations for the object
containing this entry before transferring
control to the program. */
#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or
executable contains code using a static
thread-local storage scheme. */
/* Values for n_type. Used in core files. */
#define NT_PRSTATUS 1 /* Process status. */
#define NT_FPREGSET 2 /* Floating point registers. */
#define NT_PRPSINFO 3 /* Process state info. */
/* Symbol Binding - ELFNN_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific symbol bindings */
/* Symbol type - ELFNN_ST_TYPE - st_info */
#define STT_NOTYPE 0 /* Unspecified type. */
#define STT_OBJECT 1 /* Data object. */
#define STT_FUNC 2 /* Function. */
#define STT_SECTION 3 /* Section. */
#define STT_FILE 4 /* Source file. */
#define STT_TLS 6 /* TLS object. */
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
/* Special symbol table indexes. */
#define STN_UNDEF 0 /* Undefined symbol index. */
#endif /* !_SYS_ELF_COMMON_H_ */

View File

@@ -0,0 +1,91 @@
/*-
* Copyright (c) 1998 John D. Polstra.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD: src/sys/sys/elf_generic.h,v 1.6 2002/07/20 02:56:11 peter Exp $
*/
#ifndef _SYS_ELF_GENERIC_H_
#define _SYS_ELF_GENERIC_H_ 1
#include <sys/cdefs.h>
/*
* Definitions of generic ELF names which relieve applications from
* needing to know the word size.
*/
#ifndef __ELF_WORD_SIZE
# define __ELF_WORD_SIZE 32
#endif
#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64
#error "__ELF_WORD_SIZE must be defined as 32 or 64"
#endif
#define ELF_CLASS __CONCAT(ELFCLASS,__ELF_WORD_SIZE)
#if BYTE_ORDER == LITTLE_ENDIAN
#define ELF_DATA ELFDATA2LSB
#elif BYTE_ORDER == BIG_ENDIAN
#define ELF_DATA ELFDATA2MSB
#else
#error "Unknown byte order"
#endif
#if __ELF_WORD_SIZE == 32
#define __elfN(x) elf32_##x
#define __ElfN(x) Elf32_##x
#define __ELFN(x) ELF32_##x
#else
#define __elfN(x) elf364_##x
#define __ElfN(x) Elf364_##x
#define __ELFN(x) ELF364_##x
#endif
#define __ElfType(x) typedef __ElfN(x) Elf_##x
#define FOO
__ElfType(Addr);
__ElfType(Half);
__ElfType(Off);
__ElfType(Sword);
__ElfType(Word);
__ElfType(Size);
__ElfType(Hashelt);
__ElfType(Ehdr);
__ElfType(Shdr);
__ElfType(Phdr);
__ElfType(Dyn);
__ElfType(Rel);
__ElfType(Rela);
__ElfType(Sym);
#define ELF_R_SYM __ELFN(R_SYM)
#define ELF_R_TYPE __ELFN(R_TYPE)
#define ELF_R_INFO __ELFN(R_INFO)
#define ELF_ST_BIND __ELFN(ST_BIND)
#define ELF_ST_TYPE __ELFN(ST_TYPE)
#define ELF_ST_INFO __ELFN(ST_INFO)
#endif /* !_SYS_ELF_GENERIC_H_ */