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

RUN: llvm-readobj -dynamic-table -V %p/Inputs/verdef.elf-x86-64 | FileCheck %s

CHECK: 0x000000006FFFFFF0 VERSYM               0x24C
CHECK: 0x000000006FFFFFFC VERDEF               0x25C
CHECK: 0x000000006FFFFFFD VERDEFNUM            3

CHECK: Version symbols {
CHECK-NEXT:   Section Name: .gnu.version (20)
CHECK-NEXT:   Address: 0x24C
CHECK-NEXT:   Offset: 0x24C
CHECK-NEXT:   Link: 1
CHECK-NEXT:   Symbols [
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 0
CHECK-NEXT:       Name: @
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 1
CHECK-NEXT:       Name: _end@
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 1
CHECK-NEXT:       Name: _edata@
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 3
CHECK-NEXT:       Name: goo@@VERSION2
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 1
CHECK-NEXT:       Name: __bss_start@
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 2
CHECK-NEXT:       Name: foo@@VERSION1
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 2
CHECK-NEXT:       Name: VERSION1@@VERSION1
CHECK-NEXT:     }
CHECK-NEXT:     Symbol {
CHECK-NEXT:       Version: 3
CHECK-NEXT:       Name: VERSION2@@VERSION2
CHECK-NEXT:     }
CHECK-NEXT:   ]
CHECK-NEXT: }

CHECK:      SHT_GNU_verdef {
CHECK-NEXT:   Definition {
CHECK-NEXT:     Version: 1
CHECK-NEXT:     Flags: Base (0x1)
CHECK-NEXT:     Index: 1
CHECK-NEXT:     Hash: 430712
CHECK-NEXT:     Name: blah
CHECK-NEXT:   }
CHECK-NEXT:   Definition {
CHECK-NEXT:     Version: 1
CHECK-NEXT:     Flags: 0x0
CHECK-NEXT:     Index: 2
CHECK-NEXT:     Hash: 175630257
CHECK-NEXT:     Name: VERSION1
CHECK-NEXT:   }
CHECK-NEXT:   Definition {
CHECK-NEXT:     Version: 1
CHECK-NEXT:     Flags: 0x0
CHECK-NEXT:     Index: 3
CHECK-NEXT:     Hash: 175630258
CHECK-NEXT:     Name: VERSION2
CHECK-NEXT:     Predecessor: VERSION1
CHECK-NEXT:   }
CHECK-NEXT: }

RUN: llvm-readobj -V %p/Inputs/verneed.elf-x86-64 | FileCheck %s --check-prefix=VERNEED

VERNEED:       SHT_GNU_verneed {
VERNEED-NEXT:   Dependency {
VERNEED-NEXT:     Version: 1
VERNEED-NEXT:     Count: 2
VERNEED-NEXT:     FileName: verneed1.so.0
VERNEED-NEXT:     Entry {
VERNEED-NEXT:       Hash: 1938
VERNEED-NEXT:       Flags: 0x0
VERNEED-NEXT:       Index: 3
VERNEED-NEXT:       Name: v2
VERNEED-NEXT:     }
VERNEED-NEXT:     Entry {
VERNEED-NEXT:       Hash: 1939
VERNEED-NEXT:       Flags: 0x0
VERNEED-NEXT:       Index: 2
VERNEED-NEXT:       Name: v3
VERNEED-NEXT:     }
VERNEED-NEXT:   }
VERNEED-NEXT:   Dependency {
VERNEED-NEXT:     Version: 1
VERNEED-NEXT:     Count: 1
VERNEED-NEXT:     FileName: verneed2.so.0
VERNEED-NEXT:     Entry {
VERNEED-NEXT:       Hash: 1937
VERNEED-NEXT:       Flags: 0x0
VERNEED-NEXT:       Index: 4
VERNEED-NEXT:       Name: v1
VERNEED-NEXT:     }
VERNEED-NEXT:   }
VERNEED-NEXT: }