blob: 776727500db31bc1d69e9aa851efcd6450e3288a [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"
20
21using namespace llvm;
22
23//===----------------------------------------------------------------------===//
24// Implementation of the ARMELFWriterInfo class
25//===----------------------------------------------------------------------===//
26
27ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM)
Rafael Espindola0febc462010-10-03 18:59:45 +000028 : TargetELFWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64,
29 TM.getTargetData()->isLittleEndian()) {
Rafael Espindolafd9493d2010-09-27 18:31:37 +000030}
31
32ARMELFWriterInfo::~ARMELFWriterInfo() {}
33
34unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
Jason W Kim837caa92010-11-18 23:37:15 +000035 switch (MachineRelTy) {
36 case ARM::reloc_arm_absolute:
37 case ARM::reloc_arm_relative:
38 case ARM::reloc_arm_cp_entry:
39 case ARM::reloc_arm_vfp_cp_entry:
40 case ARM::reloc_arm_machine_cp_entry:
41 case ARM::reloc_arm_jt_base:
42 case ARM::reloc_arm_pic_jt:
43 assert(0 && "unsupported ARM relocation type"); break;
44
45 case ARM::reloc_arm_branch: return R_ARM_CALL; break;
46 case ARM::reloc_arm_movt: return R_ARM_MOVT_ABS; break;
47 case ARM::reloc_arm_movw: return R_ARM_MOVW_ABS_NC; break;
48 default:
49 llvm_unreachable("unknown ARM relocation type"); break;
50 }
Rafael Espindolafd9493d2010-09-27 18:31:37 +000051 return 0;
52}
53
54long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy,
55 long int Modifier) const {
56 assert(0 && "ARMELFWriterInfo::getDefaultAddendForRelTy() not implemented");
57 return 0;
58}
59
60unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const {
61 assert(0 && "ARMELFWriterInfo::getRelocationTySize() not implemented");
62 return 0;
63}
64
65bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const {
66 assert(0 && "ARMELFWriterInfo::isPCRelativeRel() not implemented");
67 return 1;
68}
69
70unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
Eric Christophera99c3e92010-09-28 04:18:29 +000071 assert(0 &&
72 "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");
Rafael Espindolafd9493d2010-09-27 18:31:37 +000073 return 0;
74}
75
76long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset,
77 unsigned RelOffset,
78 unsigned RelTy) const {
Eric Christophera99c3e92010-09-28 04:18:29 +000079 assert(0 &&
80 "ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not implemented");
Rafael Espindolafd9493d2010-09-27 18:31:37 +000081 return 0;
82}