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 | |
| 23 | // ELF Relocation types for X86 |
| 24 | enum X86RelocationType { |
| 25 | R_386_NONE = 0, |
| 26 | R_386_32 = 1, |
| 27 | R_386_PC32 = 2 |
| 28 | }; |
| 29 | |
| 30 | // ELF Relocation types for X86_64 |
| 31 | enum X86_64RelocationType { |
| 32 | R_X86_64_NONE = 0, |
| 33 | R_X86_64_64 = 1, |
| 34 | R_X86_64_PC32 = 2, |
| 35 | R_X86_64_32 = 10, |
| 36 | R_X86_64_32S = 11, |
| 37 | R_X86_64_PC64 = 24 |
| 38 | }; |
| 39 | |
Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 40 | public: |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 41 | X86ELFWriterInfo(TargetMachine &TM); |
Bill Wendling | 0db1f0b | 2007-01-27 11:40:32 +0000 | [diff] [blame] | 42 | virtual ~X86ELFWriterInfo(); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 43 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 44 | /// getRelocationType - Returns the target specific ELF Relocation type. |
| 45 | /// 'MachineRelTy' contains the object code independent relocation type |
| 46 | virtual unsigned getRelocationType(unsigned MachineRelTy) const; |
| 47 | |
| 48 | /// hasRelocationAddend - True if the target uses an addend in the |
| 49 | /// ELF relocation entry. |
| 50 | virtual bool hasRelocationAddend() const { return is64Bit ? true : false; } |
| 51 | |
| 52 | /// getAddendForRelTy - Gets the addend value for an ELF relocation entry |
| 53 | /// based on the target relocation type |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 54 | virtual long int getDefaultAddendForRelTy(unsigned RelTy) const; |
| 55 | |
| 56 | /// getRelTySize - Returns the size of relocatable field in bits |
| 57 | virtual unsigned getRelocationTySize(unsigned RelTy) const; |
| 58 | |
| 59 | /// getJumpTableRelocationTy - Returns the machine relocation type used |
| 60 | /// to reference a jumptable. |
Bruno Cardoso Lopes | 617dd7b | 2009-07-18 20:52:11 +0000 | [diff] [blame^] | 61 | virtual unsigned getAbsoluteLabelMachineRelTy() const; |
Bill Wendling | 40d7764 | 2007-01-27 02:54:30 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // end llvm namespace |
| 65 | |
| 66 | #endif // X86_ELF_WRITER_INFO_H |