xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_reloc_x86_64.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2   Copyright (C) 2007-2012 David Anderson. All Rights Reserved.
3   Portions Copyright (C) 2012 SN Systems Ltd. All rights reserved.
4 
5   This program is free software; you can redistribute it and/or modify it
6   under the terms of version 2.1 of the GNU Lesser General Public License
7   published by the Free Software Foundation.
8 
9   This program is distributed in the hope that it would be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13   Further, this software is distributed without any warranty that it is
14   free of the rightful claim of any third person regarding infringement
15   or the like.  Any license provided herein, whether implied or
16   otherwise, applies only to this software file.  Patent licenses, if
17   any, provided herein do not apply to combinations of this program with
18   other software, or any other product whatsoever.
19 
20   You should have received a copy of the GNU Lesser General Public License along
21   with this program; if not, write the Free Software Foundation, Inc., 51
22   Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
23 */
24 /* The address of the Free Software Foundation is
25    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
26    Boston, MA 02110-1301, USA.
27 */
28 
29 #ifndef DWARF_RELOC_X86_64_H
30 #define DWARF_RELOC_X86_64_H
31 
32 /* Definitions for X86_64 */
33 #define DWARF_RELOC_X86_64
34 
35 /* Include the definitions only in the case of Windows */
36 #ifdef _WIN32
37 /* Relocation types for AMD x86-64 architecture */
38 #define R_X86_64_NONE             0 /* No reloc */
39 #define R_X86_64_64               1 /* Direct 64 bit  */
40 #define R_X86_64_PC32             2 /* PC relative 32 bit signed */
41 #define R_X86_64_GOT32            3 /* 32 bit GOT entry */
42 #define R_X86_64_PLT32            4 /* 32 bit PLT address */
43 #define R_X86_64_COPY             5 /* Copy symbol at runtime */
44 #define R_X86_64_GLOB_DAT         6 /* Create GOT entry */
45 #define R_X86_64_JUMP_SLOT        7 /* Create PLT entry */
46 #define R_X86_64_RELATIVE	      8 /* Adjust by program base */
47 #define R_X86_64_GOTPCREL	      9 /* 32 bit signed pc relative offset to GOT */
48 #define R_X86_64_32		         10 /* Direct 32 bit zero extended */
49 #define R_X86_64_32S		     11 /* Direct 32 bit sign extended */
50 #define R_X86_64_16		         12 /* Direct 16 bit zero extended */
51 #define R_X86_64_PC16		     13 /* 16 bit sign extended pc relative */
52 #define R_X86_64_8		         14 /* Direct 8 bit sign extended  */
53 #define R_X86_64_PC8		     15 /* 8 bit sign extended pc relative */
54 #define R_X86_64_DTPMOD64        16 /* ID of module containing symbol */
55 #define R_X86_64_DTPOFF64        17 /* Offset in module's TLS block */
56 #define R_X86_64_TPOFF64         18 /* Offset in initial TLS block */
57 #define R_X86_64_TLSGD           19 /* 32 bit signed PC relative offset
58                                         to two GOT entries for GD symbol */
59 #define R_X86_64_TLSLD           20 /* 32 bit signed PC relative offset
60                                         to two GOT entries for LD symbol */
61 #define R_X86_64_DTPOFF32        21 /* Offset in TLS block */
62 #define R_X86_64_GOTTPOFF        22 /* 32 bit signed PC relative offset
63                                         to GOT entry for IE symbol */
64 #define R_X86_64_TPOFF32         23 /* Offset in initial TLS block */
65 #define R_X86_64_PC64            24 /* PC relative 64 bit */
66 #define R_X86_64_GOTOFF64        25 /* 64 bit offset to GOT */
67 #define R_X86_64_GOTPC32         26 /* 32 bit signed pc relative offset to GOT */
68 #define R_X86_64_GOT64           27 /* 64-bit GOT entry offset */
69 #define R_X86_64_GOTPCREL64      28 /* 64-bit PC relative offset to GOT entry */
70 #define R_X86_64_GOTPC64         29 /* 64-bit PC relative offset to GOT */
71 #define R_X86_64_GOTPLT64        30 /* like GOT64, says PLT entry needed */
72 #define R_X86_64_PLTOFF64        31 /* 64-bit GOT relative offset to PLT entry */
73 #define R_X86_64_SIZE32          32 /* Size of symbol plus 32-bit addend */
74 #define R_X86_64_SIZE64          33 /* Size of symbol plus 64-bit addend */
75 #define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor */
76 #define R_X86_64_TLSDESC_CALL    35 /* Marker for call through TLS descriptor */
77 #define R_X86_64_TLSDESC         36 /* TLS descriptor */
78 #define R_X86_64_IRELATIVE       37 /* Adjust indirectly by program base */
79 #define R_X86_64_RELATIVE64      38 /* 64bit adjust by program base */
80 
81 /*  Keep this the last entry.  */
82 #define R_X86_64_NUM             39
83 #endif /* _WIN32 */
84 
85 /* Relocation types for X86_64 */
86 static const char *reloc_type_names_X86_64[] = {
87     "R_X86_64_NONE",            /* 00 */
88     "R_X86_64_64",              /* 01 */
89     "R_X86_64_PC32",            /* 02 */
90     "R_X86_64_GOT32",           /* 03 */
91     "R_X86_64_PLT32",           /* 04 */
92     "R_X86_64_COPY",            /* 05 */
93     "R_X86_64_GLOB_DAT",        /* 06 */
94     "R_X86_64_JUMP_SLOT",       /* 07 */
95     "R_X86_64_RELATIVE",        /* 08 */
96     "R_X86_64_GOTPCREL",        /* 09 */
97     "R_X86_64_32",              /* 10 */
98     "R_X86_64_32S",             /* 11 */
99     "R_X86_64_16",              /* 12 */
100     "R_X86_64_PC16",            /* 13 */
101     "R_X86_64_8",               /* 14 */
102     "R_X86_64_PC8",             /* 15 */
103     "R_X86_64_DTPMOD64",        /* 16 */
104     "R_X86_64_DTPOFF64",        /* 17 */
105     "R_X86_64_TPOFF64",         /* 18 */
106     "R_X86_64_TLSGD",           /* 19 */
107     "R_X86_64_TLSLD",           /* 20 */
108     "R_X86_64_DTPOFF32",        /* 21 */
109     "R_X86_64_GOTTPOFF",        /* 22 */
110     "R_X86_64_TPOFF32",         /* 23 */
111     "R_X86_64_PC64",            /* 24 */
112     "R_X86_64_GOTOFF64",        /* 25 */
113     "R_X86_64_GOTPC32",         /* 26 */
114     "R_X86_64_GOT64",           /* 27 */
115     "R_X86_64_GOTPCREL64",      /* 28 */
116     "R_X86_64_GOTPC64",         /* 29 */
117     "R_X86_64_GOTPLT64",        /* 30 */
118     "R_X86_64_PLTOFF64",        /* 31 */
119     "R_X86_64_SIZE32",          /* 32 */
120     "R_X86_64_SIZE64",          /* 33 */
121     "R_X86_64_GOTPC32_TLSDESC", /* 34 */
122     "R_X86_64_TLSDESC_CALL",    /* 35 */
123     "R_X86_64_TLSDESC",         /* 36 */
124     "R_X86_64_IRELATIVE",       /* 37 */
125     "R_X86_64_RELATIVE64",      /* 38 */
126 };
127 #endif /* DWARF_RELOC_X86_64_H */
128