[yaml2obj][obj2yaml] - Change how symbol's binding is descibed when parsing/dumping.

Currently, YAML has the following syntax for describing the symbols:

Symbols:
  Local:
    LocalSymbol1:
    ...
    LocalSymbol2:
    ...
  ...
  Global:
    GlobalSymbol1:
  ...
  Weak:
  ...
  GNUUnique:

I.e. symbols are grouped by their bindings. That is not very convenient,
because:

It does not allow to set a custom binding, what can be useful for producing
broken/special outputs for test cases. Adding a new binding would require to
change a syntax (what we observed when added GNUUnique recently).

It does not allow to change the order of the symbols in .symtab/.dynsym,
i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique
are following, but we are not able to change the order.

It is not consistent. Binding is just one of the properties of the symbol,
we do not group them by other properties.

It makes the code more complex that it can be. This patch shows it can be simplified
with the change performed.

The patch changes the syntax to just:

Symbols:
  Symbol1:
  ...
  Symbol2:
  ...
...

With that, we are able to work with the binding field just like with any other symbol property.

Differential revision: https://reviews.llvm.org/D60122

llvm-svn: 357595
diff --git a/llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml b/llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
index 8da77b3..04855e0 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
+++ b/llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
@@ -44,15 +44,18 @@
     Flags:           [ SHF_GROUP ]
     Content:         '00'
 Symbols:
-  Global:
-    - Name:    .debug_foo
-      Type:    STT_SECTION
-      Section: .debug_foo
-    - Name:    .notdebug_foo
-      Type:    STT_SECTION
-      Section: .notdebug_foo
-    - Name:    .Linfo_string0
-      Section: .debug_bar
-    - Name:    groupname
-      Section: .group
+  - Name:    .debug_foo
+    Type:    STT_SECTION
+    Section: .debug_foo
+    Binding:  STB_GLOBAL
+  - Name:    .notdebug_foo
+    Type:    STT_SECTION
+    Section: .notdebug_foo
+    Binding:  STB_GLOBAL
+  - Name:    .Linfo_string0
+    Section: .debug_bar
+    Binding:  STB_GLOBAL
+  - Name:    groupname
+    Section: .group
+    Binding:  STB_GLOBAL
 ...
diff --git a/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test
index 5f2536d..62c5873 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test
@@ -9,10 +9,10 @@
   Type:            ET_EXEC
   Machine:         EM_X86_64
 Symbols:
-  Global:
-    - Name:     test
-      Index:    SHN_ABS
-      Value:    0x1234
+  - Name:     test
+    Index:    SHN_ABS
+    Value:    0x1234
+    Binding:  STB_GLOBAL
 
 #CHECK:     Symbols [
 #CHECK-NEXT:   Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test b/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test
index 596a780..734f436 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test
@@ -36,13 +36,12 @@
     AddressAlign:    0x0000000000000004
     Content:         ''
 Symbols:         
-  Local:           
-    - Name:            .text.bar
-      Type:            STT_SECTION
-      Section:         .text.bar
-    - Name:            .text.foo
-      Type:            STT_SECTION
-      Section:         .text.foo
-    - Name:            .ARM.exidx.text.foo
-      Type:            STT_SECTION
-      Section:         .ARM.exidx.text.foo
+  - Name:            .text.bar
+    Type:            STT_SECTION
+    Section:         .text.bar
+  - Name:            .text.foo
+    Type:            STT_SECTION
+    Section:         .text.foo
+  - Name:            .ARM.exidx.text.foo
+    Type:            STT_SECTION
+    Section:         .ARM.exidx.text.foo
diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test b/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test
index 6d7e86c..ada1414 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test
@@ -47,11 +47,11 @@
     AddressAlign:    0x0000000000000010
     Content:         "00000000"
 Symbols:
-   Global:
-     - Name:     foo
-       Type:     STT_FUNC
-       Section:  .text
-       Value:    0x1004
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1004
+    Binding:  STB_GLOBAL
 
 # CHECK: Type: SHT_NULL
 
diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test b/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test
index e043041..ac1831a 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test
@@ -56,24 +56,28 @@
         Type:   R_X86_64_PC32
         Addend: 0x13
 Symbols:
