From: George Rimar Date: Thu, 4 Apr 2019 11:49:54 +0000 (+0000) Subject: [yaml2obj] - Check we correctly set the sh_info field of .symtab section. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b99bb13bdf853ac697e1b9d286314f4df8d821f7;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357687 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/tools/yaml2obj/local-symbols.yaml b/test/tools/yaml2obj/local-symbols.yaml new file mode 100644 index 00000000000..8cd5b0191f3 --- /dev/null +++ b/test/tools/yaml2obj/local-symbols.yaml @@ -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