Index: include/llvm/Target/TargetELFWriterInfo.h |
=================================================================== |
--- a/include/llvm/Target/TargetELFWriterInfo.h |
+++ b/include/llvm/Target/TargetELFWriterInfo.h |
@@ -14,11 +14,14 @@ |
#ifndef LLVM_TARGET_TARGETELFWRITERINFO_H |
#define LLVM_TARGET_TARGETELFWRITERINFO_H |
+#include "llvm/System/DataTypes.h" |
+ |
namespace llvm { |
class Function; |
class TargetData; |
class TargetMachine; |
class MachineRelocation; |
+ class TargetELFRelocHelper; |
class BinaryObject; |
//===--------------------------------------------------------------------===// |
// TargetELFWriterInfo |
@@ -119,8 +122,25 @@ |
/// final relocation value for this symbol. |
virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, |
unsigned RelTy) const = 0; |
+ |
+ // In certain architectures, nontrivial relocations require |
+ // peeking into the actual instructions in the stream for patching |
+ // purposes. |
+ |
+ virtual TargetELFRelocHelper *getRelocHelper() const; |
}; |
+ // This class isolates the arch-specific rules for |
+ // emitting nontrivial intra-section relocations. |
+ // This is a no-op in most architectures (e.g. x86) |
+ // This class is NOT a no-op in ARM/ELF |
+ class TargetELFRelocHelper { |
+ public: |
+ virtual ~TargetELFRelocHelper(); |
+ virtual void RelocateField(BinaryObject &BO, uint32_t Offset, |
+ int64_t Value, unsigned Size, |
+ const MachineRelocation &MR); |
+ }; |
} // end llvm namespace |
#endif // LLVM_TARGET_TARGETELFWRITERINFO_H |