-  Global:
-    - Name:     _start
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     4
-    - Name:     foo
-      Type:     STT_FUNC
-      Size:     4
-    - Name:     fooA
-      Type:     STT_FUNC
-      Size:     4
-    - Name:     bar
-      Type:     STT_OBJECT
-      Size:     4
-    - Name:     barA
-      Type:     STT_OBJECT
-      Size:     4
+  - Name:     _start
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     foo
+    Type:     STT_FUNC
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     fooA
+    Type:     STT_FUNC
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     bar
+    Type:     STT_OBJECT
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     barA
+    Type:     STT_OBJECT
+    Size:     4
+    Binding:  STB_GLOBAL
 
 # CHECK:     Relocations [
 # CHECK-NEXT:  Section (2) .rel.text {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test
index 9ec49c7..42d5639 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test
@@ -9,22 +9,26 @@
   Type:            ET_EXEC
   Machine:         EM_HEXAGON
 Symbols:
-  Global:
-    - Name:     test
-      Index:    SHN_COMMON
-      Value:    0x1234
-    - Name:     test2
-      Index:    SHN_HEXAGON_SCOMMON
-      Value:    0x1235
-    - Name:     test3
-      Index:    SHN_HEXAGON_SCOMMON_2
-      Value:    0x1236
-    - Name:     test4
-      Index:    SHN_HEXAGON_SCOMMON_4
-      Value:    0x1237
-    - Name:     test5
-      Index:    SHN_HEXAGON_SCOMMON_8
-      Value:    0x1238
+  - Name:     test
+    Index:    SHN_COMMON
+    Value:    0x1234
+    Binding:  STB_GLOBAL
+  - Name:     test2
+    Index:    SHN_HEXAGON_SCOMMON
+    Value:    0x1235
+    Binding:  STB_GLOBAL
+  - Name:     test3
+    Index:    SHN_HEXAGON_SCOMMON_2
+    Value:    0x1236
+    Binding:  STB_GLOBAL
+  - Name:     test4
+    Index:    SHN_HEXAGON_SCOMMON_4
+    Value:    0x1237
+    Binding:  STB_GLOBAL
+  - Name:     test5
+    Index:    SHN_HEXAGON_SCOMMON_8
+    Value:    0x1238
+    Binding:  STB_GLOBAL
 
 #CHECK:     Symbols [
 #CHECK-NEXT:   Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
index feb5320..3cb0d4e 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
@@ -53,15 +53,16 @@
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC ]
 Symbols:
-  Global:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1234
-    - Name:     bar
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0xabcd
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1234
+    Binding:  STB_GLOBAL
+  - Name:     bar
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0xabcd
+    Binding:  STB_GLOBAL
 
 # CHECK: Format:
 # 32-SAME:      ELF32-
diff --git a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test
index fa5832b..d2da14e 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test
@@ -22,16 +22,17 @@
     Content:         DEADBEEF
     Size:            16
 Symbols:
-  Global:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    16
-      Size:     8
-    - Name:     bar
-      Type:     STT_OBJECT
-      Section:  .data
-      Size:     16
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    16
+    Size:     8
+    Binding:  STB_GLOBAL
+  - Name:     bar
+    Type:     STT_OBJECT
+    Section:  .data
+    Size:     16
+    Binding:  STB_GLOBAL
 
 # CHECK:      Sections [
 # CHECK-NEXT:   Section {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-all.test b/llvm/test/tools/llvm-objcopy/ELF/discard-all.test
index cc676b5..f27c161 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/discard-all.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/discard-all.test
@@ -33,29 +33,28 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-    - Name:     LocalSection
-      Type:     STT_SECTION
-      Section:  .text
-    - Name:     LocalFile
-      Type:     STT_FILE
-  Weak:
-    - Name:     Weak
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     LocalSection
+    Type:     STT_SECTION
+    Section:  .text
+  - Name:     LocalFile
+    Type:     STT_FILE
+  - Name:     Global
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_GLOBAL
+  - Name:     Weak
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test b/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test
index 05e1acf..8ae941f 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test
@@ -19,9 +19,8 @@
         Symbol: .L.rel
         Type:   R_X86_64_PC32
 Symbols:
-  Local:
-    - Name:     .L.rel
-      Type:     STT_FUNC
-      Section:  .text
+  - Name:     .L.rel
+    Type:     STT_FUNC
+    Section:  .text
 
 # CHECK: not stripping symbol '.L.rel' because it is named in a relocation.
diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test b/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test
index be489a2..ef8a293 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test
@@ -32,27 +32,26 @@
   - Name:            .LLVM.Custom.Section
     Type:            SHT_PROGBITS
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-    - Name:     .L.LocalSection
-      Type:     STT_SECTION
-      Section:  .text
-    - Type:     STT_SECTION
-      Section:  .LLVM.Custom.Section
-    - Name:     .L.LocalFile
-      Type:     STT_FILE
-    - Name:     .L.str
-      Type:     STT_OBJECT
-      Section:  .text
-    - Name:     .L.undefined
-    - Name:     .L.abs
-      Index:    SHN_ABS
-  Global:
-    - Name:     .L.Global
-      Type:     STT_FUNC
-      Section:  .text
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+  - Name:     .L.LocalSection
+    Type:     STT_SECTION
+    Section:  .text
+  - Type:     STT_SECTION
+    Section:  .LLVM.Custom.Section
+  - Name:     .L.LocalFile
+    Type:     STT_FILE
+  - Name:     .L.str
+    Type:     STT_OBJECT
+    Section:  .text
+  - Name:     .L.undefined
+  - Name:     .L.abs
+    Index:    SHN_ABS
+  - Name:     .L.Global
+    Type:     STT_FUNC
+    Section:  .text
+    Binding:  STB_GLOBAL
 
 # CHECK:      Symbols [
 # CHECK-NEXT:   Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test b/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test
index f9e0613..8bb39f6 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test
@@ -55,17 +55,16 @@
   - Name:            .text
     Type:            SHT_PROGBITS
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-    - Name:     .L.str
-      Type:     STT_OBJECT
-      Section:  .text
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Section:  .text
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+  - Name:     .L.str
+    Type:     STT_OBJECT
+    Section:  .text
+  - Name:     Global
+    Type:     STT_FUNC
+    Section:  .text
+    Binding:  STB_GLOBAL
 
 # CHECK:               Symbols [
 # CHECK-NEXT:            Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/globalize.test b/llvm/test/tools/llvm-objcopy/ELF/globalize.test
index bd7f38e..e1dcc04 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/globalize.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/globalize.test
@@ -31,25 +31,25 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-  Weak:
-    - Name:     Weak
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-    - Name:     WeakUndef
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     Global
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_GLOBAL
+  - Name:     Weak
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_WEAK
+  - Name:     WeakUndef
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test b/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test
index 43a6028..a954e08 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test
@@ -33,6 +33,5 @@
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
     AddressAlign:    0x0000000000000001
 Symbols:
-  Local:
-    - Name:            foo
-      Section:         .group
+  - Name:            foo
+    Section:         .group
diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test b/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test
index dd5ca88..e76e6e5 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test
@@ -38,19 +38,19 @@
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
     AddressAlign:    0x0000000000000010
 Symbols:
-  Local:           
-    - Name:            .text.bar
-      Type:            STT_SECTION
-      Section:         .text.bar
-    - Name:            .text.foo
-      Type:            STT_SECTION
-      Section:         .text.foo         
-  Weak:            
-    - Name:            bar
-      Type:            STT_FUNC
-      Section:         .text.bar
-      Size:            0x0000000000000000
-    - Name:            foo
-      Type:            STT_FUNC
-      Section:         .text.foo
-      Size:            0x0000000000000000
+  - Name:            .text.bar
+    Type:            STT_SECTION
+    Section:         .text.bar
+  - Name:            .text.foo
+    Type:            STT_SECTION
+    Section:         .text.foo
+  - Name:            bar
+    Type:            STT_FUNC
+    Section:         .text.bar
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
+  - Name:            foo
+    Type:            STT_FUNC
+    Section:         .text.foo
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test b/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test
index 31fba11..f5f74b4 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test
@@ -38,19 +38,19 @@
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     AddressAlign:    0x0000000000000010
 Symbols:
