OLD | NEW |
1 //===-- X86ELFWriterInfo.h - ELF Writer Info for X86 ------------*- C++ -*-===// | 1 //===-- X86ELFWriterInfo.h - ELF Writer Info for X86 ------------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements ELF writer information for the X86 backend. | 10 // This file implements ELF writer information for the X86 backend. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef X86_ELF_WRITER_INFO_H | 14 #ifndef X86_ELF_WRITER_INFO_H |
15 #define X86_ELF_WRITER_INFO_H | 15 #define X86_ELF_WRITER_INFO_H |
16 | 16 |
17 #include "llvm/Target/TargetELFWriterInfo.h" | 17 #include "llvm/Target/TargetELFWriterInfo.h" |
18 | 18 |
19 namespace llvm { | 19 namespace llvm { |
20 | 20 class BinaryObject; |
| 21 class MachineRelocation; |
21 class X86ELFWriterInfo : public TargetELFWriterInfo { | 22 class X86ELFWriterInfo : public TargetELFWriterInfo { |
22 | 23 |
23 // ELF Relocation types for X86 | 24 // ELF Relocation types for X86 |
24 enum X86RelocationType { | 25 enum X86RelocationType { |
25 R_386_NONE = 0, | 26 R_386_NONE = 0, |
26 R_386_32 = 1, | 27 R_386_32 = 1, |
27 R_386_PC32 = 2 | 28 R_386_PC32 = 2 |
28 }; | 29 }; |
29 | 30 |
30 // ELF Relocation types for X86_64 | 31 // ELF Relocation types for X86_64 |
31 enum X86_64RelocationType { | 32 enum X86_64RelocationType { |
32 R_X86_64_NONE = 0, | 33 R_X86_64_NONE = 0, |
33 R_X86_64_64 = 1, | 34 R_X86_64_64 = 1, |
34 R_X86_64_PC32 = 2, | 35 R_X86_64_PC32 = 2, |
35 R_X86_64_32 = 10, | 36 R_X86_64_32 = 10, |
36 R_X86_64_32S = 11, | 37 R_X86_64_32S = 11, |
37 R_X86_64_PC64 = 24 | 38 R_X86_64_PC64 = 24 |
38 }; | 39 }; |
39 | 40 |
40 public: | 41 public: |
41 X86ELFWriterInfo(bool is64Bit_, bool isLittleEndian_); | 42 X86ELFWriterInfo(bool is64Bit_, bool isLittleEndian_); |
42 virtual ~X86ELFWriterInfo(); | 43 virtual ~X86ELFWriterInfo(); |
43 | 44 |
44 /// getRelocationType - Returns the target specific ELF Relocation type. | 45 /// getRelocationType - Returns the target specific ELF Relocation type. |
45 /// 'MachineRelTy' contains the object code independent relocation type | 46 /// S is the ELF section blob that contains the relocation |
46 virtual unsigned getRelocationType(unsigned MachineRelTy) const; | 47 /// MR contains the object code independent relocation type |
| 48 virtual unsigned getRelocationType(const BinaryObject &S, |
| 49 const MachineRelocation &MR) const; |
47 | 50 |
48 /// hasRelocationAddend - True if the target uses an addend in the | 51 /// hasRelocationAddend - True if the target uses an addend in the |
49 /// ELF relocation entry. | 52 /// ELF relocation entry. |
50 virtual bool hasRelocationAddend() const { return is64Bit ? true : false; } | 53 virtual bool hasRelocationAddend() const { return is64Bit ? true : false; } |
51 | 54 |
52 /// getDefaultAddendForRelTy - Gets the default addend value for a | 55 /// getDefaultAddendForRelTy - Gets the default addend value for a |
53 /// relocation entry based on the target ELF relocation type. | 56 /// relocation entry based on the target ELF relocation type. |
54 virtual long int getDefaultAddendForRelTy(unsigned RelTy, | 57 virtual long int getDefaultAddendForRelTy(unsigned RelTy, |
55 long int Modifier = 0) const; | 58 long int Modifier = 0) const; |
56 | 59 |
(...skipping 10 matching lines...) Expand all Loading... |
67 /// computeRelocation - Some relocatable fields could be relocated | 70 /// computeRelocation - Some relocatable fields could be relocated |
68 /// directly, avoiding the relocation symbol emission, compute the | 71 /// directly, avoiding the relocation symbol emission, compute the |
69 /// final relocation value for this symbol. | 72 /// final relocation value for this symbol. |
70 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, | 73 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, |
71 unsigned RelTy) const; | 74 unsigned RelTy) const; |
72 }; | 75 }; |
73 | 76 |
74 } // end llvm namespace | 77 } // end llvm namespace |
75 | 78 |
76 #endif // X86_ELF_WRITER_INFO_H | 79 #endif // X86_ELF_WRITER_INFO_H |
OLD | NEW |