2010-09-27 18:31:37 +00:00
|
|
|
//===-- ARMELFWriterInfo.cpp - ELF Writer Info for the ARM backend --------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements ELF writer information for the ARM backend.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ARMELFWriterInfo.h"
|
|
|
|
#include "ARMRelocations.h"
|
|
|
|
#include "llvm/Function.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include "llvm/Target/TargetData.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2010-11-23 19:40:36 +00:00
|
|
|
#include "llvm/Support/ELF.h"
|
2010-09-27 18:31:37 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Implementation of the ARMELFWriterInfo class
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM)
|
2010-10-03 18:59:45 +00:00
|
|
|
: TargetELFWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64,
|
|
|
|
TM.getTargetData()->isLittleEndian()) {
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ARMELFWriterInfo::~ARMELFWriterInfo() {}
|
|
|
|
|
|
|
|
unsigned ARMELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
|
2010-11-18 23:37:15 +00:00
|
|
|
switch (MachineRelTy) {
|
|
|
|
case ARM::reloc_arm_absolute:
|
|
|
|
case ARM::reloc_arm_relative:
|
|
|
|
case ARM::reloc_arm_cp_entry:
|
|
|
|
case ARM::reloc_arm_vfp_cp_entry:
|
|
|
|
case ARM::reloc_arm_machine_cp_entry:
|
|
|
|
case ARM::reloc_arm_jt_base:
|
|
|
|
case ARM::reloc_arm_pic_jt:
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("unsupported ARM relocation type");
|
|
|
|
|
2012-01-20 21:51:11 +00:00
|
|
|
case ARM::reloc_arm_branch: return ELF::R_ARM_CALL;
|
|
|
|
case ARM::reloc_arm_movt: return ELF::R_ARM_MOVT_ABS;
|
|
|
|
case ARM::reloc_arm_movw: return ELF::R_ARM_MOVW_ABS_NC;
|
2010-11-18 23:37:15 +00:00
|
|
|
default:
|
2012-01-20 21:51:11 +00:00
|
|
|
llvm_unreachable("unknown ARM relocation type");
|
2010-11-18 23:37:15 +00:00
|
|
|
}
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long int ARMELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy,
|
|
|
|
long int Modifier) const {
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("ARMELFWriterInfo::getDefaultAddendForRelTy() not "
|
|
|
|
"implemented");
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned ARMELFWriterInfo::getRelocationTySize(unsigned RelTy) const {
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("ARMELFWriterInfo::getRelocationTySize() not implemented");
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ARMELFWriterInfo::isPCRelativeRel(unsigned RelTy) const {
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("ARMELFWriterInfo::isPCRelativeRel() not implemented");
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not "
|
|
|
|
"implemented");
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long int ARMELFWriterInfo::computeRelocation(unsigned SymOffset,
|
|
|
|
unsigned RelOffset,
|
|
|
|
unsigned RelTy) const {
|
2012-02-07 02:50:20 +00:00
|
|
|
llvm_unreachable("ARMELFWriterInfo::getAbsoluteLabelMachineRelTy() not "
|
|
|
|
"implemented");
|
2010-09-27 18:31:37 +00:00
|
|
|
}
|