-  Local:           
-    - Name:            .text.foo
-      Type:            STT_SECTION
-      Section:         .text.foo         
-    - Name:            .text.bar
-      Type:            STT_SECTION
-      Section:         .text.bar
-  Weak:            
-    - Name:            foo
-      Type:            STT_FUNC
-      Section:         .text.foo
-      Size:            0x0000000000000000
-    - Name:            bar
-      Type:            STT_FUNC
-      Section:         .text.bar
-      Size:            0x0000000000000000
+  - Name:            .text.foo
+    Type:            STT_SECTION
+    Section:         .text.foo
+  - Name:            .text.bar
+    Type:            STT_SECTION
+    Section:         .text.bar
+  - Name:            foo
+    Type:            STT_FUNC
+    Section:         .text.foo
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
+  - Name:            bar
+    Type:            STT_FUNC
+    Section:         .text.bar
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
diff --git a/llvm/test/tools/llvm-objcopy/ELF/group.test b/llvm/test/tools/llvm-objcopy/ELF/group.test
index 2e058f5..ea84f25 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/group.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/group.test
@@ -38,19 +38,19 @@
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
     AddressAlign:    0x0000000000000010
 Symbols:
-  Local:           
-    - Name:            .text.bar
-      Type:            STT_SECTION
-      Section:         .text.bar
-    - Name:            .text.foo
-      Type:            STT_SECTION
-      Section:         .text.foo         
-  Weak:            
-    - Name:            bar
-      Type:            STT_FUNC
-      Section:         .text.bar
-      Size:            0x0000000000000000
-    - Name:            foo
-      Type:            STT_FUNC
-      Section:         .text.foo
-      Size:            0x0000000000000000
+  - Name:            .text.bar
+    Type:            STT_SECTION
+    Section:         .text.bar
+  - Name:            .text.foo
+    Type:            STT_SECTION
+    Section:         .text.foo
+  - Name:            bar
+    Type:            STT_FUNC
+    Section:         .text.bar
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
+  - Name:            foo
+    Type:            STT_FUNC
+    Section:         .text.foo
+    Size:            0x0000000000000000
+    Binding:         STB_WEAK
diff --git a/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test b/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test
index dab5eed..9787e6b 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test
@@ -8,8 +8,8 @@
   Type:            ET_EXEC
   Machine:         EM_X86_64
 Symbols:
-  Global:
-    - Name:     test
-      Index:    SHN_HEXAGON_SCOMMON
+  - Name:     test
+    Index:    SHN_HEXAGON_SCOMMON
+    Binding:  STB_GLOBAL
 
 # CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65280
diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test
index 3655f39..86674f1 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test
@@ -23,14 +23,13 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FILE
-      Section:  .text
-  Global:
-    - Name:     bar
-      Type:     STT_FUNC
-      Section:  .text
+  - Name:     foo
+    Type:     STT_FILE
+    Section:  .text
+  - Name:     bar
+    Type:     STT_FUNC
+    Section:  .text
+    Binding:  STB_GLOBAL
 
 #STRIPALL: Symbols [
 #STRIPALL-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test
index bc5cba6..b227407 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test
@@ -24,21 +24,22 @@
     Type:          SHT_PROGBITS
     Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
 Symbols:
-  Local:
-    - Name:        Local1
-      Section:     .text
-    - Name:        Local2
-      Section:     .text
-  Weak:
-    - Name:        Weak1
-      Section:     .text
-    - Name:        Weak2
-      Section:     .text
-  Global:
-    - Name:        Global1
-      Section:     .text
-    - Name:        Global2
-      Section:     .text
+  - Name:        Local1
+    Section:     .text
+  - Name:        Local2
+    Section:     .text
+  - Name:        Global1
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global2
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Weak1
+    Section:     .text
+    Binding:     STB_WEAK
+  - Name:        Weak2
+    Section:     .text
+    Binding:     STB_WEAK
 
 # CHECK:      Symbol table '.symtab' contains 7 entries:
 # CHECK-NEXT:    Num: Value Size Type Bind Vis Ndx Name
diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test
index e0b36ba..52707fc7 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test
@@ -56,34 +56,42 @@
     Type:          SHT_PROGBITS
     Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
 Symbols:
