[PATCH] D60192: [yaml2obj] - Check we correctly set the sh_info field of .symtab section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 3 04:01:29 PDT 2019


grimar created this revision.
grimar added a reviewer: jhenderson.

`initSymtabSectionHeader` has the following line:
`SHeader.sh_info = findLocalsNum(Symbols) + 1;`

As was mentioned in a review comments for D60122 <https://reviews.llvm.org/D60122>,
it is never tested. The patch adds a test.


https://reviews.llvm.org/D60192

Files:
  test/tools/yaml2obj/local-symbols.yaml


Index: test/tools/yaml2obj/local-symbols.yaml
===================================================================
--- /dev/null
+++ test/tools/yaml2obj/local-symbols.yaml
@@ -0,0 +1,34 @@
+# Check we correctly set the sh_info field of .symtab section.
+# A symbol table section's sh_info section header member holds
+# the symbol table index for the first non-local symbol.
+
+# RUN: yaml2obj -docnum=1 %s -o %t
+# RUN: llvm-readobj -sections %t | FileCheck %s --check-prefix=ONE
+# ONE: Name: .symtab
+# ONE: Info: 2
+
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_DYN
+  Machine:         EM_X86_64
+Symbols:
+  Local:
+    - Name: foo
+
+# RUN: yaml2obj -docnum=2 %s -o %t
+# RUN: llvm-readobj -sections %t | FileCheck %s --check-prefix=TWO
+# TWO: Name: .symtab
+# TWO: Info: 3
+
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_DYN
+  Machine:         EM_X86_64
+Symbols:
+  Local:
+    - Name: foo
+    - Name: bar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60192.193464.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/84e6b61c/attachment.bin>


More information about the llvm-commits mailing list