chromium/third_party/nasm/output/elf.h

/* ----------------------------------------------------------------------- *
 *
 *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
 *   See the file AUTHORS included with the NASM distribution for
 *   the specific copyright holders.
 *
 *   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 and the following disclaimer.
 *   * 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 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.
 *
 * ----------------------------------------------------------------------- */

#ifndef OUTPUT_ELF_H
#define OUTPUT_ELF_H

/*
 * Since NASM support both Elf32/64 file formats
 * we need to cover all types, structures, typedefs and etc
 */

#include "compiler.h"

/* Segment types */
#define PT_NULL
#define PT_LOAD
#define PT_DYNAMIC
#define PT_INTERP
#define PT_NOTE
#define PT_SHLIB
#define PT_PHDR
#define PT_LOOS
#define PT_HIOS
#define PT_LOPROC
#define PT_HIPROC
#define PT_GNU_EH_FRAME

/* ELF file types */
#define ET_NONE
#define ET_REL
#define ET_EXEC
#define ET_DYN
#define ET_CORE
#define ET_LOPROC
#define ET_HIPROC

/* ELF machine types */
#define EM_NONE
#define EM_M32
#define EM_SPARC
#define EM_386
#define EM_68K
#define EM_88K
#define EM_486
#define EM_860
#define EM_MIPS
#define EM_MIPS_RS4_BE
#define EM_PARISC
#define EM_SPARC32PLUS
#define EM_PPC
#define EM_PPC64
#define EM_S390
#define EM_SH
#define EM_SPARCV9
#define EM_H8_300H
#define EM_H8S
#define EM_IA_64
#define EM_X86_64
#define EM_CRIS
#define EM_V850
#define EM_ALPHA
#define EM_CYGNUS_V850
#define EM_S390_OLD

/* Dynamic type values */
#define DT_NULL
#define DT_NEEDED
#define DT_PLTRELSZ
#define DT_PLTGOT
#define DT_HASH
#define DT_STRTAB
#define DT_SYMTAB
#define DT_RELA
#define DT_RELASZ
#define DT_RELAENT
#define DT_STRSZ
#define DT_SYMENT
#define DT_INIT
#define DT_FINI
#define DT_SONAME
#define DT_RPATH
#define DT_SYMBOLIC
#define DT_REL
#define DT_RELSZ
#define DT_RELENT
#define DT_PLTREL
#define DT_DEBUG
#define DT_TEXTREL
#define DT_JMPREL
#define DT_LOPROC
#define DT_HIPROC

/* Auxilliary table entries */
#define AT_NULL
#define AT_IGNORE
#define AT_EXECFD
#define AT_PHDR
#define AT_PHENT
#define AT_PHNUM
#define AT_PAGESZ
#define AT_BASE
#define AT_FLAGS
#define AT_ENTRY
#define AT_NOTELF
#define AT_UID
#define AT_EUID
#define AT_GID
#define AT_EGID
#define AT_PLATFORM
#define AT_HWCAP
#define AT_CLKTCK
/* 18..22 = ? */
#define AT_SECURE

/* Program header permission flags */
#define PF_X
#define PF_W
#define PF_R

/* Section header types */
#define SHT_NULL
#define SHT_PROGBITS
#define SHT_SYMTAB
#define SHT_STRTAB
#define SHT_RELA
#define SHT_HASH
#define SHT_DYNAMIC
#define SHT_NOTE
#define SHT_NOBITS
#define SHT_REL
#define SHT_SHLIB
#define SHT_DYNSYM
#define SHT_INIT_ARRAY
#define SHT_FINI_ARRAY
#define SHT_PREINIT_ARRAY
#define SHT_GROUP
#define SHT_SYMTAB_SHNDX
#define SHT_LOPROC
#define SHT_HIPROC
#define SHT_LOUSER
#define SHT_HIUSER

/* Section header flags */
#define SHF_WRITE
#define SHF_ALLOC
#define SHF_EXECINSTR
#define SHF_MERGE
#define SHF_STRINGS
#define SHF_INFO_LINK
#define SHF_LINK_ORDER
#define SHF_OS_NONCONFORMING
#define SHF_GROUP
#define SHF_TLS