-  Local:
-    - Name:        Local1
-      Section:     .text
-    - Name:        Local2
-      Section:     .text
-  Weak:
-    - Name:        Weak1
-      Section:     .text
-    - Name:        Weak2
-      Section:     .text
-    - Name:        Weak3
-      Section:     .text
-  Global:
-    - Name:        Global1
-      Section:     .text
-    - Name:        Global2
-      Section:     .text
-    - Name:        Global3
-      Section:     .text
-    - Name:        Global4
-      Section:     .text
-    - Name:        Global5
-      Section:     .text
-    - Name:        Global6
-      Section:     .text
-    - Name:        "Global5 Global6"
-      Section:     .text
-    - Name:        Global7
+  - Name:        Local1
+    Section:     .text
+  - Name:        Local2
+    Section:     .text
+  - Name:        Global1
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global2
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global3
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global4
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global5
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global6
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        "Global5 Global6"
+    Section:     .text
+    Binding:     STB_GLOBAL
+  - Name:        Global7
+    Binding:     STB_GLOBAL
+  - Name:        Weak1
+    Section:     .text
+    Binding:     STB_WEAK
+  - Name:        Weak2
+    Section:     .text
+    Binding:     STB_WEAK
+  - Name:        Weak3
+    Section:     .text
+    Binding:     STB_WEAK
 
 # CHECK:      Symbol table '.symtab' contains 14 entries:
 # CHECK-NEXT:    Num: Value Size Type Bind Vis Ndx Name
diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test
index 2dbfb2c..8b5fc97 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test
@@ -16,12 +16,11 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test
index 67b5187..70a59fe 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test
@@ -27,22 +27,21 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-    - Name:     bar
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
-      Size:     8
-    - Name:     baz
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1010
-      Size:     8
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Size:     8
+  - Name:     baz
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1010
+    Size:     8
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test b/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test
index 4166200..f30461b 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test
@@ -29,53 +29,57 @@
         Symbol: undefGlobal
         Type:   R_X86_64_PC32
 Symbols:
-  Local:
-    - Name:     hiddenLocal
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
-      Size:     8
-      Visibility: STV_HIDDEN
-  Weak:
-    - Name:     hiddenWeak
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1010
-      Size:     8
-      Visibility: STV_HIDDEN
-  Global:
-    - Name:     defaultGlobal
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1000
-    - Name:     hiddenGlobal
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2006
-      Size:     2
-      Visibility: STV_HIDDEN
-    - Name:     hiddenGlobalCommon
-      Type:     STT_OBJECT
-      Index:    SHN_COMMON
-      Value:    0x2006
-      Size:     2
-      Visibility: STV_HIDDEN
-    - Name:     undefGlobal
-      Type:     STT_FUNC
-      Size:     8
-    - Name:     internalGlobal
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2002
-      Size:     2
-      Visibility: STV_INTERNAL
-    - Name:     protectedGlobal
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2000
-      Size:     4
-      Visibility: STV_PROTECTED
+  - Name:     hiddenLocal
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Size:     8
+    Visibility: STV_HIDDEN
+  - Name:     defaultGlobal
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1000
+    Binding:  STB_GLOBAL
+  - Name:     hiddenGlobal
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2006
+    Size:     2
+    Visibility: STV_HIDDEN
+    Binding:  STB_GLOBAL
+  - Name:     hiddenGlobalCommon
+    Type:     STT_OBJECT
+    Index:    SHN_COMMON
+    Value:    0x2006
+    Size:     2
+    Visibility: STV_HIDDEN
+    Binding:  STB_GLOBAL
+  - Name:     undefGlobal
+    Type:     STT_FUNC
+    Size:     8
+    Binding:  STB_GLOBAL
+  - Name:     internalGlobal
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2002
+    Size:     2
+    Visibility: STV_INTERNAL
+    Binding:  STB_GLOBAL
+  - Name:     protectedGlobal
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2000
+    Size:     4
+    Visibility: STV_PROTECTED
+    Binding:  STB_GLOBAL
+  - Name:     hiddenWeak
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1010
+    Size:     8
+    Visibility: STV_HIDDEN
+    Binding:  STB_WEAK
 
 #CHECK:     Relocations [
 #CHECK-NEXT:  Section (3) .rel.text {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/localize.test b/llvm/test/tools/llvm-objcopy/ELF/localize.test
