llvm.org GIT mirror llvm / 785cf2e test / tools / llvm-readobj / elf-versioninfo.test
785cf2e

Tree @785cf2e (Download .tar.gz)

elf-versioninfo.test @785cf2eraw · history · blame

## Test that llvm-readobj dumps version info tags correctly.

# RUN: yaml2obj %s --docnum=1 -o %t1
# RUN: llvm-readobj -V %t1 | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readelf -V %t1 | FileCheck %s --check-prefix=GNU

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  OSABI:   ELFOSABI_FREEBSD
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name:         .gnu.version
    Type:         SHT_GNU_versym
    Flags:        [ SHF_ALLOC ]
    Link:         .dynsym
    AddressAlign: 0x0000000000000002
    EntSize:      0x0000000000000002
    Entries:      [ 0, 2, 3, 4, 5, 6]
  - Name:         .gnu.version_d
    Type:         SHT_GNU_verdef
    Flags:        [ SHF_ALLOC ]
    Link:         .dynstr
    AddressAlign: 0x0000000000000004
    Info:         0x0000000000000003
    Entries:
      - Version:    1
        Flags:      0
        VersionNdx: 2
        Hash:       175630257
        Names:
          - VERSION1
      - Version:    1
        Flags:      0
        VersionNdx: 3
        Hash:       175630258
        Names:
          - VERSION2
          - VERSION1
  - Name:         .gnu.version_r
    Type:         SHT_GNU_verneed
    Flags:        [ SHF_ALLOC ]
    Link:         .dynstr
    AddressAlign: 0x0000000000000004
    Info:         0x0000000000000002
    Dependencies:
      - Version: 1
        File:    verneed1.so.0
        Entries:
          - Name:  v1
            Hash:  1938
            Flags: 0
            Other: 4
          - Name:  v2
            Hash:  1939
            Flags: 0
            Other: 5
      - Version: 1
        File:    verneed2.so.0
        Entries:
          - Name:  v3
            Hash:  1937
            Flags: 0
            Other: 6
DynamicSymbols:
  - Name:            sym1
    Binding:         STB_GLOBAL
  - Name:            sym2
    Binding:         STB_GLOBAL
  - Name:            sym3
    Binding:         STB_GLOBAL
  - Name:            sym4
    Binding:         STB_GLOBAL
  - Name:            sym5
    Binding:         STB_GLOBAL
...

