summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-12-21 15:26:45 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-12-21 15:26:45 +0000
commite1feeb9da41fd48002e363c6dbb0a3d7bf0b7811 (patch)
tree137599350619b8f203f0f514fc3ccf23fe8a4813 /include
parent025c98bdbdda72fa06c3cbbeb7a3190ed0006300 (diff)
downloadllvm-e1feeb9da41fd48002e363c6dbb0a3d7bf0b7811.tar.gz
llvm-e1feeb9da41fd48002e363c6dbb0a3d7bf0b7811.tar.bz2
llvm-e1feeb9da41fd48002e363c6dbb0a3d7bf0b7811.tar.xz
MC/Mach-O: Shuffle enums a bit to make it harder to inadvertently use the wrong
type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCMachObjectWriter.h8
-rw-r--r--include/llvm/Object/MachOFormat.h20
2 files changed, 20 insertions, 8 deletions
diff --git a/include/llvm/MC/MCMachObjectWriter.h b/include/llvm/MC/MCMachObjectWriter.h
index 6dfa3225d8..ec51031d0b 100644
--- a/include/llvm/MC/MCMachObjectWriter.h
+++ b/include/llvm/MC/MCMachObjectWriter.h
@@ -22,12 +22,17 @@ class MCMachObjectTargetWriter {
// FIXME: Remove this, we should just always use it once we no longer care
// about Darwin 'as' compatibility.
const unsigned UseAggressiveSymbolFolding : 1;
+ unsigned LocalDifference_RIT;
protected:
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
uint32_t CPUSubtype_,
bool UseAggressiveSymbolFolding_ = false);
+ void setLocalDifferenceRelocationType(unsigned Type) {
+ LocalDifference_RIT = Type;
+ }
+
public:
virtual ~MCMachObjectTargetWriter();
@@ -38,6 +43,9 @@ public:
bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
uint32_t getCPUType() const { return CPUType; }
uint32_t getCPUSubtype() const { return CPUSubtype; }
+ unsigned getLocalDifferenceRelocationType() const {
+ return LocalDifference_RIT;
+ }
/// @}
};
diff --git a/include/llvm/Object/MachOFormat.h b/include/llvm/Object/MachOFormat.h
index 5a33951e28..caeed5a70a 100644
--- a/include/llvm/Object/MachOFormat.h
+++ b/include/llvm/Object/MachOFormat.h
@@ -317,17 +317,24 @@ namespace macho {
RF_Scattered = 0x80000000
};
+ /// Common relocation info types.
enum RelocationInfoType {
RIT_Vanilla = 0,
RIT_Pair = 1,
- RIT_Difference = 2,
- RIT_PreboundLazyPointer = 3,
- RIT_LocalDifference = 4,
- RIT_TLV = 5
+ RIT_Difference = 2
+ };
+
+ /// Generic relocation info types, which are shared by some (but not all)
+ /// platforms.
+ enum RelocationInfoType_Generic {
+ RIT_Generic_PreboundLazyPointer = 3,
+ RIT_Generic_LocalDifference = 4,
+ RIT_Generic_TLV = 5
};
/// X86_64 uses its own relocation types.
enum RelocationInfoTypeX86_64 {
+ // Note that x86_64 doesn't even share the common relocation types.
RIT_X86_64_Unsigned = 0,
RIT_X86_64_Signed = 1,
RIT_X86_64_Branch = 2,
@@ -342,11 +349,8 @@ namespace macho {
/// ARM also has its own relocation types.
enum RelocationInfoTypeARM {
- RIT_ARM_Vanilla = 0,
- RIT_ARM_Pair = 1,
- RIT_ARM_Difference = 2,
RIT_ARM_LocalDifference = 3,
- RIT_ARM_PreboundLazyPointer =4,
+ RIT_ARM_PreboundLazyPointer = 4,
RIT_ARM_Branch24Bit = 5,
RIT_ARM_ThumbBranch22Bit = 6,
RIT_ARM_ThumbBranch32Bit = 7