OLD | NEW |
1 //===-- llvm/Target/TargetELFWriterInfo.h - ELF Writer Info -----*- C++ -*-===// | 1 //===-- llvm/Target/TargetELFWriterInfo.h - ELF Writer Info -----*- 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 defines the TargetELFWriterInfo class. | 10 // This file defines the TargetELFWriterInfo class. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H | 14 #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H |
15 #define LLVM_TARGET_TARGETELFWRITERINFO_H | 15 #define LLVM_TARGET_TARGETELFWRITERINFO_H |
16 | 16 |
| 17 #include "llvm/System/DataTypes.h" |
| 18 |
17 namespace llvm { | 19 namespace llvm { |
18 class Function; | 20 class Function; |
19 class TargetData; | 21 class TargetData; |
20 class TargetMachine; | 22 class TargetMachine; |
21 class MachineRelocation; | 23 class MachineRelocation; |
| 24 class TargetELFRelocHelper; |
22 class BinaryObject; | 25 class BinaryObject; |
23 //===--------------------------------------------------------------------===// | 26 //===--------------------------------------------------------------------===// |
24 // TargetELFWriterInfo | 27 // TargetELFWriterInfo |
25 //===--------------------------------------------------------------------===// | 28 //===--------------------------------------------------------------------===// |
26 | 29 |
27 class TargetELFWriterInfo { | 30 class TargetELFWriterInfo { |
28 protected: | 31 protected: |
29 // EMachine - This field is the target specific value to emit as the | 32 // EMachine - This field is the target specific value to emit as the |
30 // e_machine member of the ELF header. | 33 // e_machine member of the ELF header. |
31 unsigned short EMachine; | 34 unsigned short EMachine; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 115 |
113 /// getJumpTableRelocationTy - Returns the machine relocation type used | 116 /// getJumpTableRelocationTy - Returns the machine relocation type used |
114 /// to reference a jumptable. | 117 /// to reference a jumptable. |
115 virtual unsigned getAbsoluteLabelMachineRelTy() const = 0; | 118 virtual unsigned getAbsoluteLabelMachineRelTy() const = 0; |
116 | 119 |
117 /// computeRelocation - Some relocatable fields could be relocated | 120 /// computeRelocation - Some relocatable fields could be relocated |
118 /// directly, avoiding the relocation symbol emission, compute the | 121 /// directly, avoiding the relocation symbol emission, compute the |
119 /// final relocation value for this symbol. | 122 /// final relocation value for this symbol. |
120 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, | 123 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, |
121 unsigned RelTy) const = 0; | 124 unsigned RelTy) const = 0; |
| 125 |
| 126 // In certain architectures, nontrivial relocations require |
| 127 // peeking into the actual instructions in the stream for patching |
| 128 // purposes. |
| 129 |
| 130 virtual TargetELFRelocHelper *getRelocHelper() const; |
122 }; | 131 }; |
123 | 132 |
| 133 // This class isolates the arch-specific rules for |
| 134 // emitting nontrivial intra-section relocations. |
| 135 // This is a no-op in most architectures (e.g. x86) |
| 136 // This class is NOT a no-op in ARM/ELF |
| 137 class TargetELFRelocHelper { |
| 138 public: |
| 139 virtual ~TargetELFRelocHelper(); |
| 140 virtual void RelocateField(BinaryObject &BO, uint32_t Offset, |
| 141 int64_t Value, unsigned Size, |
| 142 const MachineRelocation &MR); |
| 143 }; |
124 } // end llvm namespace | 144 } // end llvm namespace |
125 | 145 |
126 #endif // LLVM_TARGET_TARGETELFWRITERINFO_H | 146 #endif // LLVM_TARGET_TARGETELFWRITERINFO_H |
OLD | NEW |