[llvm] 5c6f8f7 - [llvm-readobj] - Add a test for --dyn-symbols when there are no dynamic symbols.

Georgii Rymar via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 01:35:35 PST 2020


Author: Georgii Rymar
Date: 2020-01-27T12:34:58+03:00
New Revision: 5c6f8f73ff8117b328d9a7f29d249e38441db8f0

URL: https://github.com/llvm/llvm-project/commit/5c6f8f73ff8117b328d9a7f29d249e38441db8f0
DIFF: https://github.com/llvm/llvm-project/commit/5c6f8f73ff8117b328d9a7f29d249e38441db8f0.diff

LOG: [llvm-readobj] - Add a test for --dyn-symbols when there are no dynamic symbols.

It removes the Object/readobj-absent.test test and creates a one more case in
dyn-symbols.test we have.

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

Added: 
    

Modified: 
    llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test

Removed: 
    llvm/test/Object/readobj-absent.test


################################################################################
diff  --git a/llvm/test/Object/readobj-absent.test b/llvm/test/Object/readobj-absent.test
deleted file mode 100644
index 119ef82b27f5..000000000000
--- a/llvm/test/Object/readobj-absent.test
+++ /dev/null
@@ -1,10 +0,0 @@
-## Don't crash if required information is absent
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-readobj --dyn-syms %t
-
---- !ELF
-FileHeader:
-  Class:   ELFCLASS32
-  Data:    ELFDATA2LSB
-  Type:    ET_REL
-  Machine: EM_386

diff  --git a/llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test b/llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
index a473e47f30d8..30020cc8d508 100644
--- a/llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
+++ b/llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
@@ -290,3 +290,62 @@ DynamicSymbols:
   - Name: foo
   - Name: bar
   - Name: zed
+
+## Case 8: Check what we print when:
+## a) The dynamic symbol table does not exist.
+# RUN: yaml2obj %s --docnum=7 -o %t7
+# RUN: llvm-readobj --dyn-symbols %t7 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM
+# RUN: llvm-readelf --dyn-symbols %t7 | count 0
+## b) The dynamic symbol table has a size of 0.
+# RUN: yaml2obj %s --docnum=8 -o %t8
+# RUN: llvm-readobj --dyn-symbols %t8 | FileCheck %s --check-prefix=NO-DYNSYM-LLVM
+# RUN: llvm-readelf --dyn-symbols %t8 | count 0
+## c) The dynamic symbol table only contains the null symbol.
+# RUN: yaml2obj %s --docnum=9 -o %t9
+# RUN: llvm-readobj --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-LLVM
+# RUN: llvm-readelf --dyn-symbols %t9 | FileCheck %s --check-prefix=DYNSYM-EMPTY-GNU
+
+# NO-DYNSYM-LLVM:      DynamicSymbols [
+# NO-DYNSYM-LLVM-NEXT: ]
+
+# DYNSYM-EMPTY-LLVM:      DynamicSymbols [
+# DYNSYM-EMPTY-LLVM-NEXT:  Symbol {
+# DYNSYM-EMPTY-LLVM-NEXT:  Name: (0)
+# DYNSYM-EMPTY-LLVM-NEXT:  Value: 0x0
+# DYNSYM-EMPTY-LLVM-NEXT:  Size: 0
+# DYNSYM-EMPTY-LLVM-NEXT:  Binding: Local (0x0)
+# DYNSYM-EMPTY-LLVM-NEXT:  Type: None (0x0)
+# DYNSYM-EMPTY-LLVM-NEXT:  Other: 0
+# DYNSYM-EMPTY-LLVM-NEXT:  Section: Undefined (0x0)
+# DYNSYM-EMPTY-LLVM-NEXT:  }
+# DYNSYM-EMPTY-LLVM-NEXT: ]
+
+# DYNSYM-EMPTY-GNU:      Symbol table '.dynsym' contains 1 entries:
+# DYNSYM-EMPTY-GNU-NEXT:   Num:    Value  Size Type    Bind   Vis       Ndx Name
+# DYNSYM-EMPTY-GNU-NEXT:     0: 00000000     0 NOTYPE  LOCAL  DEFAULT   UND
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_386
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_386
+Sections:
+  - Name: .dynsym
+    Type: SHT_DYNSYM
+    Size: 0
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_386
+DynamicSymbols: []


        


More information about the llvm-commits mailing list