/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2001 David E. O'Brien4* Copyright (c) 1996-1997 John D. Polstra.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _MACHINE_ELF_H_30#define _MACHINE_ELF_H_ 13132/*33* EABI ELF definitions for the PowerPC architecture.34* See "PowerPC Embedded Application Binary Interface, 32-Bit Impliementation"35* [ppc-eabi-1995-01.pdf] for details.36*/3738#ifndef __ELF_WORD_SIZE39#ifdef __powerpc64__40#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */41#else42#define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */43#endif44#endif4546#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */47#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */48#include <sys/elf_generic.h>4950#if __ELF_WORD_SIZE == 6451#define ELF_ARCH EM_PPC6452#define ELF_MACHINE_OK(x) ((x) == EM_PPC64)53#else54#define ELF_ARCH EM_PPC55#define ELF_ARCH32 EM_PPC56#define ELF_MACHINE_OK(x) ((x) == EM_PPC)57#endif5859/*60* Auxiliary vector entries for passing information to the interpreter.61*62* The PowerPC supplement to the SVR4 ABI specification names this "auxv_t",63* but POSIX lays claim to all symbols ending with "_t".64*/6566typedef struct { /* Auxiliary vector entry on initial stack */67int a_type; /* Entry type. */68union {69#ifdef __powerpc64__70int a_val; /* Integer value */71#else72long a_val; /* Integer value. */73void *a_ptr; /* Address. */74void (*a_fcn)(void); /* Function pointer (not used). */75#endif76} a_un;77} Elf32_Auxinfo;7879typedef struct { /* Auxiliary vector entry on initial stack */80long a_type; /* Entry type. */81union {82long a_val; /* Integer value. */83void *a_ptr; /* Address. */84void (*a_fcn)(void); /* Function pointer (not used). */85} a_un;86} Elf64_Auxinfo;8788__ElfType(Auxinfo);8990/*91* Relocation types.92*/9394#define R_PPC_COUNT 37 /* Count of defined relocation types. */9596/* Count of defined relocation types. */97#define R_PPC_EMB_COUNT (R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1)9899/* Define "machine" characteristics */100#if BYTE_ORDER == LITTLE_ENDIAN101#define ELF_TARG_DATA ELFDATA2LSB102#else103#define ELF_TARG_DATA ELFDATA2MSB104#endif105#if __ELF_WORD_SIZE == 64106#define ELF_TARG_CLASS ELFCLASS64107#define ELF_TARG_MACH EM_PPC64108#define ELF_TARG_VER 1109#else110#define ELF_TARG_CLASS ELFCLASS32111#define ELF_TARG_MACH EM_PPC112#define ELF_TARG_VER 1113#endif114115#define ET_DYN_LOAD_ADDR 0x01010000116117#define AT_OLD_NULL AT_NULL118#define AT_OLD_IGNORE AT_IGNORE119#define AT_OLD_EXECFD AT_EXECFD120#define AT_OLD_PHDR AT_PHDR121#define AT_OLD_PHENT AT_PHENT122#define AT_OLD_PHNUM AT_PHNUM123#define AT_OLD_PAGESZ AT_PAGESZ124#define AT_OLD_BASE AT_BASE125#define AT_OLD_FLAGS AT_FLAGS126#define AT_OLD_ENTRY AT_ENTRY127#define AT_OLD_NOTELF AT_NOTELF128#define AT_OLD_UID AT_UID129#define AT_OLD_EUID AT_EUID130#define AT_OLD_EXECPATH 13131#define AT_OLD_CANARY 14132#define AT_OLD_CANARYLEN 15133#define AT_OLD_OSRELDATE 16134#define AT_OLD_NCPUS 17135#define AT_OLD_PAGESIZES 18136#define AT_OLD_PAGESIZESLEN 19137#define AT_OLD_STACKPROT 21138#define AT_OLD_TIMEKEEP AT_TIMEKEEP139#define AT_OLD_EHDRFLAGS AT_EHDRFLAGS140#define AT_OLD_HWCAP AT_HWCAP141#define AT_OLD_HWCAP2 AT_HWCAP2142143#define AT_OLD_COUNT 27 /* Count of defined aux entry types. */144145#endif /* !_MACHINE_ELF_H_ */146147148