blob: 2e6a9f3fa1b7232ef154f2a0f60d987c914be648 [file] [log] [blame]
Wesley Peck4e9141f2010-10-21 03:57:26 +00001//===-- MBlazeELFWriterInfo.h - ELF Writer Info for MBlaze ------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements ELF writer information for the MBlaze backend.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MBLAZE_ELF_WRITER_INFO_H
15#define MBLAZE_ELF_WRITER_INFO_H
16
17#include "llvm/Target/TargetELFWriterInfo.h"
18
19namespace llvm {
20
21 class MBlazeELFWriterInfo : public TargetELFWriterInfo {
22
23 // ELF Relocation types for MBlaze
24 enum MBlazeRelocationType {
25 R_MICROBLAZE_NONE = 0,
26 R_MICROBLAZE_32 = 1,
27 R_MICROBLAZE_32_PCREL = 2,
28 R_MICROBLAZE_64_PCREL = 3,
29 R_MICROBLAZE_32_PCREL_LO = 4,
30 R_MICROBLAZE_64 = 5,
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
47 };
48
49 public:
50 MBlazeELFWriterInfo(TargetMachine &TM);
51 virtual ~MBlazeELFWriterInfo();
52
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;
56
57 /// hasRelocationAddend - True if the target uses an addend in the
58 /// ELF relocation entry.
59 virtual bool hasRelocationAddend() const { return false; }
60
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;
65
66 /// getRelTySize - Returns the size of relocatable field in bits
67 virtual unsigned getRelocationTySize(unsigned RelTy) const;
68
69 /// isPCRelativeRel - True if the relocation type is pc relative
70 virtual bool isPCRelativeRel(unsigned RelTy) const;
71
72 /// getJumpTableRelocationTy - Returns the machine relocation type used
73 /// to reference a jumptable.
74 virtual unsigned getAbsoluteLabelMachineRelTy() const;
75
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;
81 };
82
83} // end llvm namespace
84
85#endif // MBLAZE_ELF_WRITER_INFO_H