Home | History | Annotate | Download | only in MCTargetDesc
      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(bool Is64Bit);
     22 protected:
     23   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 
     33 AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit)
     34   : MCELFObjectTargetWriter(Is64Bit, ELF::ELFOSABI_AMDGPU_HSA,
     35                             ELF::EM_AMDGPU, false) { }
     36 
     37 MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit, raw_pwrite_stream &OS) {
     38   MCELFObjectTargetWriter *MOTW = new AMDGPUELFObjectWriter(Is64Bit);
     39   return createELFObjectWriter(MOTW, OS, true);
     40 }
     41