2013-04-16 01:51:21 +08:00
|
|
|
//===-- AMDGPUELFObjectWriter.cpp - AMDGPU ELF Writer ----------------------==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "AMDGPUMCTargetDesc.h"
|
|
|
|
#include "llvm/MC/MCELFObjectWriter.h"
|
2014-07-21 22:01:14 +08:00
|
|
|
#include "llvm/MC/MCFixup.h"
|
2013-04-16 01:51:21 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class AMDGPUELFObjectWriter : public MCELFObjectTargetWriter {
|
|
|
|
public:
|
2015-06-23 05:03:54 +08:00
|
|
|
AMDGPUELFObjectWriter(bool Is64Bit);
|
2013-04-16 01:51:21 +08:00
|
|
|
protected:
|
2014-03-28 04:41:17 +08:00
|
|
|
unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
2014-03-28 04:49:35 +08:00
|
|
|
bool IsPCRel) const override {
|
2014-07-21 22:01:14 +08:00
|
|
|
return Fixup.getKind();
|
2013-04-16 01:51:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End anonymous namespace
|
|
|
|
|
2015-06-23 05:03:54 +08:00
|
|
|
AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit)
|
2015-06-27 05:15:11 +08:00
|
|
|
: MCELFObjectTargetWriter(Is64Bit, ELF::ELFOSABI_AMDGPU_HSA,
|
|
|
|
ELF::EM_AMDGPU, false) { }
|
2013-04-16 01:51:21 +08:00
|
|
|
|
2015-06-23 05:03:54 +08:00
|
|
|
MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit, raw_pwrite_stream &OS) {
|
|
|
|
MCELFObjectTargetWriter *MOTW = new AMDGPUELFObjectWriter(Is64Bit);
|
2013-04-16 01:51:21 +08:00
|
|
|
return createELFObjectWriter(MOTW, OS, true);
|
|
|
|
}
|