MCELFObjectTargetWriter.cpp revision 243830
197403Sobrien//===-- MCELFObjectTargetWriter.cpp - ELF Target Writer Subclass ----------===//
297403Sobrien//
3169691Skan//                     The LLVM Compiler Infrastructure
4169691Skan//
597403Sobrien// This file is distributed under the University of Illinois Open Source
697403Sobrien// License. See LICENSE.TXT for details.
797403Sobrien//
897403Sobrien//===----------------------------------------------------------------------===//
997403Sobrien
1097403Sobrien#include "llvm/ADT/STLExtras.h"
1197403Sobrien#include "llvm/MC/MCELFObjectWriter.h"
1297403Sobrien#include "llvm/MC/MCExpr.h"
1397403Sobrien#include "llvm/MC/MCValue.h"
1497403Sobrien
1597403Sobrienusing namespace llvm;
1697403Sobrien
1797403SobrienMCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_,
1897403Sobrien                                                 uint8_t OSABI_,
19169691Skan                                                 uint16_t EMachine_,
2097403Sobrien                                                 bool HasRelocationAddend_,
2197403Sobrien                                                 bool IsN64_)
2297403Sobrien  : OSABI(OSABI_), EMachine(EMachine_),
2397403Sobrien    HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_),
2497403Sobrien    IsN64(IsN64_){
2597403Sobrien}
2697403Sobrien
2797403Sobrien/// Default e_flags = 0
2897403Sobrienunsigned MCELFObjectTargetWriter::getEFlags() const {
2997403Sobrien  return 0;
3097403Sobrien}
3197403Sobrien
3297403Sobrienconst MCSymbol *MCELFObjectTargetWriter::ExplicitRelSym(const MCAssembler &Asm,
3397403Sobrien                                                        const MCValue &Target,
3497403Sobrien                                                        const MCFragment &F,
3597403Sobrien                                                        const MCFixup &Fixup,
3697403Sobrien                                                        bool IsPCRel) const {
37169691Skan  return NULL;
38169691Skan}
3997403Sobrien
4097403Sobrienconst MCSymbol *MCELFObjectTargetWriter::undefinedExplicitRelSym(const MCValue &Target,
41169691Skan                                                                 const MCFixup &Fixup,
42169691Skan                                                                 bool IsPCRel) const {
43169691Skan  const MCSymbol &Symbol = Target.getSymA()->getSymbol();
44169691Skan  return &Symbol.AliasedSymbol();
45132720Skan}
46132720Skan
4797403Sobrienvoid MCELFObjectTargetWriter::adjustFixupOffset(const MCFixup &Fixup,
4897403Sobrien                                                uint64_t &RelocOffset) {
4997403Sobrien}
50169691Skan
5197403Sobrienvoid
5297403SobrienMCELFObjectTargetWriter::sortRelocs(const MCAssembler &Asm,
53169691Skan                                    std::vector<ELFRelocationEntry> &Relocs) {
54169691Skan  // Sort by the r_offset, just like gnu as does.
5597403Sobrien  array_pod_sort(Relocs.begin(), Relocs.end());
5697403Sobrien}
5797403Sobrien