index fb81231..820ce1d 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/localize.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/localize.test
@@ -42,31 +42,32 @@
     AddressAlign:    0x0000000000000010
     Content:         "0000000000000000"
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-  Weak:
-    - Name:     Weak
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
-    - Name:     GlobalUndef
-      Type:     STT_FUNC
-    - Name:     GlobalCommon
-      Type:     STT_OBJECT
-      Index:    SHN_COMMON
-      Value:    0x2006
-      Size:     2
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     Global
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_GLOBAL
+  - Name:     GlobalUndef
+    Type:     STT_FUNC
+    Binding:  STB_GLOBAL
+  - Name:     GlobalCommon
+    Type:     STT_OBJECT
+    Index:    SHN_COMMON
+    Value:    0x2006
+    Size:     2
+    Binding:  STB_GLOBAL
+  - Name:     Weak
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
index 1e6a54a..b359e5e 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
@@ -18,17 +18,16 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_SECTION
-      Section:  .text
-    - Name:     bar
-      Type:     STT_FILE
-      Section:  .text
-  Global:
-    - Name:     foobar
-      Type:     STT_FUNC
-      Section:  .text
+  - Name:     foo
+    Type:     STT_SECTION
+    Section:  .text
+  - Name:     bar
+    Type:     STT_FILE
+    Section:  .text
+  - Name:     foobar
+    Type:     STT_FUNC
+    Section:  .text
+    Binding:  STB_GLOBAL
 
 # COMMON: Symbols [
 # COMMON-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test
index 8ed8c85..78dd853 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test
@@ -33,20 +33,22 @@
     AddressAlign:    0x0000000000000010
     Content:         "0000000000000000"
 Symbols:
-  Global:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1004
-    - Name:     bar
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2000
-      Size:     4
-    - Name:     empty
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1004
+    Binding:  STB_GLOBAL
+  - Name:     bar
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2000
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     empty
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_GLOBAL
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/regex.test b/llvm/test/tools/llvm-objcopy/ELF/regex.test
index 6fa590b..9baccb0 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/regex.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/regex.test
@@ -30,22 +30,21 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foobaz
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-    - Name:     bar
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
-      Size:     8
-    - Name:     rebar
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1010
-      Size:     8
+  - Name:     foobaz
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Size:     8
+  - Name:     rebar
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1010
+    Size:     8
 
 #REGEX1-NOT: foobaz
 #REGEX1-NOT: bar
diff --git a/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test b/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test
index 539e6ea..ff05778 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test
@@ -24,9 +24,9 @@
         Type:   R_X86_64_PC32
 
 Symbols:
-  Global:
-    - Name:     foo
-      Type:     STT_FUNC
-      Size:     4
+  - Name:     foo
+    Type:     STT_FUNC
+    Size:     4
+    Binding:  STB_GLOBAL
 
 # CHECK: Symbol table .symtab cannot be removed because it is referenced by the relocation section .rel.text.
diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test
index 949d34c..598da16 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test
@@ -16,17 +16,18 @@
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC ]
 Symbols:
-  Global:
-    - Name:     test
-      Type:     STT_FUNC
-      Section:  .test
-      Value:    0x1000
-      Size:     4
-    - Name:     test2
-      Type:     STT_FUNC
-      Section:  .test2
-      Value:    0x1000
-      Size:     4
+  - Name:     test
+    Type:     STT_FUNC
+    Section:  .test
+    Value:    0x1000
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     test2
+    Type:     STT_FUNC
+    Section:  .test2
+    Value:    0x1000
+    Size:     4
+    Binding:  STB_GLOBAL
 
 # The sections counted here should be .test, .symtab, .strtab, and .shstrtab.
 # The 5th section is the null section.
diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test
index 6c22eb8..2df9e3a 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test
@@ -51,7 +51,6 @@
                        SHF_OS_NONCONFORMING, SHF_STRINGS, SHF_TLS, SHF_WRITE ]
     Content:        "a4a4a4a4"
 Symbols:
-  Local:
   - Name:            dummy
     Section:         .group
 
diff --git a/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test b/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test
index 1a69757..f01fea8 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test
@@ -8,8 +8,8 @@
   Type:            ET_EXEC
   Machine:         EM_X86_64
 Symbols:
-  Global:
-    - Name:     test
-      Index:    0xff05
+  - Name:     test
+    Index:    0xff05
+    Binding:  STB_GLOBAL
 
 # CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65285
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test
index 9892a12..8ff1aa4 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test
@@ -32,22 +32,21 @@
   - Name:            .debug_bar
     Type:            SHT_PROGBITS
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-    - Name:     bar
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
-      Size:     8
-    - Name:     baz
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1010
-      Size:     8
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Size:     8
+  - Name:     baz
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1010
+    Size:     8
 
 # CHECK:     Name: .text
 # CHECK:     Name: .gnu.warning.foo
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test
index 5455c6b..15a6f4f 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test
@@ -28,14 +28,16 @@
     AddressAlign:    0x0000000000000010
     Content:         "00000000"
 Symbols:
