IMUL: fix an additional incorrect sbyte use
[nasm/avx512.git] / output / elf64.h
blob91aef94c844233faafdcc12d9e5fc87edc8347ab
1 /* ----------------------------------------------------------------------- *
3 * Copyright 1996-2009 The NASM Authors - All Rights Reserved
4 * See the file AUTHORS included with the NASM distribution for
5 * the specific copyright holders.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following
9 * conditions are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * ----------------------------------------------------------------------- */
34 #ifndef OUTPUT_ELF64_H
35 #define OUTPUT_ELF64_H
37 #include "output/elfcommon.h"
39 /* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
40 typedef uint16_t Elf64_Half;
41 typedef int16_t Elf64_SHalf;
42 typedef uint32_t Elf64_Word;
43 typedef int32_t Elf64_Sword;
44 typedef uint64_t Elf64_Xword;
45 typedef int64_t Elf64_Sxword;
47 typedef uint64_t Elf64_Off;
48 typedef uint64_t Elf64_Addr;
49 typedef uint16_t Elf64_Section;
51 /* Dynamic header */
53 typedef struct elf64_dyn {
54 Elf64_Sxword d_tag;
55 union {
56 Elf64_Xword d_val;
57 Elf64_Addr d_ptr;
58 } d_un;
59 } Elf64_Dyn;
61 /* Relocations */
63 #define ELF64_R_SYM(x) ((x) >> 32)
64 #define ELF64_R_TYPE(x) ((x) & 0xffffffff)
66 typedef struct elf64_rel {
67 Elf64_Addr r_offset;
68 Elf64_Xword r_info;
69 } Elf64_Rel;
71 typedef struct elf64_rela {
72 Elf64_Addr r_offset;
73 Elf64_Xword r_info;
74 Elf64_Sxword r_addend;
75 } Elf64_Rela;
77 enum reloc64_type {
78 R_X86_64_NONE = 0, /* No reloc */
79 R_X86_64_64 = 1, /* Direct 64 bit */
80 R_X86_64_PC32 = 2, /* PC relative 32 bit signed */
81 R_X86_64_GOT32 = 3, /* 32 bit GOT entry */
82 R_X86_64_PLT32 = 4, /* 32 bit PLT address */
83 R_X86_64_COPY = 5, /* Copy symbol at runtime */
84 R_X86_64_GLOB_DAT = 6, /* Create GOT entry */
85 R_X86_64_JUMP_SLOT = 7, /* Create PLT entry */
86 R_X86_64_RELATIVE = 8, /* Adjust by program base */
87 R_X86_64_GOTPCREL = 9, /* 32 bit signed PC relative offset to GOT */
88 R_X86_64_32 = 10, /* Direct 32 bit zero extended */
89 R_X86_64_32S = 11, /* Direct 32 bit sign extended */
90 R_X86_64_16 = 12, /* Direct 16 bit zero extended */
91 R_X86_64_PC16 = 13, /* 16 bit sign extended pc relative */
92 R_X86_64_8 = 14, /* Direct 8 bit sign extended */
93 R_X86_64_PC8 = 15, /* 8 bit sign extended pc relative */
94 R_X86_64_DTPMOD64 = 16, /* ID of module containing symbol */
95 R_X86_64_DTPOFF64 = 17, /* Offset in module's TLS block */
96 R_X86_64_TPOFF64 = 18, /* Offset in initial TLS block */
97 R_X86_64_TLSGD = 19, /* 32 bit signed PC relative offset
98 to two GOT entries for GD symbol */
99 R_X86_64_TLSLD = 20, /* 32 bit signed PC relative offset
100 to two GOT entries for LD symbol */
101 R_X86_64_DTPOFF32 = 21, /* Offset in TLS block */
102 R_X86_64_GOTTPOFF = 22, /* 32 bit signed PC relative offset
103 to GOT entry for IE symbol */
104 R_X86_64_TPOFF32 = 23, /* Offset in initial TLS block */
105 R_X86_64_PC64 = 24, /* word64 S + A - P */
106 R_X86_64_GOTOFF64 = 25, /* word64 S + A - GOT */
107 R_X86_64_GOTPC32 = 26, /* word32 GOT + A - P */
108 R_X86_64_GOT64 = 27, /* word64 G + A */
109 R_X86_64_GOTPCREL64 = 28, /* word64 G + GOT - P + A */
110 R_X86_64_GOTPC64 = 29, /* word64 GOT - P + A */
111 R_X86_64_GOTPLT64 = 30, /* word64 G + A */
112 R_X86_64_PLTOFF64 = 31, /* word64 L - GOT + A */
113 R_X86_64_SIZE32 = 32, /* word32 Z + A */
114 R_X86_64_SIZE64 = 33, /* word64 Z + A */
115 R_X86_64_GOTPC32_TLSDESC = 34, /* word32 */
116 R_X86_64_TLSDESC_CALL = 35, /* none */
117 R_X86_64_TLSDESC = 36 /* word64×2 */
120 /* Symbol */
122 typedef struct elf64_sym {
123 Elf64_Word st_name;
124 unsigned char st_info;
125 unsigned char st_other;
126 Elf64_Half st_shndx;
127 Elf64_Addr st_value;
128 Elf64_Xword st_size;
129 } Elf64_Sym;
131 /* Main file header */
133 typedef struct elf64_hdr {
134 unsigned char e_ident[EI_NIDENT];
135 Elf64_Half e_type;
136 Elf64_Half e_machine;
137 Elf64_Word e_version;
138 Elf64_Addr e_entry;
139 Elf64_Off e_phoff;
140 Elf64_Off e_shoff;
141 Elf64_Word e_flags;
142 Elf64_Half e_ehsize;
143 Elf64_Half e_phentsize;
144 Elf64_Half e_phnum;
145 Elf64_Half e_shentsize;
146 Elf64_Half e_shnum;
147 Elf64_Half e_shstrndx;
148 } Elf64_Ehdr;
150 /* Program header */
152 typedef struct elf64_phdr {
153 Elf64_Word p_type;
154 Elf64_Word p_flags;
155 Elf64_Off p_offset;
156 Elf64_Addr p_vaddr;
157 Elf64_Addr p_paddr;
158 Elf64_Xword p_filesz;
159 Elf64_Xword p_memsz;
160 Elf64_Xword p_align;
161 } Elf64_Phdr;
163 /* Section header */
165 typedef struct elf64_shdr {
166 Elf64_Word sh_name;
167 Elf64_Word sh_type;
168 Elf64_Xword sh_flags;
169 Elf64_Addr sh_addr;
170 Elf64_Off sh_offset;
171 Elf64_Xword sh_size;
172 Elf64_Word sh_link;
173 Elf64_Word sh_info;
174 Elf64_Xword sh_addralign;
175 Elf64_Xword sh_entsize;
176 } Elf64_Shdr;
178 /* Note header */
179 typedef struct elf64_note {
180 Elf64_Word n_namesz; /* Name size */
181 Elf64_Word n_descsz; /* Content size */
182 Elf64_Word n_type; /* Content type */
183 } Elf64_Nhdr;
185 /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
186 #define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
187 #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
189 #endif /* OUTPUT_ELF64_H */