1 //===-- MCELFObjectTargetWriter.cpp - ELF Target Writer Subclass ----------===//
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 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/MC/MCELFObjectWriter.h"
12
13 using namespace llvm;
14
MCELFObjectTargetWriter(bool Is64Bit_,uint8_t OSABI_,uint16_t EMachine_,bool HasRelocationAddend_)15 MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_,
16 uint8_t OSABI_,
17 uint16_t EMachine_,
18 bool HasRelocationAddend_)
19 : OSABI(OSABI_), EMachine(EMachine_),
20 HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {
21 }
22
23 /// Default e_flags = 0
getEFlags() const24 unsigned MCELFObjectTargetWriter::getEFlags() const {
25 return 0;
26 }
27
ExplicitRelSym(const MCAssembler & Asm,const MCValue & Target,const MCFragment & F,const MCFixup & Fixup,bool IsPCRel) const28 const MCSymbol *MCELFObjectTargetWriter::ExplicitRelSym(const MCAssembler &Asm,
29 const MCValue &Target,
30 const MCFragment &F,
31 const MCFixup &Fixup,
32 bool IsPCRel) const {
33 return NULL;
34 }
35
36
adjustFixupOffset(const MCFixup & Fixup,uint64_t & RelocOffset)37 void MCELFObjectTargetWriter::adjustFixupOffset(const MCFixup &Fixup,
38 uint64_t &RelocOffset) {
39 }
40
41 void
sortRelocs(const MCAssembler & Asm,std::vector<ELFRelocationEntry> & Relocs)42 MCELFObjectTargetWriter::sortRelocs(const MCAssembler &Asm,
43 std::vector<ELFRelocationEntry> &Relocs) {
44 // Sort by the r_offset, just like gnu as does.
45 array_pod_sort(Relocs.begin(), Relocs.end());
46 }
47