Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 1 | //===-- X86ELFWriterInfo.h - ELF Writer Info for X86 ------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements ELF writer information for the X86 backend. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef X86_ELF_WRITER_INFO_H |
| 15 | #define X86_ELF_WRITER_INFO_H |
| 16 | |
| 17 | #include "llvm/Target/TargetELFWriterInfo.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | class X86ELFWriterInfo : public TargetELFWriterInfo { |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 22 | |
Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 23 | public: |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 24 | X86ELFWriterInfo(bool is64Bit_, bool isLittleEndian_); |
Bill Wendling | 0db1f0b | 2007-01-27 11:40:32 +0000 | [diff] [blame] | 25 | virtual ~X86ELFWriterInfo(); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 26 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 27 | /// getRelocationType - Returns the target specific ELF Relocation type. |
| 28 | /// 'MachineRelTy' contains the object code independent relocation type |
| 29 | virtual unsigned getRelocationType(unsigned MachineRelTy) const; |
| 30 | |
| 31 | /// hasRelocationAddend - True if the target uses an addend in the |
| 32 | /// ELF relocation entry. |
| 33 | virtual bool hasRelocationAddend() const { return is64Bit ? true : false; } |
| 34 | |
Bruno Cardoso Lopes | 0a38dc5 | 2009-07-20 08:52:02 +0000 | [diff] [blame] | 35 | /// getDefaultAddendForRelTy - Gets the default addend value for a |
| 36 | /// relocation entry based on the target ELF relocation type. |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 37 | virtual long int getDefaultAddendForRelTy(unsigned RelTy, |
| 38 | long int Modifier = 0) const; |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 39 | |
| 40 | /// getRelTySize - Returns the size of relocatable field in bits |
| 41 | virtual unsigned getRelocationTySize(unsigned RelTy) const; |
| 42 | |
Bruno Cardoso Lopes | 0a38dc5 | 2009-07-20 08:52:02 +0000 | [diff] [blame] | 43 | /// isPCRelativeRel - True if the relocation type is pc relative |
| 44 | virtual bool isPCRelativeRel(unsigned RelTy) const; |
| 45 | |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 46 | /// getJumpTableRelocationTy - Returns the machine relocation type used |
| 47 | /// to reference a jumptable. |
Bruno Cardoso Lopes | 617dd7b | 2009-07-18 20:52:11 +0000 | [diff] [blame] | 48 | virtual unsigned getAbsoluteLabelMachineRelTy() const; |
Bruno Cardoso Lopes | 0a38dc5 | 2009-07-20 08:52:02 +0000 | [diff] [blame] | 49 | |
| 50 | /// computeRelocation - Some relocatable fields could be relocated |
| 51 | /// directly, avoiding the relocation symbol emission, compute the |
| 52 | /// final relocation value for this symbol. |
| 53 | virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, |
| 54 | unsigned RelTy) const; |
Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | } // end llvm namespace |
| 58 | |
| 59 | #endif // X86_ELF_WRITER_INFO_H |