/* Special section numbers */
#define SHN_UNDEF
#define SHN_LORESERVE
#define SHN_LOPROC
#define SHN_HIPROC
#define SHN_ABS
#define SHN_COMMON
#define SHN_XINDEX
#define SHN_HIRESERVE

/* Same, but signed/sign-extended */
#define XSHN_UNDEF
#define XSHN_LORESERVE
#define XSHN_LOPROC
#define XSHN_HIPROC
#define XSHN_ABS
#define XSHN_COMMON
#define XSHN_XINDEX
#define XSHN_HIRESERVE

/* Section align flag */
#define SHA_ANY

/* Lenght of magic at the start of a file */
#define EI_NIDENT

/* Magic number constants... */
#define EI_MAG0
#define EI_MAG1
#define EI_MAG2
#define EI_MAG3
#define EI_CLASS
#define EI_DATA
#define EI_VERSION
#define EI_OSABI
#define EI_ABIVERSION
#define EI_NINDENT

#define ELFMAG0
#define ELFMAG1
#define ELFMAG2
#define ELFMAG3
#define ELFMAG
#define SELFMAG

#define ELFCLASSNONE
#define ELFCLASS32
#define ELFCLASS64
#define ELFCLASSNUM

#define ELFDATANONE
#define ELFDATA2LSB
#define ELFDATA2MSB

#define EV_NONE
#define EV_CURRENT
#define EV_NUM

#define ELFOSABI_NONE
#define ELFOSABI_LINUX

/* Legal values for ST_BIND subfield of st_info (symbol binding) */
#define STB_LOCAL
#define STB_GLOBAL
#define STB_WEAK
#define STB_NUM
#define STB_LOOS
#define STB_HIOS
#define STB_LOPROC
#define STB_HIPROC

/* Symbol types */
#define STT_NOTYPE
#define STT_OBJECT
#define STT_FUNC
#define STT_SECTION
#define STT_FILE
#define STT_COMMON
#define STT_TLS
#define STT_NUM

/* Symbol visibilities */
#define STV_DEFAULT
#define STV_INTERNAL
#define STV_HIDDEN
#define STV_PROTECTED

/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field  */
#define ELF32_ST_BIND(i)
#define ELF32_ST_MKBIND(i)
#define ELF32_ST_TYPE(i)
#define ELF32_ST_INFO(b, i)

#define ELF64_ST_BIND(i)
#define ELF64_ST_MKBIND(i)
#define ELF64_ST_TYPE(i)
#define ELF64_ST_INFO(b, i)

/*
 * ELF standard typedefs (yet more proof that <stdint.h> was way overdue)
 */

Elf32_Half;
Elf32_SHalf;
Elf32_Word;
Elf32_Sword;
Elf32_Xword;
Elf32_Sxword;

Elf32_Off;
Elf32_Addr;
Elf32_Section;

Elf64_Half;
Elf64_SHalf;
Elf64_Word;
Elf64_Sword;
Elf64_Xword;
Elf64_Sxword;

Elf64_Off;
Elf64_Addr;
Elf64_Section;

/*
 * Dynamic header
 */

Elf32_Dyn;

Elf64_Dyn;

/*
 * Relocations
 */

#define ELF32_R_SYM(x)
#define ELF32_R_TYPE(x)
#define ELF32_R_INFO(s,t)

Elf32_Rel;

Elf32_Rela;

enum reloc32_type {};

#define ELF64_R_SYM(x)
#define ELF64_R_TYPE(x)
#define ELF64_R_INFO(s,t)

Elf64_Rel;

Elf64_Rela;

enum reloc64_type {};

/*
 * Symbol
 */

Elf32_Sym;

Elf64_Sym;

/*
 * Main file header
 */

Elf32_Ehdr;

Elf64_Ehdr;

/*
 * Program header
 */

Elf32_Phdr;

Elf64_Phdr;

/*
 * Section header
 */

Elf32_Shdr;

Elf64_Shdr;

/*
 * Note header
 */
Elf32_Nhdr;

Elf64_Nhdr;

#endif /* OUTPUT_ELF_H */