1 // i386.h -- ELF definitions specific to EM_386  -*- C++ -*-
2 
3 // Copyright (C) 2006-2016 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
5 
6 // This file is part of elfcpp.
7 
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public License
10 // as published by the Free Software Foundation; either version 2, or
11 // (at your option) any later version.
12 
13 // In addition to the permissions in the GNU Library General Public
14 // License, the Free Software Foundation gives you unlimited
15 // permission to link the compiled version of this file into
16 // combinations with other programs, and to distribute those
17 // combinations without any restriction coming from the use of this
18 // file.  (The Library Public License restrictions do apply in other
19 // respects; for example, they cover modification of the file, and
20 /// distribution when not linked into a combined executable.)
21 
22 // This program is distributed in the hope that it will be useful, but
23 // WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 // Library General Public License for more details.
26 
27 // You should have received a copy of the GNU Library General Public
28 // License along with this program; if not, write to the Free Software
29 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
30 // 02110-1301, USA.
31 
32 #ifndef ELFCPP_I386_H
33 #define ELFCPP_I386_H
34 
35 // Documentation for the TLS relocs is taken from
36 //   http://people.redhat.com/drepper/tls.pdf
37 //   http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
38 
39 namespace elfcpp
40 {
41 
42 enum
43 {
44   R_386_NONE = 0,        // No reloc
45   R_386_32 = 1,          // Direct 32 bit zero extended
46   R_386_PC32 = 2,        // PC relative 32 bit signed
47   R_386_GOT32 = 3,       // 32 bit GOT entry
48   R_386_PLT32 = 4,       // 32 bit PLT address
49   R_386_COPY = 5,        // Copy symbol at runtime
50   R_386_GLOB_DAT = 6,    // Create GOT entry
51   R_386_JUMP_SLOT = 7,   // Create PLT entry
52   R_386_RELATIVE = 8,    // Adjust by program base
53   R_386_GOTOFF = 9,      // 32-bit GOT offset
54   R_386_GOTPC = 10,      // 32-bit PC relative offset to GOT
55   // Used by Sun.
56   R_386_32PLT = 11,
57   // TLS extensions.
58   R_386_TLS_TPOFF = 14,  // Outstanding Initial Exec reloc, gnu-style (both)
59   R_386_TLS_IE = 15,     // Initial Initial Exec reloc, gnu-style (no-PIC)
60   R_386_TLS_GOTIE = 16,  // Initial Initial Exec reloc, gnu-style (for PIC)
61   R_386_TLS_LE = 17,     // Initial Local Exec reloc, gnu-style
62   R_386_TLS_GD = 18,     // Initial General Dynamic reloc, gnu-style
63   R_386_TLS_LDM = 19,    // Initial Local Dynamic reloc, gnu-style
64   // GNU extensions.
65   R_386_16 = 20,         // Direct 16 bit zero extended
66   R_386_PC16 = 21,       // 16 bit sign extended pc relative
67   R_386_8 = 22,          // Direct 8 bit sign extended
68   R_386_PC8 = 23,        // 8 bit sign extended pc relative
69   // More TLS relocs.
70   R_386_TLS_GD_32 = 24,     // Initial General Dynamic reloc, sun-style
71   R_386_TLS_GD_PUSH = 25,   // Initial General Dynamic reloc, sun-style
72   R_386_TLS_GD_CALL = 26,   // Initial General Dynamic reloc, sun-style
73   R_386_TLS_GD_POP = 27,    // Initial General Dynamic reloc, sun-style
74   R_386_TLS_LDM_32 = 28,    // Initial Local Dynamic reloc, sun-style
75   R_386_TLS_LDM_PUSH = 29,  // Initial Local Dynamic reloc, sun-style
76   R_386_TLS_LDM_CALL = 30,  // Initial Local Dynamic reloc, sun-style
77   R_386_TLS_LDM_POP = 31,   // Initial Local Dynamic reloc, sun-style
78   R_386_TLS_LDO_32 = 32,    // Initial Local Dynamic reloc, sun+gnu styles
79   R_386_TLS_IE_32 = 33,     // Initial Initial Exec reloc, sun-style
80   R_386_TLS_LE_32 = 34,     // Initial Local Exec reloc, sun-style
81   R_386_TLS_DTPMOD32 = 35,  // Outstanding General/Local Dynamic reloc, sun+gnu
82   R_386_TLS_DTPOFF32 = 36,  // Outstanding General Dynamic reloc, sun+gnu
83   R_386_TLS_TPOFF32 = 37,   // Outstanding Initial Exec reloc, sun-style
84   R_386_TLS_GOTDESC = 39,   // GOT offset for TLS descriptor
85   R_386_TLS_DESC_CALL = 40, // Marker of call through TLS desc for relaxation
86   R_386_TLS_DESC = 41,      // TLS descriptor containing pointer to code and
87                             // to argument, returning TLS offset for symbol
88   R_386_IRELATIVE = 42,     // Adjust indirectly by program base
89   R_386_GOT32X = 43,        // 32 bit GOT entry, relaxable
90   // Used by Intel.
91   R_386_USED_BY_INTEL_200 = 200,
92   // GNU vtable garbage collection extensions.
93   R_386_GNU_VTINHERIT = 250,
94   R_386_GNU_VTENTRY = 251
95 };
96 
97 } // End namespace elfcpp.
98 
99 #endif // !defined(ELFCPP_I386_H)
100