LLVM API Documentation
00001 //===-- X86ELFWriterInfo.h - ELF Writer Info for X86 ------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements ELF writer information for the X86 backend. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef X86_ELF_WRITER_INFO_H 00015 #define X86_ELF_WRITER_INFO_H 00016 00017 #include "llvm/Target/TargetELFWriterInfo.h" 00018 00019 namespace llvm { 00020 00021 class X86ELFWriterInfo : public TargetELFWriterInfo { 00022 00023 // ELF Relocation types for X86 00024 enum X86RelocationType { 00025 R_386_NONE = 0, 00026 R_386_32 = 1, 00027 R_386_PC32 = 2 00028 }; 00029 00030 // ELF Relocation types for X86_64 00031 enum X86_64RelocationType { 00032 R_X86_64_NONE = 0, 00033 R_X86_64_64 = 1, 00034 R_X86_64_PC32 = 2, 00035 R_X86_64_32 = 10, 00036 R_X86_64_32S = 11, 00037 R_X86_64_PC64 = 24 00038 }; 00039 00040 public: 00041 X86ELFWriterInfo(TargetMachine &TM); 00042 virtual ~X86ELFWriterInfo(); 00043 00044 /// getRelocationType - Returns the target specific ELF Relocation type. 00045 /// 'MachineRelTy' contains the object code independent relocation type 00046 virtual unsigned getRelocationType(unsigned MachineRelTy) const; 00047 00048 /// hasRelocationAddend - True if the target uses an addend in the 00049 /// ELF relocation entry. 00050 virtual bool hasRelocationAddend() const { return is64Bit ? true : false; } 00051 00052 /// getDefaultAddendForRelTy - Gets the default addend value for a 00053 /// relocation entry based on the target ELF relocation type. 00054 virtual long int getDefaultAddendForRelTy(unsigned RelTy, 00055 long int Modifier = 0) const; 00056 00057 /// getRelTySize - Returns the size of relocatable field in bits 00058 virtual unsigned getRelocationTySize(unsigned RelTy) const; 00059 00060 /// isPCRelativeRel - True if the relocation type is pc relative 00061 virtual bool isPCRelativeRel(unsigned RelTy) const; 00062 00063 /// getJumpTableRelocationTy - Returns the machine relocation type used 00064 /// to reference a jumptable. 00065 virtual unsigned getAbsoluteLabelMachineRelTy() const; 00066 00067 /// computeRelocation - Some relocatable fields could be relocated 00068 /// directly, avoiding the relocation symbol emission, compute the 00069 /// final relocation value for this symbol. 00070 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset, 00071 unsigned RelTy) const; 00072 }; 00073 00074 } // end llvm namespace 00075 00076 #endif // X86_ELF_WRITER_INFO_H