1 //===-- MBlazeELFWriterInfo.h - ELF Writer Info for MBlaze ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements ELF writer information for the MBlaze backend.
12 //===----------------------------------------------------------------------===//
14 #ifndef MBLAZE_ELF_WRITER_INFO_H
15 #define MBLAZE_ELF_WRITER_INFO_H
17 #include "llvm/Target/TargetELFWriterInfo.h"
21 class MBlazeELFWriterInfo : public TargetELFWriterInfo {
23 // ELF Relocation types for MBlaze
24 enum MBlazeRelocationType {
25 R_MICROBLAZE_NONE = 0,
27 R_MICROBLAZE_32_PCREL = 2,
28 R_MICROBLAZE_64_PCREL = 3,
29 R_MICROBLAZE_32_PCREL_LO = 4,
31 R_MICROBLAZE_32_LO = 6,
32 R_MICROBLAZE_SRO32 = 7,
33 R_MICROBLAZE_SRW32 = 8,
34 R_MICROBLAZE_64_NONE = 9,
35 R_MICROBLAZE_32_SYM_OP_SYM = 10,
36 R_MICROBLAZE_GNU_VTINHERIT = 11,
37 R_MICROBLAZE_GNU_VTENTRY = 12,
38 R_MICROBLAZE_GOTPC_64 = 13,
39 R_MICROBLAZE_GOT_64 = 14,
40 R_MICROBLAZE_PLT_64 = 15,
41 R_MICROBLAZE_REL = 16,
42 R_MICROBLAZE_JUMP_SLOT = 17,
43 R_MICROBLAZE_GLOB_DAT = 18,
44 R_MICROBLAZE_GOTOFF_64 = 19,
45 R_MICROBLAZE_GOTOFF_32 = 20,
46 R_MICROBLAZE_COPY = 21
50 MBlazeELFWriterInfo(TargetMachine &TM);
51 virtual ~MBlazeELFWriterInfo();
53 /// getRelocationType - Returns the target specific ELF Relocation type.
54 /// 'MachineRelTy' contains the object code independent relocation type
55 virtual unsigned getRelocationType(unsigned MachineRelTy) const;
57 /// hasRelocationAddend - True if the target uses an addend in the
58 /// ELF relocation entry.
59 virtual bool hasRelocationAddend() const { return false; }
61 /// getDefaultAddendForRelTy - Gets the default addend value for a
62 /// relocation entry based on the target ELF relocation type.
63 virtual long int getDefaultAddendForRelTy(unsigned RelTy,
64 long int Modifier = 0) const;
66 /// getRelTySize - Returns the size of relocatable field in bits
67 virtual unsigned getRelocationTySize(unsigned RelTy) const;
69 /// isPCRelativeRel - True if the relocation type is pc relative
70 virtual bool isPCRelativeRel(unsigned RelTy) const;
72 /// getJumpTableRelocationTy - Returns the machine relocation type used
73 /// to reference a jumptable.
74 virtual unsigned getAbsoluteLabelMachineRelTy() const;
76 /// computeRelocation - Some relocatable fields could be relocated
77 /// directly, avoiding the relocation symbol emission, compute the
78 /// final relocation value for this symbol.
79 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset,
80 unsigned RelTy) const;
83 } // end llvm namespace
85 #endif // MBLAZE_ELF_WRITER_INFO_H