llvm-readobj: fix next note entry calculation and print unknown note types

Differential Revision: https://reviews.llvm.org/D29131

llvm-svn: 293964
This commit is contained in:
Konstantin Zhuravlyov 2017-02-02 23:44:49 +00:00
parent 6697ec293c
commit 803b141f32
2 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-runtime-metadata | FileCheck %s ; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-runtime-metadata -elf-output-style=GNU -notes | FileCheck %s --check-prefix=NOTES
; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -amdgpu-dump-rtmd -amdgpu-check-rtmd-parser %s -o - 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=PARSER %s ; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -amdgpu-dump-rtmd -amdgpu-check-rtmd-parser %s -o - 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=PARSER %s
%struct.A = type { i8, float } %struct.A = type { i8, float }
@ -341,6 +341,12 @@ define amdgpu_kernel void @test_pointee_align(i64 addrspace(1)* %a, i8 addrspace
; PARSER: AMDGPU runtime metadata parser test passes. ; PARSER: AMDGPU runtime metadata parser test passes.
; 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)
; NOTES-NEXT: AMD 0x00005196 Unknown note type: (0x00000008)
!llvm.printf.fmts = !{!100, !101} !llvm.printf.fmts = !{!100, !101}
!1 = !{i32 0} !1 = !{i32 0}

View File

@ -3416,10 +3416,12 @@ void GNUStyle<ELFT>::printNotes(const ELFFile<ELFT> *Obj) {
if (Name == "GNU") { if (Name == "GNU") {
OS << getGNUNoteTypeName(Type) << '\n'; OS << getGNUNoteTypeName(Type) << '\n';
printGNUNote<ELFT>(OS, Type, Descriptor); printGNUNote<ELFT>(OS, Type, Descriptor);
} else {
OS << "Unknown note type: (" << format_hex(Type, 10) << ')';
} }
OS << '\n'; OS << '\n';
P = P + 3 * sizeof(Elf_Word) * alignTo<4>(NameSize) + P = P + 3 * sizeof(Elf_Word) + alignTo<4>(NameSize) +
alignTo<4>(DescriptorSize); alignTo<4>(DescriptorSize);
} }
}; };