1 //===-- AMDGPUELFObjectWriter.cpp - AMDGPU ELF Writer ----------------------==//
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 /// \file
9 //===----------------------------------------------------------------------===//
10 
11 #include "AMDGPUMCTargetDesc.h"
12 #include "llvm/MC/MCELFObjectWriter.h"
13 #include "llvm/MC/MCFixup.h"
14 
15 using namespace llvm;
16 
17 namespace {
18 
19 class AMDGPUELFObjectWriter : public MCELFObjectTargetWriter {
20 public:
21   AMDGPUELFObjectWriter();
22 protected:
GetRelocType(const MCValue & Target,const MCFixup & Fixup,bool IsPCRel) const23   unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
24                         bool IsPCRel) const override {
25     return Fixup.getKind();
26   }
27 
28 };
29 
30 
31 } // End anonymous namespace
32 
AMDGPUELFObjectWriter()33 AMDGPUELFObjectWriter::AMDGPUELFObjectWriter()
34   : MCELFObjectTargetWriter(false, 0, 0, false) { }
35 
createAMDGPUELFObjectWriter(raw_pwrite_stream & OS)36 MCObjectWriter *llvm::createAMDGPUELFObjectWriter(raw_pwrite_stream &OS) {
37   MCELFObjectTargetWriter *MOTW = new AMDGPUELFObjectWriter();
38   return createELFObjectWriter(MOTW, OS, true);
39 }
40