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:
|
2016-06-15 04:29:59 +08:00
|
|
|
AMDGPUELFObjectWriter(bool Is64Bit, bool HasRelocationAddend);
|
2013-04-16 01:51:21 +08:00
|
|
|
protected:
|
2016-01-14 06:56:57 +08:00
|
|
|
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
|
|
|
|
const MCFixup &Fixup, bool IsPCRel) const override {
|
2014-07-21 22:01:14 +08:00
|
|
|
return Fixup.getKind();
|
2013-04-16 01:51:21 +08:00
|
|
|
}
|
2016-06-14 23:16:35 +08:00
|
|
|
|
2013-04-16 01:51:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End anonymous namespace
|
|
|
|
|
2016-06-15 04:29:59 +08:00
|
|
|
AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(bool Is64Bit,
|
|
|
|
bool HasRelocationAddend)
|
|
|
|
: MCELFObjectTargetWriter(Is64Bit,
|
|
|
|
ELF::ELFOSABI_AMDGPU_HSA,
|
|
|
|
ELF::EM_AMDGPU,
|
|
|
|
HasRelocationAddend) { }
|
2013-04-16 01:51:21 +08:00
|
|
|
|
2016-06-15 04:29:59 +08:00
|
|
|
|
|
|
|
MCObjectWriter *llvm::createAMDGPUELFObjectWriter(bool Is64Bit,
|
|
|
|
bool HasRelocationAddend,
|
|
|
|
raw_pwrite_stream &OS) {
|
|
|
|
MCELFObjectTargetWriter *MOTW =
|
|
|
|
new AMDGPUELFObjectWriter(Is64Bit, HasRelocationAddend);
|
2013-04-16 01:51:21 +08:00
|
|
|
return createELFObjectWriter(MOTW, OS, true);
|
|
|
|
}
|