OLD | NEW |
1 //===-- X86ELFWriterInfo.cpp - ELF Writer Info for the X86 backend --------===// | 1 //===-- X86ELFWriterInfo.cpp - ELF Writer Info for the X86 backend --------===// |
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. |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Implementation of the X86ELFWriterInfo class | 24 // Implementation of the X86ELFWriterInfo class |
25 //===----------------------------------------------------------------------===// | 25 //===----------------------------------------------------------------------===// |
26 | 26 |
27 X86ELFWriterInfo::X86ELFWriterInfo(bool is64Bit_, bool isLittleEndian_) | 27 X86ELFWriterInfo::X86ELFWriterInfo(bool is64Bit_, bool isLittleEndian_) |
28 : TargetELFWriterInfo(is64Bit_, isLittleEndian_) { | 28 : TargetELFWriterInfo(is64Bit_, isLittleEndian_) { |
29 EMachine = is64Bit ? EM_X86_64 : EM_386; | 29 EMachine = is64Bit ? EM_X86_64 : EM_386; |
30 } | 30 } |
31 | 31 |
32 X86ELFWriterInfo::~X86ELFWriterInfo() {} | 32 X86ELFWriterInfo::~X86ELFWriterInfo() {} |
33 | 33 |
34 unsigned X86ELFWriterInfo::getRelocationType(unsigned MachineRelTy) const { | 34 unsigned X86ELFWriterInfo::getRelocationType(const BinaryObject &, |
| 35 const MachineRelocation &MR) const
{ |
| 36 unsigned int MachineRelTy = MR.getRelocationType(); |
35 if (is64Bit) { | 37 if (is64Bit) { |
36 switch(MachineRelTy) { | 38 switch(MachineRelTy) { |
37 case X86::reloc_pcrel_word: | 39 case X86::reloc_pcrel_word: |
38 return R_X86_64_PC32; | 40 return R_X86_64_PC32; |
39 case X86::reloc_absolute_word: | 41 case X86::reloc_absolute_word: |
40 return R_X86_64_32; | 42 return R_X86_64_32; |
41 case X86::reloc_absolute_word_sext: | 43 case X86::reloc_absolute_word_sext: |
42 return R_X86_64_32S; | 44 return R_X86_64_32S; |
43 case X86::reloc_absolute_dword: | 45 case X86::reloc_absolute_dword: |
44 return R_X86_64_64; | 46 return R_X86_64_64; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 unsigned RelOffset, | 145 unsigned RelOffset, |
144 unsigned RelTy) const { | 146 unsigned RelTy) const { |
145 | 147 |
146 if (RelTy == R_X86_64_PC32 || RelTy == R_386_PC32) | 148 if (RelTy == R_X86_64_PC32 || RelTy == R_386_PC32) |
147 return SymOffset - (RelOffset + 4); | 149 return SymOffset - (RelOffset + 4); |
148 else | 150 else |
149 assert("computeRelocation unknown for this relocation type"); | 151 assert("computeRelocation unknown for this relocation type"); |
150 | 152 |
151 return 0; | 153 return 0; |
152 } | 154 } |
OLD | NEW |