-  Global:
-    - Name: debugfoo
-      Section: .debug_foo
-    - Name: foo
-      Section: .text
-    - Name: bar
-      Section: .text.bar
- 
+  - Name:    debugfoo
+    Section: .debug_foo
+    Binding:  STB_GLOBAL
+  - Name:    foo
+    Section: .text
+    Binding:  STB_GLOBAL
+  - Name:    bar
+    Section: .text.bar
+    Binding:  STB_GLOBAL
+
 # CHECK: SectionHeaderCount: 3
 
 # CHECK:     Name: .text
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test b/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test
index d2d0b34..da76592 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test
@@ -28,14 +28,16 @@
     AddressAlign:    0x0000000000000010
     Content:         "00000000"
 Symbols:
-  Global:
-    - Name: debugfoo
-      Section: .debug_foo
-    - Name: foo
-      Section: .text
-    - Name: bar
-      Section: .text.bar
- 
+  - Name:    debugfoo
+    Section: .debug_foo
+    Binding:  STB_GLOBAL
+  - Name:    foo
+    Section: .text
+    Binding:  STB_GLOBAL
+  - Name:    bar
+    Section: .text.bar
+    Binding:  STB_GLOBAL
+
 # CHECK: SectionHeaderCount: 5
 
 # CHECK:     Name: .text
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test b/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test
index d7079f6..c4440bf 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test
@@ -110,11 +110,12 @@
     AddressAlign:    0x0000000000000010
     Content:         "00000000"
 Symbols:
-  Global:
-    - Name: foo
-      Section: .text
-    - Name: debugfoo
-      Section: .debugfoo
+  - Name:    foo
+    Section: .text
+    Binding:  STB_GLOBAL
+  - Name:    debugfoo
+    Section: .debugfoo
+    Binding:  STB_GLOBAL
 
 # CHECK: SectionHeaderCount: 5
 
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test
index 0699a9f..d727ec6 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test
@@ -23,9 +23,9 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Weak:
-    - Name:            foo
-      Type:            STT_FUNC
-      Section:         .text
+  - Name:    foo
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_WEAK
 
 #CHECK: Symbol foo cannot be removed because it is referenced by the section .group[1].
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test b/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test
index dcbd57e..f2b6e56 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test
@@ -39,17 +39,16 @@
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1234
-      Size:     8
-    - Name:     bar
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x5678
-      Size:     8
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1234
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x5678
+    Size:     8
 
 # CHECK:      Symbols [
 # CHECK-NEXT:   Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test
index b492405..db1e46c 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test
@@ -22,11 +22,10 @@
         Symbol: foo
         Type:   R_X86_64_PC32
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
 
 #CHECK: not stripping symbol 'foo' because it is named in a relocation.
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test b/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test
index 9bcea10..25e93ae 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test
@@ -43,9 +43,7 @@
     AddressAlign:    0x0000000000000001
     Content:         '0102'
 Symbols:         
-  Local:           
-    - Name:            foo
-      Section:         .data
-      Value:           0x0000000000000001
-DynamicSymbols:  {}
+  - Name:            foo
+    Section:         .data
+    Value:           0x0000000000000001
 ...
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test
index dfe2598..007acfb 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test
@@ -43,6 +43,6 @@
         Symbol:          bar
         Type:            R_X86_64_32S
 Symbols:
-  Global:
-    - Name:     bar
-      Section:  .text
+  - Name:     bar
+    Section:  .text
+    Binding:  STB_GLOBAL
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test
index 73d3c1c..e63aaae 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test
@@ -28,24 +28,23 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-  Weak:
-    - Name:     bar
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-  Global:
-    - Name:     baz
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_WEAK
+  - Name:     baz
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_GLOBAL
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test
index 60d8388..db1ad31 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test
@@ -57,42 +57,43 @@
         Symbol: foo
         Type:   R_X86_64_PC32
 Symbols:
