| 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 namespace llvm { | 17 namespace llvm { |
| 18 class Function; | 18 class Function; |
| 19 class TargetData; | 19 class TargetData; |
| 20 class TargetMachine; | 20 class TargetMachine; |
| 21 | 21 class MachineRelocation; |
| 22 class BinaryObject; |
| 22 //===--------------------------------------------------------------------===// | 23 //===--------------------------------------------------------------------===// |
| 23 // TargetELFWriterInfo | 24 // TargetELFWriterInfo |
| 24 //===--------------------------------------------------------------------===// | 25 //===--------------------------------------------------------------------===// |
| 25 | 26 |
| 26 class TargetELFWriterInfo { | 27 class TargetELFWriterInfo { |
| 27 protected: | 28 protected: |
| 28 // EMachine - This field is the target specific value to emit as the | 29 // EMachine - This field is the target specific value to emit as the |
| 29 // e_machine member of the ELF header. | 30 // e_machine member of the ELF header. |
| 30 unsigned short EMachine; | 31 unsigned short EMachine; |
| 31 bool is64Bit, isLittleEndian; | 32 bool is64Bit, isLittleEndian; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 /// is used to align some sections. | 83 /// is used to align some sections. |
| 83 unsigned getPrefELFAlignment() const { return is64Bit ? 8 : 4; } | 84 unsigned getPrefELFAlignment() const { return is64Bit ? 8 : 4; } |
| 84 | 85 |
| 85 /// getRelocationEntrySize - Entry size used in the relocation section | 86 /// getRelocationEntrySize - Entry size used in the relocation section |
| 86 unsigned getRelocationEntrySize() const { | 87 unsigned getRelocationEntrySize() const { |
| 87 return is64Bit ? (hasRelocationAddend() ? 24 : 16) | 88 return is64Bit ? (hasRelocationAddend() ? 24 : 16) |
| 88 : (hasRelocationAddend() ? 12 : 8); | 89 : (hasRelocationAddend() ? 12 : 8); |
| 89 } | 90 } |
| 90 | 91 |
| 91 /// getRelocationType - Returns the target specific ELF Relocation type. | 92 /// getRelocationType - Returns the target specific ELF Relocation type. |
| 92 /// 'MachineRelTy' contains the object code independent relocation type | 93 /// S is the ELF section blob that contains the relocation |
| 93 virtual unsigned getRelocationType(unsigned MachineRelTy) const = 0; | 94 /// MR contains the object code independent relocation type |
| 95 virtual unsigned getRelocationType(const BinaryObject &S, |
| 96 const MachineRelocation &MR) const = 0; |
| 94 | 97 |
| 95 /// hasRelocationAddend - True if the target uses an addend in the | 98 /// hasRelocationAddend - True if the target uses an addend in the |
| 96 /// ELF relocation entry. | 99 /// ELF relocation entry. |
| 97 virtual bool hasRelocationAddend() const = 0; | 100 virtual bool hasRelocationAddend() const = 0; |
| 98 | 101 |
| 99 /// getDefaultAddendForRelTy - Gets the default addend value for a | 102 /// getDefaultAddendForRelTy - Gets the default addend value for a |
| 100 /// relocation entry based on the target ELF relocation type. | 103 /// relocation entry based on the target ELF relocation type. |
| 101 virtual long int getDefaultAddendForRelTy(unsigned RelTy, | 104 virtual long int getDefaultAddendForRelTy(unsigned RelTy, |
| 102 long int Modifier = 0) const = 0; | 105 long int Modifier = 0) const = 0; |
| 103 | 106 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 114 /// computeRelocation - Some relocatable fields could be relocated | 117 /// computeRelocation - Some relocatable fields could be relocated |
| 115 /// directly, avoiding the relocation symbol emission, compute the | 118 /// directly, avoiding the relocation symbol emission, compute the |
| 116 /// final relocation value for this symbol. | 119 /// final relocation value for this symbol. |
| 117 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, | 120 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, |
| 118 unsigned RelTy) const = 0; | 121 unsigned RelTy) const = 0; |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 } // end llvm namespace | 124 } // end llvm namespace |
| 122 | 125 |
| 123 #endif // LLVM_TARGET_TARGETELFWRITERINFO_H | 126 #endif // LLVM_TARGET_TARGETELFWRITERINFO_H |
| OLD | NEW |