// Convert the accumulated PAL metadata into an asm directive.
void AMDGPUPALMetadata::toString(std::string &String) {
String.clear();
+ if (!BlobType)
+ return;
raw_string_ostream Stream(String);
if (isLegacy()) {
if (MsgPackDoc.getRoot().getKind() == msgpack::Type::Nil)
}
// Convert the accumulated PAL metadata into a binary blob for writing as
-// a .note record of the specified AMD type.
+// a .note record of the specified AMD type. Returns an empty blob if
+// there is no PAL metadata,
void AMDGPUPALMetadata::toBlob(unsigned Type, std::string &Blob) {
if (Type == ELF::NT_AMD_AMDGPU_PAL_METADATA)
toLegacyBlob(Blob);
- else
+ else if (Type)
toMsgPackBlob(Blob);
}
// Get .note record type of metadata blob to be emitted:
// ELF::NT_AMD_AMDGPU_PAL_METADATA (legacy key=val format), or
-// ELF::NT_AMDGPU_METADATA (MsgPack format).
+// ELF::NT_AMDGPU_METADATA (MsgPack format), or
+// 0 (no PAL metadata).
unsigned AMDGPUPALMetadata::getType() const {
- return BlobType ? BlobType : unsigned(ELF::NT_AMDGPU_METADATA);
+ return BlobType;
}
// Return whether the blob type is legacy PAL metadata.
// Get .note record type of metadata blob to be emitted:
// ELF::NT_AMD_AMDGPU_PAL_METADATA (legacy key=val format), or
- // ELF::NT_AMD_AMDGPU_PAL_METADATA_MSGPACK or ELF::NT_AMDGPU_METADATA
- // (MsgPack format).
+ // ELF::NT_AMDGPU_METADATA (MsgPack format), or
+ // 0 (no PAL metadata).
unsigned getType() const;
// Emit the accumulated PAL metadata as a binary blob.
--- /dev/null
+# RUN: llvm-mc -triple=amdgcn--amdhsa -mcpu=fiji %s | FileCheck %s --check-prefix=ASM
+# RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa -mcpu=fiji %s -o %t.o
+# RUN: llvm-objdump -s %t.o | FileCheck %s --check-prefix=OBJDUMP
+
+# Check that we don't get spurious PAL metadata.
+
+# ASM-NOT: pal_metadata
+# OBJDUMP-NOT: section .note