; OSABI-PAL-NOT: .amd_amdgpu_hsa_metadata
; OSABI-PAL: .amd_amdgpu_pal_metadata
+; RUN: llc -mtriple=amdgcn-amd-unknown -mcpu=gfx800 -mattr=+code-object-v3 -filetype=obj < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=GCN --check-prefix=OSABI-UNK-ELF --check-prefix=GFX800 %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -mattr=+code-object-v3 -filetype=obj < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=GCN --check-prefix=OSABI-HSA-ELF --check-prefix=GFX800 %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx800 -mattr=+code-object-v3 -filetype=obj < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=GCN --check-prefix=OSABI-PAL-ELF --check-prefix=GFX800 %s
+
; R600-NOT: .hsa_code_object_version
; R600-NOT: .hsa_code_object_isa
; R600-NOT: .amd_amdgpu_isa
define amdgpu_kernel void @elf_notes() {
ret void
}
+
+; OSABI-UNK-ELF-NOT: Unknown note type
+; OSABI-UNK-ELF: NT_AMD_AMDGPU_ISA (ISA Version)
+; OSABI-UNK-ELF-NOT: Unknown note type
+; OSABI-UNK-ELF-NOT: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; OSABI-UNK-ELF-NOT: Unknown note type
+; OSABI-UNK-ELF-NOT: NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
+; OSABI-UNK-ELF-NOT: Unknown note type
+
+; OSABI-HSA-ELF-NOT: Unknown note type
+; OSABI-HSA-ELF: NT_AMD_AMDGPU_ISA (ISA Version)
+; OSABI-HSA-ELF-NOT: Unknown note type
+; OSABI-HSA-ELF: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; OSABI-HSA-ELF-NOT: Unknown note type
+; OSABI-HSA-ELF-NOT: NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
+; OSABI-HSA-ELF-NOT: Unknown note type
+
+; OSABI-PAL-ELF-NOT: Unknown note type
+; OSABI-PAL-ELF: NT_AMD_AMDGPU_ISA (ISA Version)
+; OSABI-PAL-ELF-NOT: Unknown note type
+; OSABI-PAL-ELF-NOT: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; OSABI-PAL-ELF-NOT: Unknown note type
+; OSABI-PAL-ELF: NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
+; OSABI-PAL-ELF-NOT: Unknown note type
!110 = !{!"__block_literal"}
; NOTES: Displaying notes found at file offset 0x{{[0-9]+}}
-; NOTES-NEXT: Owner Data size Description
-; NOTES-NEXT: AMD 0x00000008 Unknown note type: (0x00000001)
-; NOTES-NEXT: AMD 0x0000001b Unknown note type: (0x00000003)
-; GFX700: AMD 0x00008f64 Unknown note type: (0x0000000a)
-; GFX800: AMD 0x000092e4 Unknown note type: (0x0000000a)
-; GFX900: AMD 0x00008f64 Unknown note type: (0x0000000a)
+; NOTES: Owner Data size Description
+; NOTES: AMD 0x00000008 Unknown note type (0x00000001)
+; NOTES: AMD 0x0000001b Unknown note type (0x00000003)
+; GFX700: AMD 0x00008f64 NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; GFX800: AMD 0x000092e4 NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; GFX900: AMD 0x00008f64 NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
; PARSER: AMDGPU HSA Metadata Parser Test: PASS
std::string string;
raw_string_ostream OS(string);
OS << format("Unknown note type (0x%08x)", NT);
- return string;
+ return OS.str();
}
static std::string getFreeBSDNoteTypeName(const uint32_t NT) {
std::string string;
raw_string_ostream OS(string);
OS << format("Unknown note type (0x%08x)", NT);
- return string;
+ return OS.str();
+}
+
+static std::string getAMDGPUNoteTypeName(const uint32_t NT) {
+ static const struct {
+ uint32_t ID;
+ const char *Name;
+ } Notes[] = {
+ {ELF::NT_AMD_AMDGPU_HSA_METADATA,
+ "NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)"},
+ {ELF::NT_AMD_AMDGPU_ISA,
+ "NT_AMD_AMDGPU_ISA (ISA Version)"},
+ {ELF::NT_AMD_AMDGPU_PAL_METADATA,
+ "NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)"}
+ };
+
+ for (const auto &Note : Notes)
+ if (Note.ID == NT)
+ return std::string(Note.Name);
+
+ std::string string;
+ raw_string_ostream OS(string);
+ OS << format("Unknown note type (0x%08x)", NT);
+ return OS.str();
}
template <typename ELFT>
printGNUNote<ELFT>(OS, Type, Descriptor, DescriptorSize);
} else if (Name == "FreeBSD") {
OS << getFreeBSDNoteTypeName(Type) << '\n';
+ } else if (Name == "AMD") {
+ OS << getAMDGPUNoteTypeName(Type) << '\n';
} else {
OS << "Unknown note type: (" << format_hex(Type, 10) << ')';
}