# LLVM:      Version symbols {
# LLVM-NEXT:   Section Name: .gnu.version
# LLVM-NEXT:   Address: 0x0
# LLVM-NEXT:   Offset: 0x280
# LLVM-NEXT:   Link: 7
# LLVM-NEXT:   Symbols [
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 0
# LLVM-NEXT:       Name:
# LLVM-NEXT:     }
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 2
# LLVM-NEXT:       Name: sym1@@VERSION1
# LLVM-NEXT:     }
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 3
# LLVM-NEXT:       Name: sym2@@VERSION2
# LLVM-NEXT:     }
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 4
# LLVM-NEXT:       Name: sym3@v1
# LLVM-NEXT:     }
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 5
# LLVM-NEXT:       Name: sym4@v2
# LLVM-NEXT:     }
# LLVM-NEXT:     Symbol {
# LLVM-NEXT:       Version: 6
# LLVM-NEXT:       Name: sym5@v3
# LLVM-NEXT:     }
# LLVM-NEXT:   ]
# LLVM-NEXT: }
# LLVM-NEXT: SHT_GNU_verdef {
# LLVM-NEXT:   Definition {
# LLVM-NEXT:     Version: 1
# LLVM-NEXT:     Flags: 0x0
# LLVM-NEXT:     Index: 2
# LLVM-NEXT:     Hash: 175630257
# LLVM-NEXT:     Name: VERSION1
# LLVM-NEXT:   }
# LLVM-NEXT:   Definition {
# LLVM-NEXT:     Version: 1
# LLVM-NEXT:     Flags: 0x0
# LLVM-NEXT:     Index: 3
# LLVM-NEXT:     Hash: 175630258
# LLVM-NEXT:     Name: VERSION2
# LLVM-NEXT:     Predecessor: VERSION1
# LLVM-NEXT:   }
# LLVM-NEXT:   Definition {
# LLVM-NEXT:     Version: 1
# LLVM-NEXT:     Flags: 0x0
# LLVM-NEXT:     Index: 3
# LLVM-NEXT:     Hash: 175630258
# LLVM-NEXT:     Name: VERSION2
# LLVM-NEXT:     Predecessor: VERSION1
# LLVM-NEXT:   }
# LLVM-NEXT: }
# LLVM-NEXT: SHT_GNU_verneed {
# LLVM-NEXT:   Dependency {
# LLVM-NEXT:     Version: 1
# LLVM-NEXT:     Count: 2
# LLVM-NEXT:     FileName: verneed1.so.0
# LLVM-NEXT:     Entries [
# LLVM-NEXT:       Entry {
# LLVM-NEXT:         Hash: 1938
# LLVM-NEXT:         Flags: 0x0
# LLVM-NEXT:         Index: 4
# LLVM-NEXT:         Name: v1
# LLVM-NEXT:       }
# LLVM-NEXT:       Entry {
# LLVM-NEXT:         Hash: 1939
# LLVM-NEXT:         Flags: 0x0
# LLVM-NEXT:         Index: 5
# LLVM-NEXT:         Name: v2
# LLVM-NEXT:       }
# LLVM-NEXT:     ]
# LLVM-NEXT:   }
# LLVM-NEXT:   Dependency {
# LLVM-NEXT:     Version: 1
# LLVM-NEXT:     Count: 1
# LLVM-NEXT:     FileName: verneed2.so.0
# LLVM-NEXT:     Entries [
# LLVM-NEXT:       Entry {
# LLVM-NEXT:         Hash: 1937
# LLVM-NEXT:         Flags: 0x0
# LLVM-NEXT:         Index: 6
# LLVM-NEXT:         Name: v3
# LLVM-NEXT:       }
# LLVM-NEXT:     ]
# LLVM-NEXT:   }
# LLVM-NEXT: }

# GNU:      Version symbols section '.gnu.version' contains 6 entries:
# GNU-NEXT:  Addr: 0000000000000000  Offset: 0x000280  Link: 7 (.dynsym)
# GNU-NEXT:   000:   0 (*local*) 2 (VERSION1) 3 (VERSION2) 4 (v1)
# GNU-NEXT:   004:   5 (v2)      6 (v3)
# GNU-EMPTY:
# GNU-NEXT: Version definition section '.gnu.version_d' contains 3 entries:
# GNU-NEXT:  Addr: 0000000000000000  Offset: 0x00028c  Link: 8 (.dynstr)
# GNU-NEXT:   0x0000: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: VERSION1
# GNU-NEXT:   0x001c: Rev: 1  Flags: none  Index: 3  Cnt: 2  Name: VERSION2
# GNU-NEXT:   0x0038: Parent 1: VERSION1
# GNU-NEXT:   0x001c: Rev: 1  Flags: none  Index: 3  Cnt: 2  Name: VERSION2
# GNU-NEXT:   0x0038: Parent 1: VERSION1
# GNU-EMPTY:
# GNU-NEXT: Version needs section '.gnu.version_r' contains 2 entries:
# GNU-NEXT:  Addr: 0000000000000000  Offset: 0x0002cc  Link: 8 (.dynstr)
# GNU-NEXT:   0x0000: Version: 1  File: verneed1.so.0  Cnt: 2
# GNU-NEXT:   0x0010:   Name: v1  Flags: none  Version: 4
# GNU-NEXT:   0x0020:   Name: v2  Flags: none  Version: 5
# GNU-NEXT:   0x0030: Version: 1  File: verneed2.so.0  Cnt: 1
# GNU-NEXT:   0x0040:   Name: v3  Flags: none  Version: 6