blob: 51e68b4553ff9a7019976523faf4c021569c5473 [file] [log] [blame]
Rafael Espindolafd9493d2010-09-27 18:31:37 +00001//===-- ARMELFWriterInfo.cpp - ELF Writer Info for the ARM backend --------===//
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 ARM backend.
11//
12//===----------------------------------------------------------------------===//
13
14#include "ARMELFWriterInfo.h"
15#include "ARMRelocations.h"
16#include "llvm/Function.h"
17#include "llvm/Support/ErrorHandling.h"
18#include "llvm/Target/TargetData.h"
19#include "llvm/Target/TargetMachine.h"
Jason W Kim13534672010-11-23 19:40:36 +000020#include "llvm/Support/ELF.h"
Rafael Espindolafd9493d2010-09-27 18:31:37 +000021
22using namespace llvm;
23
24//===----------------------------------------------------------------------===//
25// Implementation of the ARMELFWriterInfo class
26//===----------------------------------------------------------------------===//
27
28ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM)
Rafael Espindola0febc462010-10-03 18:59:45 +000029 : TargetELFWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64,
30 TM.getTargetData()->isLittleEndian()) {
Rafael Espindolafd9493d2010-09-27 18:31:37 +000031}
32
33ARMELFWriterInfo::~ARMELFWriterInfo() {}
34
35unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
Jason W Kim837caa92010-11-18 23:37:15 +000036 switch (MachineRelTy) {
37 case ARM::reloc_arm_absolute:
38 case ARM::reloc_arm_relative:
39 case ARM::reloc_arm_cp_entry:
40 case ARM::reloc_arm_vfp_cp_entry:
41 case ARM::reloc_arm_machine_cp_entry:
42 case ARM::reloc_arm_jt_base:
43 case ARM::reloc_arm_pic_jt:
44 assert(0 && "unsupported ARM relocation type"); break;
45
Jason W Kim13534672010-11-23 19:40:36 +000046 case ARM::reloc_arm_branch: return ELF::R_ARM_CALL; break;
47 case ARM::reloc_arm_movt: return ELF::R_ARM_MOVT_ABS; break;
48 case ARM::reloc_arm_movw: return ELF::R_ARM_MOVW_ABS_NC; break;
Jason W Kim837caa92010-11-18 23:37:15 +000049 default:
50 llvm_unreachable("unknown ARM relocation type"); break;
51 }
Rafael Espindolafd9493d2010-09-27 18:31:37 +000052 return 0;
53}
54
55long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy,
56 long int Modifier) const {
57 assert(0 && "ARMELFWriterInfo::getDefaultAddendForRelTy() not implemented");
58 return 0;
59}
60
61unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const {
62 assert(0 && "ARMELFWriterInfo::getRelocationTySize() not implemented");
63 return 0;
64}
65
66bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const {
67 assert(0 && "ARMELFWriterInfo::isPCRelativeRel() not implemented");
68 return 1;
69}
70
71unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
Eric Christophera99c3e92010-09-28 04:18:29 +000072 assert(0 &&
73 "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");
Rafael Espindolafd9493d2010-09-27 18:31:37 +000074 return 0;
75}
76
77long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset,
78 unsigned RelOffset,
79 unsigned RelTy) const {
Eric Christophera99c3e92010-09-28 04:18:29 +000080 assert(0 &&
81 "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");
Rafael Espindolafd9493d2010-09-27 18:31:37 +000082 return 0;
83}