-  Local:
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-    - Name:     bar
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-    - Name:     barfoo
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
-    - Name:     fileSymbol
-      Type:     STT_FILE
-    - Name:     sectionSymbol
-      Type:     STT_SECTION
-  Weak:
-    - Name:     baz
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1018
-    - Name:     foobaz
-      Type:     STT_FUNC
-  Global:
-    - Name:     foobar
-      Type:     STT_FUNC
-    - Name:     barbaz
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1020
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     bar
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+  - Name:     barfoo
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+  - Name:     fileSymbol
+    Type:     STT_FILE
+  - Name:     sectionSymbol
+    Type:     STT_SECTION
+  - Name:     foobar
+    Type:     STT_FUNC
+    Binding:  STB_GLOBAL
+  - Name:     barbaz
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1020
+    Binding:  STB_GLOBAL
+  - Name:     baz
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1018
+    Binding:  STB_WEAK
+  - Name:     foobaz
+    Type:     STT_FUNC
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test b/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test
index 4332868..26408ca 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test
@@ -22,38 +22,43 @@
     AddressAlign:    0x0000000000000010
     Content:         "0000000000000000"
 Symbols:
-  Global:
-    - Name:     _start
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     4
-    - Name:     bam
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1001
-      Size:     4
-      Visibility: STV_HIDDEN
-    - Name:     foo
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1004
-    - Name:     faz
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2002
-      Size:     2
-      Visibility: STV_INTERNAL
-    - Name:     bar
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2000
-      Size:     4
-    - Name:     baz
-      Type:     STT_OBJECT
-      Section:  .data
-      Value:    0x2004
-      Size:     4
+  - Name:     _start
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     bam
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1001
+    Size:     4
+    Visibility: STV_HIDDEN
+    Binding:  STB_GLOBAL
+  - Name:     foo
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1004
+    Binding:  STB_GLOBAL
+  - Name:     faz
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2002
+    Size:     2
+    Visibility: STV_INTERNAL
+    Binding:  STB_GLOBAL
+  - Name:     bar
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2000
+    Size:     4
+    Binding:  STB_GLOBAL
+  - Name:     baz
+    Type:     STT_OBJECT
+    Section:  .data
+    Value:    0x2004
+    Size:     4
+    Binding:  STB_GLOBAL
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test b/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test
index e378c23..cc17b3e 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test
@@ -37,11 +37,10 @@
     Type:  SHT_PROGBITS
     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
 Symbols:
-  Local:
-    - Name:    ""
-      Type:    STT_SECTION
-      Section: .text
-  Global:
-  # We need to have a named symbol, otherwise the original
-  # issue that was fixed is not reproduced by this test.
-    - Name: foo
+  - Name:    ""
+    Type:    STT_SECTION
+    Section: .text
+# We need to have a named symbol, otherwise the original
+# issue that was fixed is not reproduced by this test.
+  - Name:    foo
+    Binding: STB_GLOBAL
diff --git a/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test b/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test
index 6107d37..ab83c65 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test
@@ -23,27 +23,27 @@
         Symbol: undefGlobal
         Type:   R_X86_64_PC32
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1008
-      Size:     8
-  Weak:
-    - Name:     Weak
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1018
-    - Name:     undefGlobal
-      Type:     STT_FUNC
-      Size:     8
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1008
+    Size:     8
+  - Name:     Global
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1018
+    Binding:  STB_GLOBAL
+  - Name:     undefGlobal
+    Type:     STT_FUNC
+    Size:     8
+    Binding:  STB_GLOBAL
+  - Name:     Weak
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {
diff --git a/llvm/test/tools/llvm-objcopy/ELF/weaken.test b/llvm/test/tools/llvm-objcopy/ELF/weaken.test
index 01de61a..09f2476 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/weaken.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/weaken.test
@@ -28,24 +28,23 @@
     AddressAlign:    0x0000000000000010
     Size:            64
 Symbols:
-  Local:
-    - Name:     Local
-      Type:     STT_FUNC
-      Section:  .text
-      Value:    0x1000
-      Size:     8
-  Weak:
-    - Name:     Weak
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1008
-  Global:
-    - Name:     Global
-      Type:     STT_FUNC
-      Size:     8
-      Section:  .text
-      Value:    0x1010
+  - Name:     Local
+    Type:     STT_FUNC
+    Section:  .text
+    Value:    0x1000
+    Size:     8
+  - Name:     Global
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1010
+    Binding:  STB_GLOBAL
+  - Name:     Weak
+    Type:     STT_FUNC
+    Size:     8
+    Section:  .text
+    Value:    0x1008
+    Binding:  STB_WEAK
 
 #CHECK: Symbols [
 #CHECK-NEXT:  Symbol {