elf.h revision 1638af81f0b976a8a9b6936111b901c225d1e4ec
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_ELF_H
#define _SYS_ELF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/elftypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ELF32_FSZ_ADDR 4
#define ELF32_FSZ_HALF 2
#define ELF32_FSZ_OFF 4
#define ELF32_FSZ_SWORD 4
#define ELF32_FSZ_WORD 4
#define ELF64_FSZ_ADDR 8
#define ELF64_FSZ_HALF 2
#define ELF64_FSZ_OFF 8
#define ELF64_FSZ_SWORD 4
#define ELF64_FSZ_WORD 4
#define ELF64_FSZ_SXWORD 8
#define ELF64_FSZ_XWORD 8
/*
* "Enumerations" below use ...NUM as the number of
* values in the list. It should be 1 greater than the
* highest "real" value.
*/
/*
* ELF header
*/
#define EI_NIDENT 16
typedef struct {
} Elf32_Ehdr;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf64_Ehdr;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
#define EI_MAG0 0 /* e_ident[] indexes */
#define EI_MAG1 1
#define EI_MAG2 2
#define EI_MAG3 3
#define ELFMAG1 'E'
#define ELFMAG2 'L'
#define ELFMAG3 'F'
#define ELFMAG "\177ELF"
#define SELFMAG 4
#define ELFCLASSNONE 0 /* EI_CLASS */
#define ELFCLASS32 1
#define ELFCLASS64 2
#define ELFCLASSNUM 3
#define ELFDATANONE 0 /* EI_DATA */
#define ELFDATA2LSB 1
#define ELFDATA2MSB 2
#define ELFDATANUM 3
#define ET_NONE 0 /* e_type */
#define ET_REL 1
#define ET_EXEC 2
#define ET_DYN 3
#define ET_CORE 4
#define ET_NUM 5
#define ET_LOSUNW 0xfeff
#define ET_SUNWPSEUDO 0xfeff
#define ET_HISUNW 0xfeff
#define ET_HIOS 0xfeff
#define ET_HIPROC 0xffff
#define ET_HIPROC 0xffff
#define EM_NONE 0 /* e_machine */
#define EM_UNKNOWN12 12
#define EM_UNKNOWN13 13
#define EM_UNKNOWN14 14
#define EM_UNKNOWN23 23
#define EM_UNKNOWN24 24
#define EM_UNKNOWN25 25
#define EM_UNKNOWN26 26
#define EM_UNKNOWN27 27
#define EM_UNKNOWN28 28
#define EM_UNKNOWN29 29
#define EM_UNKNOWN30 30
#define EM_UNKNOWN31 31
#define EM_UNKNOWN32 32
#define EM_UNKNOWN33 33
#define EM_UNKNOWN34 34
#define EM_UNKNOWN35 35
/* Argonaut Technologies Inc. */
/* embedded processor family */
#define EM_UNKNOWN64 64
#define EM_UNKNOWN65 65
/* microcontroller */
/* microcontroller */
/* microcontroller */
/* embedded processor */
/* embedded processor */
/* 64-bit processor */
/* machine-independent */
/* object files */
#define EM_NUM 95
#define EV_NONE 0 /* e_version, EI_VERSION */
#define EV_CURRENT 1
#define EV_NUM 2
#define ELFOSABI_NONE 0 /* No extensions or unspecified */
#define ELFOSABI_SYSV ELFOSABI_NONE
#define ELFOSABI_UNKNOWN4 4
#define ELFOSABI_UNKNOWN5 5
/*
* Program header
*/
typedef struct {
} Elf32_Phdr;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf64_Phdr;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
#define PT_NULL 0 /* p_type */
#define PT_LOAD 1
#define PT_DYNAMIC 2
#define PT_INTERP 3
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
#define PT_TLS 7
#define PT_NUM 8
/*
* Note: The amd64 psABI defines that the UNWIND program header
* should reside in the OS specific range of the program
* headers.
*/
#define PT_GNU_EH_FRAME PT_SUNW_UNWIND
#define PT_LOSUNW 0x6ffffffa
#define PT_HISUNW 0x6fffffff
#define PT_HIOS 0x6fffffff
#define PT_HIPROC 0x7fffffff
#define PF_W 0x2
#define PF_X 0x1
/*
* Section header
*/
typedef struct {
} Elf32_Shdr;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf64_Shdr;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
#define SHT_NULL 0 /* sh_type */
#define SHT_PROGBITS 1
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define SHT_RELA 4
#define SHT_HASH 5
#define SHT_DYNAMIC 6
#define SHT_NOTE 7
#define SHT_NOBITS 8
#define SHT_REL 9
#define SHT_SHLIB 10
#define SHT_DYNSYM 11
#define SHT_UNKNOWN12 12
#define SHT_UNKNOWN13 13
#define SHT_INIT_ARRAY 14
#define SHT_FINI_ARRAY 15
#define SHT_PREINIT_ARRAY 16
#define SHT_GROUP 17
#define SHT_SYMTAB_SHNDX 18
#define SHT_NUM 19
/* Solaris ABI specific values */
#define SHT_LOSUNW 0x6ffffff3
#define SHT_SUNW_LDYNSYM 0x6ffffff3
#define SHT_SUNW_dof 0x6ffffff4
#define SHT_SUNW_cap 0x6ffffff5
#define SHT_SUNW_SIGNATURE 0x6ffffff6
#define SHT_SUNW_ANNOTATE 0x6ffffff7
#define SHT_SUNW_DEBUGSTR 0x6ffffff8
#define SHT_SUNW_DEBUG 0x6ffffff9
#define SHT_SUNW_move 0x6ffffffa
#define SHT_SUNW_COMDAT 0x6ffffffb
#define SHT_SUNW_syminfo 0x6ffffffc
#define SHT_SUNW_verdef 0x6ffffffd
#define SHT_SUNW_verneed 0x6ffffffe
#define SHT_SUNW_versym 0x6fffffff
#define SHT_HISUNW 0x6fffffff
#define SHT_HIOS 0x6fffffff
#define SHT_GNU_verdef 0x6ffffffd
#define SHT_GNU_verneed 0x6ffffffe
#define SHT_GNU_versym 0x6fffffff
#define SHT_HIPROC 0x7fffffff
#define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xffffffff
#define SHF_ALLOC 0x02
#define SHF_EXECINSTR 0x04
#define SHF_MERGE 0x10
#define SHF_STRINGS 0x20
#define SHF_INFO_LINK 0x40
#define SHF_LINK_ORDER 0x80
#define SHF_OS_NONCONFORMING 0x100
#define SHF_GROUP 0x200
#define SHF_TLS 0x400
#define SHN_UNDEF 0 /* special section numbers */
#define SHN_LORESERVE 0xff00
#define SHN_HIPROC 0xff1f
#define SHN_LOSUNW 0xff3f
#define SHN_SUNW_IGNORE 0xff3f
#define SHN_HISUNW 0xff3f
#define SHN_HIOS 0xff3f
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
/*
* Symbol table
*/
typedef struct {
unsigned char st_info; /* bind, type: ELF_32_ST_... */
unsigned char st_other;
} Elf32_Sym;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
unsigned char st_info; /* bind, type: ELF_64_ST_... */
unsigned char st_other;
} Elf64_Sym;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
#define STN_UNDEF 0
/*
* The macros compose and decompose values for S.st_info
*
* bind = ELF32_ST_BIND(S.st_info)
* type = ELF32_ST_TYPE(S.st_info)
* S.st_info = ELF32_ST_INFO(bind, type)
*/
#define STB_LOCAL 0 /* BIND */
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_NUM 3
#define STB_HIPROC 15
#define STT_NOTYPE 0 /* TYPE */
#define STT_OBJECT 1
#define STT_FUNC 2
#define STT_SECTION 3
#define STT_FILE 4
#define STT_COMMON 5
#define STT_TLS 6
#define STT_NUM 7
#define STT_HIPROC 15
/*
* The macros decompose values for S.st_other
*
* visibility = ELF32_ST_VISIBILITY(S.st_other)
*/
#define STV_DEFAULT 0
#define STV_INTERNAL 1
#define STV_HIDDEN 2
#define STV_PROTECTED 3
/*
* Relocation
*/
typedef struct {
} Elf32_Rel;
typedef struct {
} Elf32_Rela;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf64_Rel;
typedef struct {
} Elf64_Rela;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
/*
* The macros compose and decompose values for Rel.r_info, Rela.f_info
*
* sym = ELF32_R_SYM(R.r_info)
* type = ELF32_R_TYPE(R.r_info)
* R.r_info = ELF32_R_INFO(sym, type)
*/
/*
* The r_info field is composed of two 32-bit components: the symbol
* table index and the relocation type. The relocation type for SPARC V9
* is further decomposed into an 8-bit type identifier and a 24-bit type
* dependent data field. For the existing Elf32 relocation types,
* that data field is zero.
*/
/*
* Section Group Flags (SHT_GROUP)
*/
#define GRP_COMDAT 0x01
/*
* Note entry header
*/
typedef struct {
} Elf32_Nhdr;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf64_Nhdr;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
/*
* Move entry
*/
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
} Elf32_Move;
/*
* The macros compose and decompose values for Move.r_info
*
* sym = ELF32_M_SYM(M.m_info)
* size = ELF32_M_SIZE(M.m_info)
* M.m_info = ELF32_M_INFO(sym, size)
*/
typedef struct {
} Elf64_Move;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
/*
*/
#ifndef _ASM
typedef struct {
union {
} c_un;
} Elf32_Cap;
#if defined(_LP64) || defined(_LONGLONG_TYPE)
typedef struct {
union {
} c_un;
} Elf64_Cap;
#endif /* defined(_LP64) || defined(_LONGLONG_TYPE) */
#endif
#define CA_SUNW_NULL 0
/*
* Define software capabilities (CA_SUNW_SF_1 values). Note, hardware
*/
/* in use */
/*
* Known values for note entry types (e_type == ET_CORE)
*/
#ifdef _KERNEL
/*
* The following routine checks the processor-specific
* fields of an ELF header.
*/
#endif
#ifdef __cplusplus
}
#endif
#if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_SPARC)
#include <sys/elf_SPARC.h>
#endif
#if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_386)
#endif
#if defined(ELF_TARGET_ALL) || defined(ELF_TARGET_AMD64)
#include <sys/elf_amd64.h>
#endif
#endif /* _SYS_ELF_H */