Index: llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test =================================================================== --- llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test +++ llvm/trunk/test/tools/llvm-readobj/elf-versioninfo.test @@ -1,130 +1,178 @@ -// Test that llvm-readobj dumps version info tags correctly. +## Test that llvm-readobj dumps version info tags correctly. -RUN: llvm-readobj --dynamic-table -V %p/Inputs/verdef.elf-x86-64 | FileCheck %s --check-prefix=LLVM-VERDEF -RUN: llvm-readelf --dynamic-table -V %p/Inputs/verdef.elf-x86-64 | FileCheck %s --check-prefix=GNU-VERDEF - -LLVM-VERDEF: 0x000000006FFFFFF0 VERSYM 0x24C -LLVM-VERDEF: 0x000000006FFFFFFC VERDEF 0x25C -LLVM-VERDEF: 0x000000006FFFFFFD VERDEFNUM 3 - -LLVM-VERDEF: Version symbols { -LLVM-VERDEF-NEXT: Section Name: .gnu.version (20) -LLVM-VERDEF-NEXT: Address: 0x24C -LLVM-VERDEF-NEXT: Offset: 0x24C -LLVM-VERDEF-NEXT: Link: 1 -LLVM-VERDEF-NEXT: Symbols [ -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 0 -LLVM-VERDEF-NEXT: Name: {{$}} -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Name: _end{{$}} -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Name: _edata{{$}} -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 3 -LLVM-VERDEF-NEXT: Name: goo@@VERSION2 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Name: __bss_start{{$}} -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 2 -LLVM-VERDEF-NEXT: Name: foo@@VERSION1 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 2 -LLVM-VERDEF-NEXT: Name: VERSION1@@VERSION1 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Symbol { -LLVM-VERDEF-NEXT: Version: 3 -LLVM-VERDEF-NEXT: Name: VERSION2@@VERSION2 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: ] -LLVM-VERDEF-NEXT: } - -LLVM-VERDEF: SHT_GNU_verdef { -LLVM-VERDEF-NEXT: Definition { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Flags: Base (0x1) -LLVM-VERDEF-NEXT: Index: 1 -LLVM-VERDEF-NEXT: Hash: 430712 -LLVM-VERDEF-NEXT: Name: blah -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Definition { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Flags: 0x0 -LLVM-VERDEF-NEXT: Index: 2 -LLVM-VERDEF-NEXT: Hash: 175630257 -LLVM-VERDEF-NEXT: Name: VERSION1 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: Definition { -LLVM-VERDEF-NEXT: Version: 1 -LLVM-VERDEF-NEXT: Flags: 0x0 -LLVM-VERDEF-NEXT: Index: 3 -LLVM-VERDEF-NEXT: Hash: 175630258 -LLVM-VERDEF-NEXT: Name: VERSION2 -LLVM-VERDEF-NEXT: Predecessor: VERSION1 -LLVM-VERDEF-NEXT: } -LLVM-VERDEF-NEXT: } - -GNU-VERDEF: 0x000000006ffffff0 (VERSYM) 0x24c -GNU-VERDEF: 0x000000006ffffffc (VERDEF) 0x25c -GNU-VERDEF: 0x000000006ffffffd (VERDEFNUM) 3 - -GNU-VERDEF: Version symbols section '.gnu.version' contains 8 entries: -GNU-VERDEF-NEXT: Addr: 000000000000024c Offset: 0x00024c Link: 1 (.dynsym) -GNU-VERDEF-NEXT: 000: 0 (*local*) 1 (*global*) 1 (*global*) 3 (VERSION2) -GNU-VERDEF-NEXT: 004: 1 (*global*) 2 (VERSION1) 2 (VERSION1) 3 (VERSION2) - -GNU-VERDEF: Dumper for .gnu.version_d is not implemented - -RUN: llvm-readobj -V %p/Inputs/verneed.elf-x86-64 | FileCheck %s --check-prefix=LLVM-VERNEED -RUN: llvm-readelf -V %p/Inputs/verneed.elf-x86-64 | FileCheck %s --check-prefix=GNU-VERNEED - -LLVM-VERNEED: SHT_GNU_verneed { -LLVM-VERNEED-NEXT: Dependency { -LLVM-VERNEED-NEXT: Version: 1 -LLVM-VERNEED-NEXT: Count: 2 -LLVM-VERNEED-NEXT: FileName: verneed1.so.0 -LLVM-VERNEED-NEXT: Entries [ -LLVM-VERNEED-NEXT: Entry { -LLVM-VERNEED-NEXT: Hash: 1938 -LLVM-VERNEED-NEXT: Flags: 0x0 -LLVM-VERNEED-NEXT: Index: 3 -LLVM-VERNEED-NEXT: Name: v2 -LLVM-VERNEED-NEXT: } -LLVM-VERNEED-NEXT: Entry { -LLVM-VERNEED-NEXT: Hash: 1939 -LLVM-VERNEED-NEXT: Flags: 0x0 -LLVM-VERNEED-NEXT: Index: 2 -LLVM-VERNEED-NEXT: Name: v3 -LLVM-VERNEED-NEXT: } -LLVM-VERNEED-NEXT: ] -LLVM-VERNEED-NEXT: } -LLVM-VERNEED-NEXT: Dependency { -LLVM-VERNEED-NEXT: Version: 1 -LLVM-VERNEED-NEXT: Count: 1 -LLVM-VERNEED-NEXT: FileName: verneed2.so.0 -LLVM-VERNEED-NEXT: Entries [ -LLVM-VERNEED-NEXT: Entry { -LLVM-VERNEED-NEXT: Hash: 1937 -LLVM-VERNEED-NEXT: Flags: 0x0 -LLVM-VERNEED-NEXT: Index: 4 -LLVM-VERNEED-NEXT: Name: v1 -LLVM-VERNEED-NEXT: } -LLVM-VERNEED-NEXT: ] -LLVM-VERNEED-NEXT: } -LLVM-VERNEED-NEXT: } - -GNU-VERNEED: Version symbols section '.gnu.version' contains 4 entries: -GNU-VERNEED-NEXT: Addr: 0000000000010228 Offset: 0x000228 Link: 1 (.dynsym) -GNU-VERNEED-NEXT: 000: 0 (*local*) 2 (v3) 3 (v2) 4 (v1) - -GNU-VERNEED: Dumper for .gnu.version_r is not implemented +# 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-VERDEF: Dumper for .gnu.version_d is not implemented +# GNU-VERNEED: Dumper for .gnu.version_r is not implemented