[lld] 3b35603 - [llvm-readobj] - Always print "Predecessors" for version definition sections.

Georgii Rymar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 01:31:16 PST 2019


Author: Georgii Rymar
Date: 2019-11-27T12:29:55+03:00
New Revision: 3b35603a56b2dcc7fb0480d8d4c4aeacacecf1fb

URL: https://github.com/llvm/llvm-project/commit/3b35603a56b2dcc7fb0480d8d4c4aeacacecf1fb
DIFF: https://github.com/llvm/llvm-project/commit/3b35603a56b2dcc7fb0480d8d4c4aeacacecf1fb.diff

LOG: [llvm-readobj] - Always print "Predecessors" for version definition sections.

This is a follow-up discussed in D70495 thread.

The current logic is unusual for llvm-readobj. It doesn't print predecessors
list when it is empty. This is not good for machine parsers.
D70495 had to add this condition during refactoring to reduce amount of changes,
in tests, because the original code also had a similar logic.

Now seems it is time to get rid of it. This patch does it.

Differential revision: https://reviews.llvm.org/D70717

Added: 
    

Modified: 
    lld/test/ELF/verdef-defaultver.s
    lld/test/ELF/verdef-dependency.s
    lld/test/ELF/verdef.s
    llvm/test/tools/llvm-readobj/elf-versioninfo.test
    llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
    llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/verdef-defaultver.s b/lld/test/ELF/verdef-defaultver.s
index 3c10f2dcfe26..7d2a0d27fa11 100644
--- a/lld/test/ELF/verdef-defaultver.s
+++ b/lld/test/ELF/verdef-defaultver.s
@@ -84,6 +84,7 @@
 # DSO-NEXT:      Index: 1
 # DSO-NEXT:      Hash: 127830196
 # DSO-NEXT:      Name: shared
+# DSO-NEXT:      Predecessors: []
 # DSO-NEXT:    }
 # DSO-NEXT:    Definition {
 # DSO-NEXT:      Version: 1
@@ -92,6 +93,7 @@
 # DSO-NEXT:      Index: 2
 # DSO-NEXT:      Hash: 1425
 # DSO-NEXT:      Name: V1
+# DSO-NEXT:      Predecessors: []
 # DSO-NEXT:    }
 # DSO-NEXT:    Definition {
 # DSO-NEXT:      Version: 1
@@ -100,6 +102,7 @@
 # DSO-NEXT:      Index: 3
 # DSO-NEXT:      Hash: 1426
 # DSO-NEXT:      Name: V2
+# DSO-NEXT:      Predecessors: []
 # DSO-NEXT:    }
 # DSO-NEXT:  ]
 

diff  --git a/lld/test/ELF/verdef-dependency.s b/lld/test/ELF/verdef-dependency.s
index 479f332d4930..d71643620253 100644
--- a/lld/test/ELF/verdef-dependency.s
+++ b/lld/test/ELF/verdef-dependency.s
@@ -15,6 +15,7 @@
 # DSO-NEXT:     Index: 1
 # DSO-NEXT:     Hash: 127830196
 # DSO-NEXT:     Name: shared
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -23,6 +24,7 @@
 # DSO-NEXT:     Index: 2
 # DSO-NEXT:     Hash: 98457184
 # DSO-NEXT:     Name: LIBSAMPLE_1.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -31,6 +33,7 @@
 # DSO-NEXT:     Index: 3
 # DSO-NEXT:     Hash: 98456416
 # DSO-NEXT:     Name: LIBSAMPLE_2.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -39,5 +42,6 @@
 # DSO-NEXT:     Index: 4
 # DSO-NEXT:     Hash: 98456672
 # DSO-NEXT:     Name: LIBSAMPLE_3.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT: ]

diff  --git a/lld/test/ELF/verdef.s b/lld/test/ELF/verdef.s
index d2aa924782f8..dd1f1d41f014 100644
--- a/lld/test/ELF/verdef.s
+++ b/lld/test/ELF/verdef.s
@@ -33,6 +33,7 @@
 # DSO-NEXT:     Index: 1
 # DSO-NEXT:     Hash: 127830196
 # DSO-NEXT:     Name: shared
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -41,6 +42,7 @@
 # DSO-NEXT:     Index: 2
 # DSO-NEXT:     Hash: 98457184
 # DSO-NEXT:     Name: LIBSAMPLE_1.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -49,6 +51,7 @@
 # DSO-NEXT:     Index: 3
 # DSO-NEXT:     Hash: 98456416
 # DSO-NEXT:     Name: LIBSAMPLE_2.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT:   Definition {
 # DSO-NEXT:     Version: 1
