Index: lld/test/ELF/verdef-defaultver.s =================================================================== --- lld/test/ELF/verdef-defaultver.s +++ lld/test/ELF/verdef-defaultver.s @@ -78,21 +78,25 @@ # DSO-NEXT: VersionDefinitions [ # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: Base +# DSO-NEXT: Flags [ (0x1) +# DSO-NEXT: Base (0x1) +# DSO-NEXT: ] # DSO-NEXT: Index: 1 # DSO-NEXT: Hash: 127830196 # DSO-NEXT: Name: shared # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 2 # DSO-NEXT: Hash: 1425 # DSO-NEXT: Name: V1 # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 3 # DSO-NEXT: Hash: 1426 # DSO-NEXT: Name: V2 @@ -170,13 +174,15 @@ # EXE-NEXT: Entries [ # EXE-NEXT: Entry { # EXE-NEXT: Hash: 1425 -# EXE-NEXT: Flags: 0x0 +# EXE-NEXT: Flags [ (0x0) +# EXE-NEXT: ] # EXE-NEXT: Index: 2 # EXE-NEXT: Name: V1 # EXE-NEXT: } # EXE-NEXT: Entry { # EXE-NEXT: Hash: 1426 -# EXE-NEXT: Flags: 0x0 +# EXE-NEXT: Flags [ (0x0) +# EXE-NEXT: ] # EXE-NEXT: Index: 3 # EXE-NEXT: Name: V2 # EXE-NEXT: } Index: lld/test/ELF/verdef-dependency.s =================================================================== --- lld/test/ELF/verdef-dependency.s +++ lld/test/ELF/verdef-dependency.s @@ -9,28 +9,33 @@ # DSO: VersionDefinitions [ # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: Base +# DSO-NEXT: Flags [ (0x1) +# DSO-NEXT: Base (0x1) +# DSO-NEXT: ] # DSO-NEXT: Index: 1 # DSO-NEXT: Hash: 127830196 # DSO-NEXT: Name: shared # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 2 # DSO-NEXT: Hash: 98457184 # DSO-NEXT: Name: LIBSAMPLE_1.0 # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 3 # DSO-NEXT: Hash: 98456416 # DSO-NEXT: Name: LIBSAMPLE_2.0 # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 4 # DSO-NEXT: Hash: 98456672 # DSO-NEXT: Name: LIBSAMPLE_3.0 Index: lld/test/ELF/verdef.s =================================================================== --- lld/test/ELF/verdef.s +++ lld/test/ELF/verdef.s @@ -27,28 +27,33 @@ # DSO-NEXT: VersionDefinitions [ # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: Base +# DSO-NEXT: Flags [ (0x1) +# DSO-NEXT: Base (0x1) +# DSO-NEXT: ] # DSO-NEXT: Index: 1 # DSO-NEXT: Hash: 127830196 # DSO-NEXT: Name: shared # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 2 # DSO-NEXT: Hash: 98457184 # DSO-NEXT: Name: LIBSAMPLE_1.0 # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 3 # DSO-NEXT: Hash: 98456416 # DSO-NEXT: Name: LIBSAMPLE_2.0 # DSO-NEXT: } # DSO-NEXT: Definition { # DSO-NEXT: Version: 1 -# DSO-NEXT: Flags: 0x0 +# DSO-NEXT: Flags [ (0x0) +# DSO-NEXT: ] # DSO-NEXT: Index: 4 # DSO-NEXT: Hash: 98456672 # DSO-NEXT: Name: LIBSAMPLE_3.0 Index: llvm/test/tools/llvm-readobj/elf-invalid-versioning.test =================================================================== --- llvm/test/tools/llvm-readobj/elf-invalid-versioning.test +++ llvm/test/tools/llvm-readobj/elf-invalid-versioning.test @@ -37,7 +37,8 @@ # LLVM-VERNEED-NAME-NEXT: Entries [ # LLVM-VERNEED-NAME-NEXT: Entry { # LLVM-VERNEED-NAME-NEXT: Hash: 0 -# LLVM-VERNEED-NAME-NEXT: Flags: 0x0 +# LLVM-VERNEED-NAME-NEXT: Flags [ (0x0) +# LLVM-VERNEED-NAME-NEXT: ] # LLVM-VERNEED-NAME-NEXT: Index: 2 # LLVM-VERNEED-NAME-NEXT: Name: {{$}} # LLVM-VERNEED-NAME-NEXT: } Index: llvm/test/tools/llvm-readobj/elf-versioninfo.test =================================================================== --- llvm/test/tools/llvm-readobj/elf-versioninfo.test +++ llvm/test/tools/llvm-readobj/elf-versioninfo.test @@ -1,4 +1,4 @@ -## Test that llvm-readobj dumps version info tags correctly. +## Test how llvm-readobj/llvm-readelf tools dump versioning sections. # RUN: yaml2obj %s --docnum=1 -o %t1 # RUN: llvm-readobj -V %t1 | FileCheck %s --check-prefix=LLVM @@ -24,16 +24,40 @@ Flags: [ SHF_ALLOC ] Link: .dynstr AddressAlign: 0x0000000000000004 - Info: 0x0000000000000003 + Info: 0x0000000000000006 Entries: - Version: 1 Flags: 0 + VersionNdx: 0 + Hash: 0 + Names: + - VERSION1 + - Version: 1 + Flags: 1 + VersionNdx: 0 + Hash: 0 + Names: + - VERSION1 + - Version: 1 + Flags: 2 + VersionNdx: 0 + Hash: 0 + Names: + - VERSION1 + - Version: 1 + Flags: 4 + VersionNdx: 0 + Hash: 0 + Names: + - VERSION1 + - Version: 1 + Flags: 7 VersionNdx: 2 Hash: 175630257 Names: - VERSION1 - Version: 1 - Flags: 0 + Flags: 8 VersionNdx: 3 Hash: 175630258 Names: @@ -49,13 +73,25 @@ - Version: 1 File: verneed1.so.0 Entries: + - Name: v1 + Hash: 0 + Flags: 1 + Other: 0 + - Name: v1 + Hash: 0 + Flags: 2 + Other: 0 + - Name: v1 + Hash: 0 + Flags: 4 + Other: 0 - Name: v1 Hash: 1938 - Flags: 0 + Flags: 7 Other: 4 - Name: v2 Hash: 1939 - Flags: 0 + Flags: 8 Other: 5 - Version: 1 File: verneed2.so.0 @@ -106,22 +142,54 @@ # LLVM-NEXT: VersionDefinitions [ # LLVM-NEXT: Definition { # LLVM-NEXT: Version: 1 -# LLVM-NEXT: Flags: 0x0 -# LLVM-NEXT: Index: 2 -# LLVM-NEXT: Hash: 175630257 +# LLVM-NEXT: Flags [ (0x0) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Hash: 0 # 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: Flags [ (0x1) +# LLVM-NEXT: Base (0x1) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Name: VERSION1 # LLVM-NEXT: } # LLVM-NEXT: Definition { # LLVM-NEXT: Version: 1 -# LLVM-NEXT: Flags: 0x0 +# LLVM-NEXT: Flags [ (0x2) +# LLVM-NEXT: Weak (0x2) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Name: VERSION1 +# LLVM-NEXT: } +# LLVM-NEXT: Definition { +# LLVM-NEXT: Version: 1 +# LLVM-NEXT: Flags [ (0x4) +# LLVM-NEXT: Info (0x4) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Name: VERSION1 +# LLVM-NEXT: } +# LLVM-NEXT: Definition { +# LLVM-NEXT: Version: 1 +# LLVM-NEXT: Flags [ (0x7) +# LLVM-NEXT: Base (0x1) +# LLVM-NEXT: Info (0x4) +# LLVM-NEXT: Weak (0x2) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 2 +# LLVM-NEXT: Hash: 175630257 +# LLVM-NEXT: Name: VERSION1 +# LLVM-NEXT: } +# LLVM-NEXT: Definition { +# LLVM-NEXT: Version: 1 +# LLVM-NEXT: Flags [ (0x8) +# LLVM-NEXT: ] # LLVM-NEXT: Index: 3 # LLVM-NEXT: Hash: 175630258 # LLVM-NEXT: Name: VERSION2 @@ -131,18 +199,47 @@ # LLVM-NEXT: VersionRequirements [ # LLVM-NEXT: Dependency { # LLVM-NEXT: Version: 1 -# LLVM-NEXT: Count: 2 +# LLVM-NEXT: Count: 5 # LLVM-NEXT: FileName: verneed1.so.0 # LLVM-NEXT: Entries [ # LLVM-NEXT: Entry { +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Flags [ (0x1) +# LLVM-NEXT: Base (0x1) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Name: v1 +# LLVM-NEXT: } +# LLVM-NEXT: Entry { +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Flags [ (0x2) +# LLVM-NEXT: Weak (0x2) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Name: v1 +# LLVM-NEXT: } +# LLVM-NEXT: Entry { +# LLVM-NEXT: Hash: 0 +# LLVM-NEXT: Flags [ (0x4) +# LLVM-NEXT: Info (0x4) +# LLVM-NEXT: ] +# LLVM-NEXT: Index: 0 +# LLVM-NEXT: Name: v1 +# LLVM-NEXT: } +# LLVM-NEXT: Entry { # LLVM-NEXT: Hash: 1938 -# LLVM-NEXT: Flags: 0x0 +# LLVM-NEXT: Flags [ (0x7) +# LLVM-NEXT: Base (0x1) +# LLVM-NEXT: Info (0x4) +# LLVM-NEXT: Weak (0x2) +# LLVM-NEXT: ] # LLVM-NEXT: Index: 4 # LLVM-NEXT: Name: v1 # LLVM-NEXT: } # LLVM-NEXT: Entry { # LLVM-NEXT: Hash: 1939 -# LLVM-NEXT: Flags: 0x0 +# LLVM-NEXT: Flags [ (0x8) +# LLVM-NEXT: ] # LLVM-NEXT: Index: 5 # LLVM-NEXT: Name: v2 # LLVM-NEXT: } @@ -155,7 +252,8 @@ # LLVM-NEXT: Entries [ # LLVM-NEXT: Entry { # LLVM-NEXT: Hash: 1937 -# LLVM-NEXT: Flags: 0x0 +# LLVM-NEXT: Flags [ (0x0) +# LLVM-NEXT: ] # LLVM-NEXT: Index: 6 # LLVM-NEXT: Name: v3 # LLVM-NEXT: } @@ -168,18 +266,23 @@ # 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: 0x00004c Link: 7 (.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-NEXT: Version definition section '.gnu.version_d' contains 6 entries: +# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00004c Link: 7 (.dynstr) +# GNU-NEXT: 0x0000: Rev: 1 Flags: none Index: 0 Cnt: 1 Name: VERSION1 +# GNU-NEXT: 0x001c: Rev: 1 Flags: BASE Index: 0 Cnt: 1 Name: VERSION1 +# GNU-NEXT: 0x0038: Rev: 1 Flags: WEAK Index: 0 Cnt: 1 Name: VERSION1 +# GNU-NEXT: 0x0054: Rev: 1 Flags: INFO Index: 0 Cnt: 1 Name: VERSION1 +# GNU-NEXT: 0x0070: Rev: 1 Flags: BASE | WEAK | INFO Index: 2 Cnt: 1 Name: VERSION1 +# GNU-NEXT: 0x008c: Rev: 1 Flags: Index: 3 Cnt: 2 Name: VERSION2 +# GNU-NEXT: 0x00a8: Parent 1: VERSION1 # GNU-EMPTY: -# GNU-NEXT: Version needs section '.gnu.version_r' contains 2 entries: -# GNU-NEXT: Addr: 0000000000000000 Offset: 0x00008c Link: 7 (.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 +# GNU-NEXT: Version needs section '.gnu.version_r' contains 2 entries: +# GNU-NEXT: Addr: 0000000000000000 Offset: 0x0000fc Link: 7 (.dynstr) +# GNU-NEXT: 0x0000: Version: 1 File: verneed1.so.0 Cnt: 5 +# GNU-NEXT: 0x0010: Name: v1 Flags: BASE Version: 0 +# GNU-NEXT: 0x0020: Name: v1 Flags: WEAK Version: 0 +# GNU-NEXT: 0x0030: Name: v1 Flags: INFO Version: 0 +# GNU-NEXT: 0x0040: Name: v1 Flags: BASE | WEAK | INFO Version: 4 +# GNU-NEXT: 0x0050: Name: v2 Flags: Version: 5 +# GNU-NEXT: 0x0060: Version: 1 File: verneed2.so.0 Cnt: 1 +# GNU-NEXT: 0x0070: Name: v3 Flags: none Version: 6 Index: llvm/test/tools/yaml2obj/verdef-section.yaml =================================================================== --- llvm/test/tools/yaml2obj/verdef-section.yaml +++ llvm/test/tools/yaml2obj/verdef-section.yaml @@ -6,21 +6,28 @@ # CHECK: VersionDefinitions [ # CHECK-NEXT: Definition { # CHECK-NEXT: Version: 1 -# CHECK-NEXT: Flags: Base +# CHECK-NEXT: Flags [ (0x1) +# CHECK-NEXT: Base (0x1) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 1 # CHECK-NEXT: Hash: 170240160 # CHECK-NEXT: Name: dso.so.0 # CHECK-NEXT: } # CHECK-NEXT: Definition { # CHECK-NEXT: Version: 1 -# CHECK-NEXT: Flags: Weak +# CHECK-NEXT: Flags [ (0x2) +# CHECK-NEXT: Weak (0x2) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 2 # CHECK-NEXT: Hash: 108387921 # CHECK-NEXT: Name: VERSION_1 # CHECK-NEXT: } # CHECK-NEXT: Definition { # CHECK-NEXT: Version: 1 -# CHECK-NEXT: Flags: 0x3 +# CHECK-NEXT: Flags [ (0x3) +# CHECK-NEXT: Base (0x1) +# CHECK-NEXT: Weak (0x2) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 3 # CHECK-NEXT: Hash: 108387922 # CHECK-NEXT: Name: VERSION_2 Index: llvm/test/tools/yaml2obj/verneed-section.yaml =================================================================== --- llvm/test/tools/yaml2obj/verneed-section.yaml +++ llvm/test/tools/yaml2obj/verneed-section.yaml @@ -11,13 +11,18 @@ # CHECK-NEXT: Entries [ # CHECK-NEXT: Entry { # CHECK-NEXT: Hash: 1937 -# CHECK-NEXT: Flags: 0xA +# CHECK-NEXT: Flags [ (0xA) +# CHECK-NEXT: Weak (0x2) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 3 # CHECK-NEXT: Name: v1 # CHECK-NEXT: } # CHECK-NEXT: Entry { # CHECK-NEXT: Hash: 1938 -# CHECK-NEXT: Flags: 0xB +# CHECK-NEXT: Flags [ (0xB) +# CHECK-NEXT: Base (0x1) +# CHECK-NEXT: Weak (0x2) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 4 # CHECK-NEXT: Name: v2 # CHECK-NEXT: } @@ -30,7 +35,9 @@ # CHECK-NEXT: Entries [ # CHECK-NEXT: Entry { # CHECK-NEXT: Hash: 1939 -# CHECK-NEXT: Flags: 0xC +# CHECK-NEXT: Flags [ (0xC) +# CHECK-NEXT: Info (0x4) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 2 # CHECK-NEXT: Name: v3 # CHECK-NEXT: } Index: llvm/test/tools/yaml2obj/versym-section.yaml =================================================================== --- llvm/test/tools/yaml2obj/versym-section.yaml +++ llvm/test/tools/yaml2obj/versym-section.yaml @@ -28,13 +28,15 @@ # CHECK-NEXT: Entries [ # CHECK-NEXT: Entry { # CHECK-NEXT: Hash: 1937 -# CHECK-NEXT: Flags: 0x0 +# CHECK-NEXT: Flags [ (0x0) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 3 # CHECK-NEXT: Name: v1 # CHECK-NEXT: } # CHECK-NEXT: Entry { # CHECK-NEXT: Hash: 1938 -# CHECK-NEXT: Flags: 0x0 +# CHECK-NEXT: Flags [ (0x0) +# CHECK-NEXT: ] # CHECK-NEXT: Index: 4 # CHECK-NEXT: Name: v2 # CHECK-NEXT: } Index: llvm/tools/llvm-readobj/ELFDumper.cpp =================================================================== --- llvm/tools/llvm-readobj/ELFDumper.cpp +++ llvm/tools/llvm-readobj/ELFDumper.cpp @@ -5730,7 +5730,7 @@ const Elf_Verdef *Verdef = reinterpret_cast(VerdefBuf); DictScope Def(W, "Definition"); W.printNumber("Version", Verdef->vd_version); - W.printEnum("Flags", Verdef->vd_flags, makeArrayRef(SymVersionFlags)); + W.printFlags("Flags", Verdef->vd_flags, makeArrayRef(SymVersionFlags)); W.printNumber("Index", Verdef->vd_ndx); W.printNumber("Hash", Verdef->vd_hash); W.printString("Name", StringRef(reinterpret_cast( @@ -5790,7 +5790,7 @@ reinterpret_cast(VernauxBuf); DictScope Entry(W, "Entry"); W.printNumber("Hash", Vernaux->vna_hash); - W.printEnum("Flags", Vernaux->vna_flags, makeArrayRef(SymVersionFlags)); + W.printFlags("Flags", Vernaux->vna_flags, makeArrayRef(SymVersionFlags)); W.printNumber("Index", Vernaux->vna_other); StringRef Name = StringTable.size() > Vernaux->vna_name