• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_,bool IsN64_)15 MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_,
16                                                  uint8_t OSABI_,
17                                                  uint16_t EMachine_,
18                                                  bool HasRelocationAddend_,
19                                                  bool IsN64_)
20   : OSABI(OSABI_), EMachine(EMachine_),
21     HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_),
22     IsN64(IsN64_){
23 }
24 
25 /// Default e_flags = 0
getEFlags() const26 unsigned MCELFObjectTargetWriter::getEFlags() const {
27   return 0;
28 }
29 
ExplicitRelSym(const MCAssembler & Asm,const MCValue & Target,const MCFragment & F,const MCFixup & Fixup,bool IsPCRel) const30 const MCSymbol *MCELFObjectTargetWriter::ExplicitRelSym(const MCAssembler &Asm,
31                                                         const MCValue &Target,
32                                                         const MCFragment &F,
33                                                         const MCFixup &Fixup,
34                                                         bool IsPCRel) const {
35   return NULL;
36 }
37 
38 
adjustFixupOffset(const MCFixup & Fixup,uint64_t & RelocOffset)39 void MCELFObjectTargetWriter::adjustFixupOffset(const MCFixup &Fixup,
40                                                 uint64_t &RelocOffset) {
41 }
42 
43 void
sortRelocs(const MCAssembler & Asm,std::vector<ELFRelocationEntry> & Relocs)44 MCELFObjectTargetWriter::sortRelocs(const MCAssembler &Asm,
45                                     std::vector<ELFRelocationEntry> &Relocs) {
46   // Sort by the r_offset, just like gnu as does.
47   array_pod_sort(Relocs.begin(), Relocs.end());
48 }
49