@@ -57,6 +60,7 @@
 # DSO-NEXT:     Index: 4
 # DSO-NEXT:     Hash: 98456672
 # DSO-NEXT:     Name: LIBSAMPLE_3.0
+# DSO-NEXT:     Predecessors: []
 # DSO-NEXT:   }
 # DSO-NEXT: ]
 # DSO-NEXT: VersionRequirements [

diff  --git a/llvm/test/tools/llvm-readobj/elf-versioninfo.test b/llvm/test/tools/llvm-readobj/elf-versioninfo.test
index c732f7d2a2b6..591dfe27a1a8 100644
--- a/llvm/test/tools/llvm-readobj/elf-versioninfo.test
+++ b/llvm/test/tools/llvm-readobj/elf-versioninfo.test
@@ -148,6 +148,7 @@ DynamicSymbols:
 # LLVM-NEXT:     Index: 0
 # LLVM-NEXT:     Hash: 0
 # LLVM-NEXT:     Name: VERSION1
+# LLVM-NEXT:     Predecessors: []
 # LLVM-NEXT:   }
 # LLVM-NEXT:   Definition {
 # LLVM-NEXT:     Version: 1
@@ -157,6 +158,7 @@ DynamicSymbols:
 # LLVM-NEXT:     Index: 0
 # LLVM-NEXT:     Hash: 0
 # LLVM-NEXT:     Name: VERSION1
+# LLVM-NEXT:     Predecessors: []
 # LLVM-NEXT:   }
 # LLVM-NEXT:   Definition {
 # LLVM-NEXT:     Version: 1
@@ -166,6 +168,7 @@ DynamicSymbols:
 # LLVM-NEXT:     Index: 0
 # LLVM-NEXT:     Hash: 0
 # LLVM-NEXT:     Name: VERSION1
+# LLVM-NEXT:     Predecessors: []
 # LLVM-NEXT:   }
 # LLVM-NEXT:   Definition {
 # LLVM-NEXT:     Version: 1
@@ -175,6 +178,7 @@ DynamicSymbols:
 # LLVM-NEXT:     Index: 0
 # LLVM-NEXT:     Hash: 0
 # LLVM-NEXT:     Name: VERSION1
+# LLVM-NEXT:     Predecessors: []
 # LLVM-NEXT:   }
 # LLVM-NEXT:   Definition {
 # LLVM-NEXT:     Version: 1
@@ -186,6 +190,7 @@ DynamicSymbols:
 # LLVM-NEXT:     Index: 2
 # LLVM-NEXT:     Hash: 175630257
 # LLVM-NEXT:     Name: VERSION1
+# LLVM-NEXT:     Predecessors: []
 # LLVM-NEXT:   }
 # LLVM-NEXT:   Definition {
 # LLVM-NEXT:     Version: 1
@@ -436,6 +441,7 @@ DynamicSymbols:
 # PAST-STRTAB-END-LLVM-NEXT:     Index: 0
 # PAST-STRTAB-END-LLVM-NEXT:     Hash: 0
 # PAST-STRTAB-END-LLVM-NEXT:     Name: <invalid vda_name: 5>
+# PAST-STRTAB-END-LLVM-NEXT:     Predecessors: []
 # PAST-STRTAB-END-LLVM-NEXT:   }
 # PAST-STRTAB-END-LLVM-NEXT: ]
 

diff  --git a/llvm/test/tools/yaml2obj/ELF/verdef-section.yaml b/llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
index 960acbdb7404..23bbc8ee791c 100644
--- a/llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
@@ -12,6 +12,7 @@
 # CHECK-NEXT:     Index: 1
 # CHECK-NEXT:     Hash: 170240160
 # CHECK-NEXT:     Name: dso.so.0
+# CHECK-NEXT:     Predecessors: []
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Definition {
 # CHECK-NEXT:     Version: 1
@@ -21,6 +22,7 @@
 # CHECK-NEXT:     Index: 2
 # CHECK-NEXT:     Hash: 108387921
 # CHECK-NEXT:     Name: VERSION_1
+# CHECK-NEXT:     Predecessors: []
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Definition {
 # CHECK-NEXT:     Version: 1

diff  --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 5127939f0180..b7bd35e7c95c 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -5826,9 +5826,6 @@ void LLVMStyle<ELFT>::printVersionDefinitionSection(const ELFFile<ELFT> *Obj,
     W.printNumber("Index", D.Ndx);
     W.printNumber("Hash", D.Hash);
     W.printString("Name", D.Name.c_str());
-
-    if (D.AuxV.empty())
-      continue;
     W.printList(
         "Predecessors", D.AuxV,
         [](raw_ostream &OS, const VerdAux &Aux) { OS << Aux.Name.c_str(); });


        


More information about the llvm-commits mailing list