MCELFObjectTargetWriter.cpp revision 234353
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
13using namespace llvm;
14
15MCELFObjectTargetWriter::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
24unsigned MCELFObjectTargetWriter::getEFlags() const {
25  return 0;
26}
27
28const 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
37void MCELFObjectTargetWriter::adjustFixupOffset(const MCFixup &Fixup,
38                                                uint64_t &RelocOffset) {
39}
40
41void
42MCELFObjectTargetWriter::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