summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU
diff options
context:
space:
mode:
authorTim Renouf <tpr.llvm@botech.co.uk>2019-03-20 22:02:09 +0000
committerTim Renouf <tpr.llvm@botech.co.uk>2019-03-20 22:02:09 +0000
commit2327c231d6628823b57b36d0ce8c09de8a1dec5f (patch)
tree47cf87203c99173b31774b10b68eb7cc4fee8fbe /llvm/lib/Target/AMDGPU
parent03dbfc2eefdbac5e3bc464b279e751c4f39b28f2 (diff)
downloadbcm5719-llvm-2327c231d6628823b57b36d0ce8c09de8a1dec5f.tar.gz
bcm5719-llvm-2327c231d6628823b57b36d0ce8c09de8a1dec5f.zip
[AMDGPU] Do not generate spurious PAL metadata
My previous fix rL356591 "[AMDGPU] Added MsgPack format PAL metadata" accidentally caused a spurious PAL metadata .note record to be emitted for any AMDGPU output. That caused failures in the lld test amdgpu-relocs.s. Fixed. Differential Revision: https://reviews.llvm.org/D59613 Change-Id: Ie04a2aaae890dcd490f22c89edf9913a77ce070e llvm-svn: 356621
Diffstat (limited to 'llvm/lib/Target/AMDGPU')
-rw-r--r--llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp12
-rw-r--r--llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
index abd1c3e69cb..694f7c6dc75 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
@@ -518,6 +518,8 @@ static const char *getRegisterName(unsigned RegNum) {
// 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)
@@ -564,11 +566,12 @@ void AMDGPUPALMetadata::toString(std::string &String) {
}
// 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);
}
@@ -678,9 +681,10 @@ const char *AMDGPUPALMetadata::getVendor() const {
// 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.
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
index e676c28da7b..dbef2cc605d 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
@@ -92,8 +92,8 @@ public:
// 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.
OpenPOWER on IntegriCloud