[llvm] r357687 - [yaml2obj] - Check we correctly set the sh_info field of .symtab section.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 04:49:54 PDT 2019


Author: grimar
Date: Thu Apr  4 04:49:54 2019
New Revision: 357687

URL: http://llvm.org/viewvc/llvm-project?rev=357687&view=rev
Log:
[yaml2obj] - Check we correctly set the sh_info field of .symtab section.

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

As was mentioned in a review comments for D60122,
it is never tested. The patch adds a test.

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

Added:
    llvm/trunk/test/tools/yaml2obj/local-symbols.yaml

Added: llvm/trunk/test/tools/yaml2obj/local-symbols.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/yaml2obj/local-symbols.yaml?rev=357687&view=auto
==============================================================================
--- llvm/trunk/test/tools/yaml2obj/local-symbols.yaml (added)
+++ llvm/trunk/test/tools/yaml2obj/local-symbols.yaml Thu Apr  4 04:49:54 2019
@@ -0,0 +1,36 @@
+# 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:
+  - Name: local
+  - Name: global
+    Binding: STB_GLOBAL
+
+# 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:
+  - Name:    local1
+  - Name:    local2
+  - Name:    global
+    Binding: STB_GLOBAL




More information about the llvm-commits mailing list