From e4f02089c09ab6be5b618c08fd72768be0eec023 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Thu, 17 Oct 2019 10:23:48 +0000 Subject: [PATCH] [llvm-readobj] - Refine the LLVM-style output to be consistent. Our LLVM-style output was inconsistent. This patch changes the output in the following way: SHT_GNU_verdef { -> VersionDefinitions [ SHT_GNU_verneed { -> VersionRequirements [ Version symbols [ -> VersionSymbols [ EH_FRAME Header [ -> EHFrameHeader { Differential revision: https://reviews.llvm.org/D68636 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375095 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Object/multiple-sections.yaml | 4 ++-- test/tools/llvm-readobj/all.test | 10 ++++++---- test/tools/llvm-readobj/elf-verneed-flags.yaml | 4 ++-- test/tools/llvm-readobj/elf-versioninfo.test | 10 +++++----- test/tools/llvm-readobj/unwind.test | 4 ++-- test/tools/yaml2obj/verdef-section.yaml | 4 ++-- test/tools/yaml2obj/verneed-section.yaml | 4 ++-- test/tools/yaml2obj/versym-section.yaml | 10 +++++----- tools/llvm-readobj/DwarfCFIEHPrinter.h | 2 +- tools/llvm-readobj/ELFDumper.cpp | 6 +++--- 10 files changed, 30 insertions(+), 28 deletions(-) diff --git a/test/Object/multiple-sections.yaml b/test/Object/multiple-sections.yaml index e416b760fc5..197725595be 100644 --- a/test/Object/multiple-sections.yaml +++ b/test/Object/multiple-sections.yaml @@ -4,8 +4,8 @@ # Test that multiple sections with the same type does not trigger an error. # CHECK: ElfHeader { -# CHECK: SHT_GNU_verdef { -# CHECK: SHT_GNU_verneed { +# CHECK: VersionDefinitions [ +# CHECK: VersionRequirements [ # CHECK: CGProfile [ # CHECK: Addrsig [ diff --git a/test/tools/llvm-readobj/all.test b/test/tools/llvm-readobj/all.test index 6b1a6e9611f..944ad038400 100644 --- a/test/tools/llvm-readobj/all.test +++ b/test/tools/llvm-readobj/all.test @@ -10,10 +10,12 @@ # LLVM-ALL: Sections [ # LLVM-ALL: Relocations [ # LLVM-ALL: Symbols [ +# LLVM-ALL: EHFrameHeader { +# LLVM-ALL: .eh_frame section at offset 0x1128 address 0x0: # LLVM-ALL: ProgramHeaders [ -# LLVM-ALL: Version symbols [ -# LLVM-ALL: SHT_GNU_verdef { -# LLVM-ALL: SHT_GNU_verneed { +# LLVM-ALL: VersionSymbols [ +# LLVM-ALL: VersionDefinitions [ +# LLVM-ALL: VersionRequirements [ # LLVM-ALL: Addrsig [ # LLVM-ALL: Notes [ # LLVM-ALL: StackSizes [ @@ -25,7 +27,7 @@ # GNU-ALL: There are {{.*}} section headers, starting at offset {{.*}}: # GNU-ALL: Relocation section '.rela.data' at offset {{.*}} contains {{.*}} entries: # GNU-ALL: Symbol table '.symtab' contains {{.*}} entries: -# GNU-ALL: EH_FRAME Header [ +# GNU-ALL: EHFrameHeader { # GNU-ALL: .eh_frame section at offset {{.*}} address 0x0: # GNU-ALL: Dynamic section at offset {{.*}} contains {{.*}} entries: # GNU-ALL: Program Headers: diff --git a/test/tools/llvm-readobj/elf-verneed-flags.yaml b/test/tools/llvm-readobj/elf-verneed-flags.yaml index e121e38ec75..eedc7fe7ad7 100644 --- a/test/tools/llvm-readobj/elf-verneed-flags.yaml +++ b/test/tools/llvm-readobj/elf-verneed-flags.yaml @@ -5,7 +5,7 @@ # RUN: llvm-readobj -V %t | FileCheck %s --check-prefix=LLVM-VERDEF # RUN: llvm-readelf -V %t | FileCheck %s --check-prefix=GNU-VERDEF -# LLVM-VERDEF: SHT_GNU_verneed { +# LLVM-VERDEF: VersionRequirements [ # LLVM-VERDEF-NEXT: Dependency { # LLVM-VERDEF-NEXT: Version: 1 # LLVM-VERDEF-NEXT: Count: 6 @@ -49,7 +49,7 @@ # LLVM-VERDEF-NEXT: } # LLVM-VERDEF-NEXT: ] # LLVM-VERDEF-NEXT: } -# LLVM-VERDEF-NEXT: } +# LLVM-VERDEF-NEXT: ] # GNU-VERDEF: Version needs section '.gnu.version_r' contains 1 entries: # GNU-VERDEF-NEXT: Addr: 0000000000000000 Offset: 0x000200 Link: 6 (.dynstr) diff --git a/test/tools/llvm-readobj/elf-versioninfo.test b/test/tools/llvm-readobj/elf-versioninfo.test index a586d2a7c1c..46b43430269 100644 --- a/test/tools/llvm-readobj/elf-versioninfo.test +++ b/test/tools/llvm-readobj/elf-versioninfo.test @@ -77,7 +77,7 @@ DynamicSymbols: Binding: STB_GLOBAL ... -# LLVM: Version symbols [ +# LLVM: VersionSymbols [ # LLVM-NEXT: Symbol { # LLVM-NEXT: Version: 0 # LLVM-NEXT: Name: @@ -103,7 +103,7 @@ DynamicSymbols: # LLVM-NEXT: Name: sym5@v3 # LLVM-NEXT: } # LLVM-NEXT: ] -# LLVM-NEXT: SHT_GNU_verdef { +# LLVM-NEXT: VersionDefinitions [ # LLVM-NEXT: Definition { # LLVM-NEXT: Version: 1 # LLVM-NEXT: Flags: 0x0 @@ -127,8 +127,8 @@ DynamicSymbols: # LLVM-NEXT: Name: VERSION2 # LLVM-NEXT: Predecessor: VERSION1 # LLVM-NEXT: } -# LLVM-NEXT: } -# LLVM-NEXT: SHT_GNU_verneed { +# LLVM-NEXT: ] +# LLVM-NEXT: VersionRequirements [ # LLVM-NEXT: Dependency { # LLVM-NEXT: Version: 1 # LLVM-NEXT: Count: 2 @@ -161,7 +161,7 @@ DynamicSymbols: # LLVM-NEXT: } # LLVM-NEXT: ] # LLVM-NEXT: } -# LLVM-NEXT: } +# LLVM-NEXT: ] # GNU: Version symbols section '.gnu.version' contains 6 entries: # GNU-NEXT: Addr: 0000000000000000 Offset: 0x000040 Link: 7 (.dynsym) diff --git a/test/tools/llvm-readobj/unwind.test b/test/tools/llvm-readobj/unwind.test index 7463b2713e6..a9e34f7a294 100644 --- a/test/tools/llvm-readobj/unwind.test +++ b/test/tools/llvm-readobj/unwind.test @@ -1,7 +1,7 @@ # RUN: yaml2obj %s > %t.exe # RUN: llvm-readobj --unwind %t.exe | FileCheck %s -# CHECK: EH_FRAME Header [ +# CHECK: EHFrameHeader { # CHECK-NEXT: Address: 0x4013c0 # CHECK-NEXT: Offset: 0xbc # CHECK-NEXT: Size: 0x3c @@ -38,7 +38,7 @@ # CHECK-NEXT: address: 0x4014f0 # CHECK-NEXT: } # CHECK-NEXT: } -# CHECK-NEXT:] +# CHECK-NEXT:} # CHECK: .eh_frame section at offset 0xf8 address 0x401400: # CHECK-NEXT: [0x401400] CIE length=20 diff --git a/test/tools/yaml2obj/verdef-section.yaml b/test/tools/yaml2obj/verdef-section.yaml index 582b8019266..f26e7d168e8 100644 --- a/test/tools/yaml2obj/verdef-section.yaml +++ b/test/tools/yaml2obj/verdef-section.yaml @@ -3,7 +3,7 @@ # Check we are able to handle the SHT_GNU_verdef sections. -# CHECK: SHT_GNU_verdef { +# CHECK: VersionDefinitions [ # CHECK-NEXT: Definition { # CHECK-NEXT: Version: 1 # CHECK-NEXT: Flags: Base @@ -26,7 +26,7 @@ # CHECK-NEXT: Name: VERSION_2 # CHECK-NEXT: Predecessor: VERSION_3 # CHECK-NEXT: } -# CHECK-NEXT: } +# CHECK-NEXT: ] --- !ELF FileHeader: diff --git a/test/tools/yaml2obj/verneed-section.yaml b/test/tools/yaml2obj/verneed-section.yaml index 5a7aaa23c67..9d7d722a9c2 100644 --- a/test/tools/yaml2obj/verneed-section.yaml +++ b/test/tools/yaml2obj/verneed-section.yaml @@ -3,7 +3,7 @@ # Check we are able to handle the SHT_GNU_verneed sections. -# CHECK: SHT_GNU_verneed { +# CHECK: VersionRequirements [ # CHECK-NEXT: Dependency { # CHECK-NEXT: Version: 1 # CHECK-NEXT: Count: 2 @@ -36,7 +36,7 @@ # CHECK-NEXT: } # CHECK-NEXT: ] # CHECK-NEXT: } -# CHECK-NEXT: } +# CHECK-NEXT: ] --- !ELF FileHeader: diff --git a/test/tools/yaml2obj/versym-section.yaml b/test/tools/yaml2obj/versym-section.yaml index 384b41708b3..7c7c6513419 100644 --- a/test/tools/yaml2obj/versym-section.yaml +++ b/test/tools/yaml2obj/versym-section.yaml @@ -4,7 +4,7 @@ # RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: llvm-readobj -V %t1 | FileCheck %s -# CHECK: Version symbols [ +# CHECK: VersionSymbols [ # CHECK-NEXT: Symbol { # CHECK-NEXT: Version: 0 # CHECK-NEXT: Name: @@ -18,9 +18,9 @@ # CHECK-NEXT: Name: f2@v2 # CHECK-NEXT: } # CHECK-NEXT: ] -# CHECK-NEXT: SHT_GNU_verdef { -# CHECK-NEXT: } -# CHECK-NEXT: SHT_GNU_verneed { +# CHECK-NEXT: VersionDefinitions [ +# CHECK-NEXT: ] +# CHECK-NEXT: VersionRequirements [ # CHECK-NEXT: Dependency { # CHECK-NEXT: Version: 1 # CHECK-NEXT: Count: 2 @@ -40,7 +40,7 @@ # CHECK-NEXT: } # CHECK-NEXT: ] # CHECK-NEXT: } -# CHECK-NEXT: } +# CHECK-NEXT: ] --- !ELF FileHeader: diff --git a/tools/llvm-readobj/DwarfCFIEHPrinter.h b/tools/llvm-readobj/DwarfCFIEHPrinter.h index 683243f8cd4..0a365d4fe72 100644 --- a/tools/llvm-readobj/DwarfCFIEHPrinter.h +++ b/tools/llvm-readobj/DwarfCFIEHPrinter.h @@ -99,7 +99,7 @@ template void PrinterContext::printEHFrameHdr(uint64_t EHFrameHdrOffset, uint64_t EHFrameHdrAddress, uint64_t EHFrameHdrSize) const { - ListScope L(W, "EH_FRAME Header"); + DictScope L(W, "EHFrameHeader"); W.startLine() << format("Address: 0x%" PRIx64 "\n", EHFrameHdrAddress); W.startLine() << format("Offset: 0x%" PRIx64 "\n", EHFrameHdrOffset); W.startLine() << format("Size: 0x%" PRIx64 "\n", EHFrameHdrSize); diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index a23e2156fdc..7e140933393 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/tools/llvm-readobj/ELFDumper.cpp @@ -5607,7 +5607,7 @@ void LLVMStyle::printProgramHeaders(const ELFO *Obj) { template void LLVMStyle::printVersionSymbolSection(const ELFFile *Obj, const Elf_Shdr *Sec) { - ListScope SS(W, "Version symbols"); + ListScope SS(W, "VersionSymbols"); if (!Sec) return; @@ -5631,7 +5631,7 @@ void LLVMStyle::printVersionSymbolSection(const ELFFile *Obj, template void LLVMStyle::printVersionDefinitionSection(const ELFFile *Obj, const Elf_Shdr *Sec) { - DictScope SD(W, "SHT_GNU_verdef"); + ListScope SD(W, "VersionDefinitions"); if (!Sec) return; @@ -5679,7 +5679,7 @@ void LLVMStyle::printVersionDefinitionSection(const ELFFile *Obj, template void LLVMStyle::printVersionDependencySection(const ELFFile *Obj, const Elf_Shdr *Sec) { - DictScope SD(W, "SHT_GNU_verneed"); + ListScope SD(W, "VersionRequirements"); if (!Sec) return; -- 2.11.4.GIT