1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

[llvm-readobj] Print empty line between note sections in GNU mode

This matches GNU binutils.

Reviewed By: rupprecht, jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D96010
This commit is contained in:
Alex Richardson 2021-02-09 16:19:55 +00:00
parent 7e84b293f2
commit 6da083491b
8 changed files with 38 additions and 20 deletions

View File

@ -8,10 +8,11 @@
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
// GNU-NEXT: HSA Metadata:
// GNU-NEXT: {{^ +$}}
// GNU-NEXT: {{^ $}}
// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_ISA (ISA Version)
// GNU-NEXT: ISA Version:
// GNU-NEXT: {{^ +$}}
// GNU-NEXT: {{^ $}}
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.desc
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: AMD 0x0000000a NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
@ -20,9 +21,11 @@
// GNU-NEXT: AMD 0x00000009 NT_AMD_AMDGPU_ISA (ISA Version)
// GNU-NEXT: ISA Version:
// GNU-NEXT: isa_blah
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.other
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: AMD 0x00000000 NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
// GNU-EMPTY:
// LLVM: Notes [
// LLVM-NEXT: NoteSection {

View File

@ -20,6 +20,7 @@
# GNU-NEXT: .vgpr_count: 7
# GNU-NEXT: .wavefront_size: 5
# GNU-NEXT: ...
# GNU-EMPTY:
# LLVM: Notes [
# LLVM-NEXT: NoteSection {

View File

@ -60,7 +60,7 @@ ProgramHeaders:
# GNU-NEXT: /path/to/libc.so
# GNU-NEXT: 0x0000000000007000 0x0000000000008000 0x0000000000009000
# GNU-NEXT: [stack]
# GNU-NOT: {{.}}
# GNU-EMPTY:
# LLVM: Notes [
# LLVM-NEXT: NoteSection {

View File

@ -252,6 +252,7 @@
# CHECK-GNU: Owner Data size Description
# CHECK-GNU-NEXT: CORE 0x00000000 [[DESC]]
# CHECK-GNU-EMPTY:
# CHECK-LLVM: Note {
# CHECK-LLVM-NEXT: Owner: CORE

View File

@ -8,13 +8,16 @@
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: FreeBSD 0x00000000 NT_THRMISC (thrmisc structure)
// GNU-NEXT: FreeBSD 0x00000000 NT_PROCSTAT_PROC (proc data)
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.bar
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: FreeBSD 0x00000000 NT_PROCSTAT_FILES (files data)
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.baz
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: FreeBSD 0x0000001c Unknown note type: (0x00000003)
// GNU-NEXT: description data: 4c 6f 72 65 6d 20 69 70 73 75 6d 20 64 6f 6c 6f 72 20 73 69 74 20 61 6d 65 74 00 00
// GNU-EMPTY:
// LLVM: Notes [
// LLVM-NEXT: NoteSection {

View File

@ -1,24 +1,24 @@
// REQUIRES: x86-registered-target
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o
// RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM
// RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU
// RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM --strict-whitespace
// RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU --strict-whitespace
// GNU: Displaying notes found in: .note.version
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 NT_VERSION (version)
// GNU: Displaying notes found in: .note.arch
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 NT_ARCH (architecture)
// GNU: Displaying notes found in: .note.open
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 OPEN
// GNU: Displaying notes found in: .note.func
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 func
// GNU: Displaying notes found in: .note.version{{$}}
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 NT_VERSION (version)
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.arch{{$}}
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 NT_ARCH (architecture)
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.open{{$}}
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 OPEN
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.func{{$}}
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 func
// LLVM: Notes [
// LLVM-NEXT: NoteSection {

View File

@ -7,10 +7,12 @@
// GNU: Displaying notes found in: .note.foo
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x00000000 Unknown note type: (0x00000003)
// GNU-EMPTY:
// GNU-NEXT: Displaying notes found in: .note.bar
// GNU-NEXT: Owner Data size Description
// GNU-NEXT: XYZ 0x0000001c Unknown note type: (0x00000003)
// GNU-NEXT: description data: 4c 6f 72 65 6d 20 69 70 73 75 6d 20 64 6f 6c 6f 72 20 73 69 74 20 61 6d 65 74 00 00
// GNU-EMPTY:
// LLVM: Notes [
// LLVM-NEXT: NoteSection {

View File

@ -5232,9 +5232,17 @@ static void printNotesHelper(
}
template <class ELFT> void GNUELFDumper<ELFT>::printNotes() {
bool IsFirstHeader = true;
auto PrintHeader = [&](Optional<StringRef> SecName,
const typename ELFT::Off Offset,
const typename ELFT::Addr Size) {
// Print a newline between notes sections to match GNU readelf.
if (!IsFirstHeader) {
OS << '\n';
} else {
IsFirstHeader = false;
}
OS << "Displaying notes found ";
if (SecName)