NT_GNU_GOLD_VERSION = 4,
};
+// AMDGPU specific notes.
+enum {
+ // Note types with values between 0 and 9 (inclusive) are reserved.
+ NT_AMD_AMDGPU_HSA_METADATA = 10,
+ NT_AMD_AMDGPU_ISA = 11,
+ NT_AMD_AMDGPU_PAL_METADATA = 12
+};
+
enum {
GNU_ABI_TAG_LINUX = 0,
GNU_ABI_TAG_HURD = 1,
const char NoteName[] = "AMD";
-// TODO: Move this enum to include/llvm/Support so it can be used in tools?
+// TODO: Remove this file once we drop code object v2.
enum NoteType{
NT_AMDGPU_HSA_RESERVED_0 = 0,
NT_AMDGPU_HSA_CODE_OBJECT_VERSION = 1,
NT_AMDGPU_HSA_RESERVED_7 = 7,
NT_AMDGPU_HSA_RESERVED_8 = 8,
NT_AMDGPU_HSA_RESERVED_9 = 9,
- NT_AMDGPU_HSA_CODE_OBJECT_METADATA = 10,
- NT_AMD_AMDGPU_ISA = 11,
- NT_AMDGPU_PAL_METADATA = 12,
NT_AMDGPU_HSA_HLDEBUG_DEBUG = 101,
NT_AMDGPU_HSA_HLDEBUG_TARGET = 102
};
}
void AMDGPUTargetELFStreamer::EmitAMDGPUNote(
- const MCExpr *DescSZ, ElfNote::NoteType Type,
+ const MCExpr *DescSZ, unsigned NoteType,
function_ref<void(MCELFStreamer &)> EmitDesc) {
auto &S = getStreamer();
auto &Context = S.getContext();
ElfNote::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
S.EmitIntValue(NameSZ, 4); // namesz
S.EmitValue(DescSZ, 4); // descz
- S.EmitIntValue(Type, 4); // type
+ S.EmitIntValue(NoteType, 4); // type
S.EmitBytes(StringRef(ElfNote::NoteName, NameSZ)); // name
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
EmitDesc(S); // desc
EmitAMDGPUNote(
DescSZ,
- ElfNote::NT_AMDGPU_HSA_CODE_OBJECT_METADATA,
+ ELF::NT_AMD_AMDGPU_HSA_METADATA,
[&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin);
OS.EmitBytes(HSAMetadataString);
const PALMD::Metadata &PALMetadata) {
EmitAMDGPUNote(
MCConstantExpr::create(PALMetadata.size() * sizeof(uint32_t), getContext()),
- ElfNote::NT_AMDGPU_PAL_METADATA,
+ ELF::NT_AMD_AMDGPU_PAL_METADATA,
[&](MCELFStreamer &OS){
for (auto I : PALMetadata)
OS.EmitIntValue(I, sizeof(uint32_t));
class AMDGPUTargetELFStreamer final : public AMDGPUTargetStreamer {
MCStreamer &Streamer;
- void EmitAMDGPUNote(const MCExpr *DescSize,
- AMDGPU::ElfNote::NoteType Type,
+ void EmitAMDGPUNote(const MCExpr *DescSize, unsigned NoteType,
function_ref<void(MCELFStreamer &)> EmitDesc);
public: