[llvm] 6c1d72b - [llvm-readobj][llvm-objdump] - Cleanup testing of dynamic tags dumping.

Georgii Rymar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 00:18:14 PST 2019


Author: Georgii Rymar
Date: 2019-12-19T11:17:25+03:00
New Revision: 6c1d72b03963a9455ff8a272c6f5be3e8e48cb49

URL: https://github.com/llvm/llvm-project/commit/6c1d72b03963a9455ff8a272c6f5be3e8e48cb49
DIFF: https://github.com/llvm/llvm-project/commit/6c1d72b03963a9455ff8a272c6f5be3e8e48cb49.diff

LOG: [llvm-readobj][llvm-objdump] - Cleanup testing of dynamic tags dumping.

We have the `elf-dynamic-tags-machine-specific.yaml` input shared
between the llvm-readobj and llvm-objdump test.
It looks strange, because tools usually does not share inputs.

Also there are following problems related:
1) `elf-dynamic-tags-machine-specific.yaml` input contains excessive YAML parts.
2) objdump's test case never test AARCH64 tags.
3) There are unknown tags in the `elf-dynamic-tags-machine-specific.yaml` and
    `dynamic-tags-machine-specific.test`, though we already testing unknown tags
    in `\llvm-readobj\ELF\dynamic-tags.test` and `llvm-objdump\elf-dynamic-section.test` tests.

This patch removes the shared input and refines the test cases to resolve
issues mentioned.

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

Added: 
    

Modified: 
    llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test
    llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test

Removed: 
    llvm/test/tools/llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test b/llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test
index e5780e0bcdac..36a096706fbf 100644
--- a/llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test
+++ b/llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test
@@ -1,88 +1,292 @@
-## Test that hexagon machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=1 -o %t.hex \
-# RUN:          %S/../llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
+## In this test we test how machine-specific dynamic tags are dumped.
+
+## Case 1: Test that hexagon machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=1 -o %t.hex %s
 # RUN: llvm-objdump -p %t.hex | FileCheck %s --check-prefix=HEXAGON
 
 # HEXAGON:      Dynamic Section:
-# HEXAGON-NEXT:   HASH                 0x0000000000001000
-# HEXAGON-NEXT:   HEXAGON_SYMSZ        0x0000000000000010
-# HEXAGON-NEXT:   HEXAGON_VER          0x0000000000001000
-# HEXAGON-NEXT:   HEXAGON_PLT          0x0000000000001000
-# HEXAGON-NEXT:   <unknown:>0x1234abcd 0x0000000000000001
+# HEXAGON-NEXT:  HEXAGON_SYMSZ 0x0000000000000010
+# HEXAGON-NEXT:  HEXAGON_VER   0x0000000000001000
+# HEXAGON-NEXT:  HEXAGON_PLT   0x0000000000001000
 
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_HEXAGON
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_HEXAGON_SYMSZ
+        Value: 0x10
+      - Tag:   DT_HEXAGON_VER
+        Value: 0x1000
+      - Tag:   DT_HEXAGON_PLT
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
 
-## Test that MIPS machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=2 -o %t.mips \
-# RUN:          %S/../llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
+## Case 2: Test that MIPS machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=2 -o %t.mips %s
 # RUN: llvm-objdump -p %t.mips | FileCheck %s --check-prefix=MIPS
 
 # MIPS:      Dynamic Section:
-# MIPS-NEXT:   HASH                 0x0000000000001000
-# MIPS-NEXT:   MIPS_RLD_VERSION     0x0000000012345678
-# MIPS-NEXT:   MIPS_TIME_STAMP      0x0000000011223344
-# MIPS-NEXT:   MIPS_ICHECKSUM       0x0000000011112222
-# MIPS-NEXT:   MIPS_IVERSION        0x0000000000000001
-# MIPS-NEXT:   MIPS_FLAGS           0x0000000011111111
-# MIPS-NEXT:   MIPS_BASE_ADDRESS    0x0000000087654321
-# MIPS-NEXT:   MIPS_MSYM            0x0000000000001000
-# MIPS-NEXT:   MIPS_CONFLICT        0x0000000000001000
-# MIPS-NEXT:   MIPS_LIBLIST         0x0000000000001000
-# MIPS-NEXT:   MIPS_LOCAL_GOTNO     0x0000000000000001
-# MIPS-NEXT:   MIPS_CONFLICTNO      0x0000000000000001
-# MIPS-NEXT:   MIPS_LIBLISTNO       0x0000000000000001
-# MIPS-NEXT:   MIPS_SYMTABNO        0x0000000000000001
-# MIPS-NEXT:   MIPS_UNREFEXTNO      0x0000000000000000
-# MIPS-NEXT:   MIPS_GOTSYM          0x0000000000000000
-# MIPS-NEXT:   MIPS_HIPAGENO        0x0000000088776655
-# MIPS-NEXT:   MIPS_RLD_MAP         0x0000000000001000
-# MIPS-NEXT:   MIPS_DELTA_CLASS     0x0000000000001000
-# MIPS-NEXT:   MIPS_DELTA_CLASS_NO  0x0000000000000001
-# MIPS-NEXT:   MIPS_DELTA_INSTANCE  0x0000000000001000
+# MIPS-NEXT:   MIPS_RLD_VERSION           0x0000000012345678
+# MIPS-NEXT:   MIPS_TIME_STAMP            0x0000000011223344
+# MIPS-NEXT:   MIPS_ICHECKSUM             0x0000000011112222
+# MIPS-NEXT:   MIPS_IVERSION              0x0000000000000001
+# MIPS-NEXT:   MIPS_FLAGS                 0x0000000011111111
+# MIPS-NEXT:   MIPS_BASE_ADDRESS          0x0000000087654321
+# MIPS-NEXT:   MIPS_MSYM                  0x0000000000001000
+# MIPS-NEXT:   MIPS_CONFLICT              0x0000000000001000
+# MIPS-NEXT:   MIPS_LIBLIST               0x0000000000001000
+# MIPS-NEXT:   MIPS_LOCAL_GOTNO           0x0000000000000001
+# MIPS-NEXT:   MIPS_CONFLICTNO            0x0000000000000001
+# MIPS-NEXT:   MIPS_LIBLISTNO             0x0000000000000001
+# MIPS-NEXT:   MIPS_SYMTABNO              0x0000000000000001
+# MIPS-NEXT:   MIPS_UNREFEXTNO            0x0000000000000000
+# MIPS-NEXT:   MIPS_GOTSYM                0x0000000000000000
+# MIPS-NEXT:   MIPS_HIPAGENO              0x0000000088776655
+# MIPS-NEXT:   MIPS_RLD_MAP               0x0000000000001000
+# MIPS-NEXT:   MIPS_DELTA_CLASS           0x0000000000001000
+# MIPS-NEXT:   MIPS_DELTA_CLASS_NO        0x0000000000000001
+# MIPS-NEXT:   MIPS_DELTA_INSTANCE        0x0000000000001000
+## FIXME: llvm-objdump does not print spaces after MIPS_DELTA_INSTANCE_NO, MIPS_PROTECTED_GOTIDX
+##        and other long tags. The output looks broken because of that.
 # MIPS-NEXT:   MIPS_DELTA_INSTANCE_NO0x0000000000000001
-# MIPS-NEXT:   MIPS_DELTA_RELOC     0x0000000000001000
-# MIPS-NEXT:   MIPS_DELTA_RELOC_NO  0x0000000000000001
-# MIPS-NEXT:   MIPS_DELTA_SYM       0x0000000000001000
-# MIPS-NEXT:   MIPS_DELTA_SYM_NO    0x0000000000000001
-# MIPS-NEXT:   MIPS_DELTA_CLASSSYM  0x0000000000001000
+# MIPS-NEXT:   MIPS_DELTA_RELOC           0x0000000000001000
+# MIPS-NEXT:   MIPS_DELTA_RELOC_NO        0x0000000000000001
+# MIPS-NEXT:   MIPS_DELTA_SYM             0x0000000000001000
+# MIPS-NEXT:   MIPS_DELTA_SYM_NO          0x0000000000000001
+# MIPS-NEXT:   MIPS_DELTA_CLASSSYM        0x0000000000001000
 # MIPS-NEXT:   MIPS_DELTA_CLASSSYM_NO0x0000000000000001
-# MIPS-NEXT:   MIPS_CXX_FLAGS       0x0000000088887777
-# MIPS-NEXT:   MIPS_PIXIE_INIT      0x0000000000001000
+# MIPS-NEXT:   MIPS_CXX_FLAGS             0x0000000088887777
+# MIPS-NEXT:   MIPS_PIXIE_INIT            0x0000000000001000
 # MIPS-NEXT:   MIPS_LOCALPAGE_GOTIDX0x0000000000000001
-# MIPS-NEXT:   MIPS_LOCAL_GOTIDX    0x0000000000000001
-# MIPS-NEXT:   MIPS_HIDDEN_GOTIDX   0x0000000000000001
+# MIPS-NEXT:   MIPS_LOCAL_GOTIDX          0x0000000000000001
+# MIPS-NEXT:   MIPS_HIDDEN_GOTIDX         0x0000000000000001
 # MIPS-NEXT:   MIPS_PROTECTED_GOTIDX0x0000000000000001
-# MIPS-NEXT:   MIPS_OPTIONS         0x0000000000001000
-# MIPS-NEXT:   MIPS_INTERFACE       0x0000000000001000
-# MIPS-NEXT:   MIPS_DYNSTR_ALIGN    0x0000000088888888
-# MIPS-NEXT:   MIPS_INTERFACE_SIZE  0x0000000000000010
+# MIPS-NEXT:   MIPS_OPTIONS               0x0000000000001000
+# MIPS-NEXT:   MIPS_INTERFACE             0x0000000000001000
+# MIPS-NEXT:   MIPS_DYNSTR_ALIGN          0x0000000088888888
+# MIPS-NEXT:   MIPS_INTERFACE_SIZE        0x0000000000000010
 # MIPS-NEXT:   MIPS_RLD_TEXT_RESOLVE_ADDR0x0000000000000008
-# MIPS-NEXT:   MIPS_PERF_SUFFIX     0x0000000000000000
-# MIPS-NEXT:   MIPS_COMPACT_SIZE    0x0000000000000010
-# MIPS-NEXT:   MIPS_GP_VALUE        0x0000000000000001
-# MIPS-NEXT:   MIPS_AUX_DYNAMIC     0x0000000000001000
-# MIPS-NEXT:   MIPS_PLTGOT          0x0000000000001000
-# MIPS-NEXT:   MIPS_RWPLT           0x0000000000001000
-# MIPS-NEXT:   MIPS_RLD_MAP_REL     0x0000000000001000
-# MIPS-NEXT:   <unknown:>0x1234abcd 0x0000000000000001
+# MIPS-NEXT:   MIPS_PERF_SUFFIX           0x0000000000000000
+# MIPS-NEXT:   MIPS_COMPACT_SIZE          0x0000000000000010
+# MIPS-NEXT:   MIPS_GP_VALUE              0x0000000000000001
+# MIPS-NEXT:   MIPS_AUX_DYNAMIC           0x0000000000001000
+# MIPS-NEXT:   MIPS_PLTGOT                0x0000000000001000
+# MIPS-NEXT:   MIPS_RWPLT                 0x0000000000001000
+# MIPS-NEXT:   MIPS_RLD_MAP_REL           0x0000000000001000
 
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_MIPS
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_MIPS_RLD_VERSION
+        Value: 0x12345678
+      - Tag:   DT_MIPS_TIME_STAMP
+        Value: 0x11223344
+      - Tag:   DT_MIPS_ICHECKSUM
+        Value: 0x11112222
+      - Tag:   DT_MIPS_IVERSION
+        Value: 0x1
+      - Tag:   DT_MIPS_FLAGS
+        Value: 0x11111111
+      - Tag:   DT_MIPS_BASE_ADDRESS
+        Value: 0x87654321
+      - Tag:   DT_MIPS_MSYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_CONFLICT
+        Value: 0x1000
+      - Tag:   DT_MIPS_LIBLIST
+        Value: 0x1000
+      - Tag:   DT_MIPS_LOCAL_GOTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_CONFLICTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_LIBLISTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_SYMTABNO
+        Value: 0x1
+      - Tag:   DT_MIPS_UNREFEXTNO
+        Value: 0x0
+      - Tag:   DT_MIPS_GOTSYM
+        Value: 0x0
+      - Tag:   DT_MIPS_HIPAGENO
+        Value: 0x88776655
+      - Tag:   DT_MIPS_RLD_MAP
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASS
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASS_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_INSTANCE
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_INSTANCE_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_RELOC
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_RELOC_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_SYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_SYM_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_CLASSSYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASSSYM_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_CXX_FLAGS
+        Value: 0x88887777
+      - Tag:   DT_MIPS_PIXIE_INIT
+        Value: 0x1000
+      - Tag:   DT_MIPS_LOCALPAGE_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_LOCAL_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_HIDDEN_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_PROTECTED_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_OPTIONS
+        Value: 0x1000
+      - Tag:   DT_MIPS_INTERFACE
+        Value: 0x1000
+      - Tag:   DT_MIPS_DYNSTR_ALIGN
+        Value: 0x88888888
+      - Tag:   DT_MIPS_INTERFACE_SIZE
+        Value: 0x10
+      - Tag:   DT_MIPS_RLD_TEXT_RESOLVE_ADDR
+        Value: 0x8
+      - Tag:   DT_MIPS_PERF_SUFFIX
+        Value: 0x0
+      - Tag:   DT_MIPS_COMPACT_SIZE
+        Value: 0x10
+      - Tag:   DT_MIPS_GP_VALUE
+        Value: 0x1
+      - Tag:   DT_MIPS_AUX_DYNAMIC
+        Value: 0x1000
+      - Tag:   DT_MIPS_PLTGOT
+        Value: 0x1000
+      - Tag:   DT_MIPS_RWPLT
+        Value: 0x1000
+      - Tag:   DT_MIPS_RLD_MAP_REL
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
 
-## Test that PPC machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=3 -o %t.ppc \
-# RUN:          %S/../llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
+## Case 3: Test that PPC machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=3 -o %t.ppc %s
 # RUN: llvm-objdump -p %t.ppc | FileCheck %s --check-prefix=PPC
 
 # PPC:      Dynamic Section:
-# PPC-NEXT:   PPC_GOT              0x000200c0
-# PPC-NEXT:   PPC_OPT              0x00000001
-# PPC-NEXT:   <unknown:>0x1234abcd 0x00000001
+# PPC-NEXT:  PPC_GOT 0x000200c0
+# PPC-NEXT:  PPC_OPT 0x00000001
 
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2MSB
+  Type:    ET_EXEC
+  Machine: EM_PPC
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_PPC_GOT
+        Value: 0x200c0
+      - Tag:   DT_PPC_OPT
+        Value: 1
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
 
-## Test that PPC64 machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=4 -o %t.ppc64 \
-# RUN:          %S/../llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
+## Case 4: Test that PPC64 machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=4 -o %t.ppc64 %s
 # RUN: llvm-objdump -p %t.ppc64 | FileCheck %s --check-prefix=PPC64
 
 # PPC64:      Dynamic Section:
-# PPC64-NEXT:   HASH                 0x0000000000001000
-# PPC64-NEXT:   PPC64_GLINK          0x0000000000001000
-# PPC64-NEXT:   <unknown:>0x1234abcd 0x0000000000000001
+# PPC64-NEXT:  PPC64_GLINK 0x0000000000001000
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_PPC64
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_PPC64_GLINK
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
+
+## Case 5: Test that AARCH64 machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=5 -o %t.aarch64 %s
+# RUN: llvm-objdump -p %t.aarch64 | FileCheck %s --check-prefix=AARCH64
+
+# AARCH64:      Dynamic Section:
+# AARCH64-NEXT:  AARCH64_BTI_PLT      0x0000000000000001
+# AARCH64-NEXT:  AARCH64_PAC_PLT      0x0000000000000002
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_AARCH64
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_AARCH64_BTI_PLT
+        Value: 1
+      - Tag:   DT_AARCH64_PAC_PLT
+        Value: 2
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic

diff  --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml b/llvm/test/tools/llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
deleted file mode 100644
index 222b8723e116..000000000000
--- a/llvm/test/tools/llvm-readobj/ELF/Inputs/elf-dynamic-tags-machine-specific.yaml
+++ /dev/null
@@ -1,276 +0,0 @@
-# Used by llvm-readobj/elf-dynamic-tags-machine-specific.test and
-# llvm-objdump/elf-dynamic-section-machine-specific.test.
-
-# First document: Hexagon
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_EXEC
-  Machine: EM_HEXAGON
-Sections:
-  - Name:    .dynstr
-    Type:    SHT_STRTAB
-    Address: 0x1000
-    Size:    0x10
-    Content: "004400550066007700"
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Address: 0x1010
-    Entries:
-      - Tag:   DT_HASH
-        Value: 0x1000
-      - Tag:   DT_HEXAGON_SYMSZ
-        Value: 0x10
-      - Tag:   DT_HEXAGON_VER
-        Value: 0x1000
-      - Tag:   DT_HEXAGON_PLT
-        Value: 0x1000
-      - Tag:   0x1234abcd
-        Value: 0x1
-      - Tag:   DT_NULL
-        Value: 0
-ProgramHeaders:
-  - Type: PT_LOAD
-    VAddr: 0x1000
-    Sections:
-      - Section: .dynstr
-      - Section: .dynamic
-  - Type: PT_DYNAMIC
-    VAddr: 0x1010
-    Sections:
-      - Section: .dynamic
-
-# Second document: MIPS
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_EXEC
-  Machine: EM_MIPS
-Sections:
-  - Name:    .dynstr
-    Type:    SHT_STRTAB
-    Address: 0x1000
-    Size:    0x10
-    Content: "004400550066007700"
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Address: 0x1010
-    Entries:
-      - Tag:   DT_HASH
-        Value: 0x1000
-      - Tag:   DT_MIPS_RLD_VERSION
-        Value: 0x12345678
-      - Tag:   DT_MIPS_TIME_STAMP
-        Value: 0x11223344
-      - Tag:   DT_MIPS_ICHECKSUM
-        Value: 0x11112222
-      - Tag:   DT_MIPS_IVERSION
-        Value: 0x1
-      - Tag:   DT_MIPS_FLAGS
-        Value: 0x11111111
-      - Tag:   DT_MIPS_BASE_ADDRESS
-        Value: 0x87654321
-      - Tag:   DT_MIPS_MSYM
-        Value: 0x1000
-      - Tag:   DT_MIPS_CONFLICT
-        Value: 0x1000
-      - Tag:   DT_MIPS_LIBLIST
-        Value: 0x1000
-      - Tag:   DT_MIPS_LOCAL_GOTNO
-        Value: 0x1
-      - Tag:   DT_MIPS_CONFLICTNO
-        Value: 0x1
-      - Tag:   DT_MIPS_LIBLISTNO
-        Value: 0x1
-      - Tag:   DT_MIPS_SYMTABNO
-        Value: 0x1
-      - Tag:   DT_MIPS_UNREFEXTNO
-        Value: 0x0
-      - Tag:   DT_MIPS_GOTSYM
-        Value: 0x0
-      - Tag:   DT_MIPS_HIPAGENO
-        Value: 0x88776655
-      - Tag:   DT_MIPS_RLD_MAP
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_CLASS
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_CLASS_NO
-        Value: 0x1
-      - Tag:   DT_MIPS_DELTA_INSTANCE
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_INSTANCE_NO
-        Value: 0x1
-      - Tag:   DT_MIPS_DELTA_RELOC
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_RELOC_NO
-        Value: 0x1
-      - Tag:   DT_MIPS_DELTA_SYM
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_SYM_NO
-        Value: 0x1
-      - Tag:   DT_MIPS_DELTA_CLASSSYM
-        Value: 0x1000
-      - Tag:   DT_MIPS_DELTA_CLASSSYM_NO
-        Value: 0x1
-      - Tag:   DT_MIPS_CXX_FLAGS
-        Value: 0x88887777
-      - Tag:   DT_MIPS_PIXIE_INIT
-        Value: 0x1000
-      - Tag:   DT_MIPS_LOCALPAGE_GOTIDX
-        Value: 0x1
-      - Tag:   DT_MIPS_LOCAL_GOTIDX
-        Value: 0x1
-      - Tag:   DT_MIPS_HIDDEN_GOTIDX
-        Value: 0x1
-      - Tag:   DT_MIPS_PROTECTED_GOTIDX
-        Value: 0x1
-      - Tag:   DT_MIPS_OPTIONS
-        Value: 0x1000
-      - Tag:   DT_MIPS_INTERFACE
-        Value: 0x1000
-      - Tag:   DT_MIPS_DYNSTR_ALIGN
-        Value: 0x88888888
-      - Tag:   DT_MIPS_INTERFACE_SIZE
-        Value: 0x10
-      - Tag:   DT_MIPS_RLD_TEXT_RESOLVE_ADDR
-        Value: 0x8
-      - Tag:   DT_MIPS_PERF_SUFFIX
-        Value: 0x0
-      - Tag:   DT_MIPS_COMPACT_SIZE
-        Value: 0x10
-      - Tag:   DT_MIPS_GP_VALUE
-        Value: 0x1
-      - Tag:   DT_MIPS_AUX_DYNAMIC
-        Value: 0x1000
-      - Tag:   DT_MIPS_PLTGOT
-        Value: 0x1000
-      - Tag:   DT_MIPS_RWPLT
-        Value: 0x1000
-      - Tag:   DT_MIPS_RLD_MAP_REL
-        Value: 0x1000
-      - Tag:   0x1234abcd
-        Value: 0x1
-      - Tag:   DT_NULL
-        Value: 0
-ProgramHeaders:
-  - Type: PT_LOAD
-    VAddr: 0x1000
-    Sections:
-      - Section: .dynstr
-      - Section: .dynamic
-  - Type: PT_DYNAMIC
-    VAddr: 0x1010
-    Sections:
-      - Section: .dynamic
-
-# Third document: PPC
---- !ELF
-FileHeader:
-  Class:   ELFCLASS32
-  Data:    ELFDATA2MSB
-  Type:    ET_EXEC
-  Machine: EM_PPC
-Sections:
-  - Name:    .dynstr
-    Type:    SHT_STRTAB
-    Address: 0x200
-    Size:    0x10
-    Content: "004400550066007700"
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Address: 0x20000
-    Entries:
-      - Tag:   DT_PPC_GOT
-        Value: 0x200c0
-      - Tag:   DT_PPC_OPT
-        Value: 1
-      - Tag:   0x1234abcd
-        Value: 0x1
-      - Tag:   DT_NULL
-        Value: 0
-ProgramHeaders:
-  - Type: PT_LOAD
-    VAddr: 0x1000
-    Sections:
-      - Section: .dynstr
-      - Section: .dynamic
-  - Type: PT_DYNAMIC
-    VAddr: 0x20000
-    Sections:
-      - Section: .dynamic
-
-# Fourth document: PPC64
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_EXEC
-  Machine: EM_PPC64
-Sections:
-  - Name:    .dynstr
-    Type:    SHT_STRTAB
-    Address: 0x1000
-    Size:    0x10
-    Content: "004400550066007700"
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Address: 0x1010
-    Entries:
-      - Tag:   DT_HASH
-        Value: 0x1000
-      - Tag:   DT_PPC64_GLINK
-        Value: 0x1000
-      - Tag:   0x1234abcd
-        Value: 0x1
-      - Tag:   DT_NULL
-        Value: 0
-ProgramHeaders:
-  - Type: PT_LOAD
-    VAddr: 0x1000
-    Sections:
-      - Section: .dynstr
-      - Section: .dynamic
-  - Type: PT_DYNAMIC
-    VAddr: 0x1010
-    Sections:
-      - Section: .dynamic
-
-# Fourth document: AARCH64
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_EXEC
-  Machine: EM_AARCH64
-Sections:
-  - Name:    .dynstr
-    Type:    SHT_STRTAB
-    Address: 0x1000
-    Size:    0x10
-    Content: "004400550066007700"
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Address: 0x1010
-    Entries:
-      - Tag:   DT_HASH
-        Value: 0x1000
-      - Tag:   DT_AARCH64_BTI_PLT
-        Value: 0
-      - Tag:   DT_AARCH64_PAC_PLT
-        Value: 0
-      - Tag:   0x1234abcd
-        Value: 0x1
-      - Tag:   DT_NULL
-        Value: 0
-ProgramHeaders:
-  - Type: PT_LOAD
-    VAddr: 0x1000
-    Sections:
-      - Section: .dynstr
-      - Section: .dynamic
-  - Type: PT_DYNAMIC
-    VAddr: 0x1010
-    Sections:
-      - Section: .dynamic

diff  --git a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
index cebb1cbac721..6d75028f095f 100644
--- a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
+++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
@@ -1,34 +1,57 @@
-# Test that hexagon machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=1 %S/Inputs/elf-dynamic-tags-machine-specific.yaml -o %t.hex
+## In this test we test how machine-specific dynamic tags are dumped.
+
+## Case 1: Test that hexagon machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=1 %s -o %t.hex
 # RUN: llvm-readobj --dynamic-table %t.hex | FileCheck %s --check-prefix=LLVM-HEXAGON
 # RUN: llvm-readelf --dynamic-table %t.hex | FileCheck %s --check-prefix=GNU-HEXAGON
 
-# LLVM-HEXAGON:      DynamicSection [ (6 entries)
-# LLVM-HEXAGON-NEXT:   Tag                Type                 Name/Value
-# LLVM-HEXAGON-NEXT:   0x0000000000000004 HASH                 0x1000
-# LLVM-HEXAGON-NEXT:   0x0000000070000000 HEXAGON_SYMSZ        0x10
-# LLVM-HEXAGON-NEXT:   0x0000000070000001 HEXAGON_VER          4096
-# LLVM-HEXAGON-NEXT:   0x0000000070000002 HEXAGON_PLT          0x1000
-# LLVM-HEXAGON-NEXT:   0x000000001234ABCD unknown              0x1
-# LLVM-HEXAGON-NEXT:   0x0000000000000000 NULL                 0x0
+# LLVM-HEXAGON:      DynamicSection [ (4 entries)
+# LLVM-HEXAGON-NEXT:   Tag                Type          Name/Value
+# LLVM-HEXAGON-NEXT:   0x0000000070000000 HEXAGON_SYMSZ 0x10
+# LLVM-HEXAGON-NEXT:   0x0000000070000001 HEXAGON_VER   4096
+# LLVM-HEXAGON-NEXT:   0x0000000070000002 HEXAGON_PLT   0x1000
+# LLVM-HEXAGON-NEXT:   0x0000000000000000 NULL          0x0
 # LLVM-HEXAGON-NEXT: ]
 
-# GNU-HEXAGON:      Dynamic section at offset {{.*}} contains 6 entries:
-# GNU-HEXAGON-NEXT:   Tag                Type                 Name/Value
-# GNU-HEXAGON-NEXT:   0x0000000000000004 (HASH)               0x1000
-# GNU-HEXAGON-NEXT:   0x0000000070000000 (HEXAGON_SYMSZ)      0x10
-# GNU-HEXAGON-NEXT:   0x0000000070000001 (HEXAGON_VER)        4096
-# GNU-HEXAGON-NEXT:   0x0000000070000002 (HEXAGON_PLT)        0x1000
-# GNU-HEXAGON-NEXT:   0x000000001234abcd (unknown)            0x1
-# GNU-HEXAGON-NEXT:   0x0000000000000000 (NULL)               0x0
+# GNU-HEXAGON:      Dynamic section at offset {{.*}} contains 4 entries:
+# GNU-HEXAGON-NEXT:   Tag                Type            Name/Value
+# GNU-HEXAGON-NEXT:   0x0000000070000000 (HEXAGON_SYMSZ) 0x10
+# GNU-HEXAGON-NEXT:   0x0000000070000001 (HEXAGON_VER)   4096
+# GNU-HEXAGON-NEXT:   0x0000000070000002 (HEXAGON_PLT)   0x1000
+# GNU-HEXAGON-NEXT:   0x0000000000000000 (NULL)          0x0
 
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_HEXAGON
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_HEXAGON_SYMSZ
+        Value: 0x10
+      - Tag:   DT_HEXAGON_VER
+        Value: 0x1000
+      - Tag:   DT_HEXAGON_PLT
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
 
-# Test that MIPS machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=2 %S/Inputs/elf-dynamic-tags-machine-specific.yaml -o %t.mips
+## Case 2: Test that MIPS machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=2 %s -o %t.mips
 # RUN: llvm-readobj --dynamic-table %t.mips | FileCheck %s --check-prefix=LLVM-MIPS
 # RUN: llvm-readelf --dynamic-table %t.mips | FileCheck %s --check-prefix=GNU-MIPS
 
-# LLVM-MIPS:      DynamicSection [ (48 entries)
+# LLVM-MIPS:      DynamicSection [ (47 entries)
 # LLVM-MIPS-NEXT:   Tag                Type                 Name/Value
 # LLVM-MIPS-NEXT:   0x0000000000000004 HASH                 0x1000
 # LLVM-MIPS-NEXT:   0x0000000070000001 MIPS_RLD_VERSION     305419896
@@ -51,6 +74,8 @@
 # LLVM-MIPS-NEXT:   0x0000000070000017 MIPS_DELTA_CLASS     0x1000
 # LLVM-MIPS-NEXT:   0x0000000070000018 MIPS_DELTA_CLASS_NO  0x1
 # LLVM-MIPS-NEXT:   0x0000000070000019 MIPS_DELTA_INSTANCE  0x1000
+## FIXME: llvm-readobj does not print spaces after MIPS_DELTA_INSTANCE_NO, MIPS_PROTECTED_GOTIDX
+##        and other long tags. The output looks broken because of that.
 # LLVM-MIPS-NEXT:   0x000000007000001A MIPS_DELTA_INSTANCE_NO0x1
 # LLVM-MIPS-NEXT:   0x000000007000001B MIPS_DELTA_RELOC     0x1000
 # LLVM-MIPS-NEXT:   0x000000007000001C MIPS_DELTA_RELOC_NO  0x1
@@ -76,121 +101,289 @@
 # LLVM-MIPS-NEXT:   0x0000000070000032 MIPS_PLTGOT          0x1000
 # LLVM-MIPS-NEXT:   0x0000000070000034 MIPS_RWPLT           0x1000
 # LLVM-MIPS-NEXT:   0x0000000070000035 MIPS_RLD_MAP_REL     0x1000
-# LLVM-MIPS-NEXT:   0x000000001234ABCD unknown              0x1
 # LLVM-MIPS-NEXT:   0x0000000000000000 NULL                 0x0
 # LLVM-MIPS-NEXT: ]
 
-# GNU-MIPS:      Dynamic section at offset {{.*}} contains 48 entries:
-# GNU-MIPS-NEXT:   Tag                Type                 Name/Value
-# GNU-MIPS-NEXT:   0x0000000000000004 (HASH)               0x1000
-# GNU-MIPS-NEXT:   0x0000000070000001 (MIPS_RLD_VERSION)   305419896
-# GNU-MIPS-NEXT:   0x0000000070000002 (MIPS_TIME_STAMP)    0x11223344
-# GNU-MIPS-NEXT:   0x0000000070000003 (MIPS_ICHECKSUM)     0x11112222
-# GNU-MIPS-NEXT:   0x0000000070000004 (MIPS_IVERSION)      0x1
-# GNU-MIPS-NEXT:   0x0000000070000005 (MIPS_FLAGS)         QUICKSTART SGI_ONLY PIXIE CORD
-# GNU-MIPS-NEXT:   0x0000000070000006 (MIPS_BASE_ADDRESS)  0x87654321
-# GNU-MIPS-NEXT:   0x0000000070000007 (MIPS_MSYM)          0x1000
-# GNU-MIPS-NEXT:   0x0000000070000008 (MIPS_CONFLICT)      0x1000
-# GNU-MIPS-NEXT:   0x0000000070000009 (MIPS_LIBLIST)       0x1000
-# GNU-MIPS-NEXT:   0x000000007000000a (MIPS_LOCAL_GOTNO)   1
-# GNU-MIPS-NEXT:   0x000000007000000b (MIPS_CONFLICTNO)    0x1
-# GNU-MIPS-NEXT:   0x0000000070000010 (MIPS_LIBLISTNO)     0x1
-# GNU-MIPS-NEXT:   0x0000000070000011 (MIPS_SYMTABNO)      1
-# GNU-MIPS-NEXT:   0x0000000070000012 (MIPS_UNREFEXTNO)    0
-# GNU-MIPS-NEXT:   0x0000000070000013 (MIPS_GOTSYM)        0x0
-# GNU-MIPS-NEXT:   0x0000000070000014 (MIPS_HIPAGENO)      0x88776655
-# GNU-MIPS-NEXT:   0x0000000070000016 (MIPS_RLD_MAP)       0x1000
-# GNU-MIPS-NEXT:   0x0000000070000017 (MIPS_DELTA_CLASS)   0x1000
-# GNU-MIPS-NEXT:   0x0000000070000018 (MIPS_DELTA_CLASS_NO) 0x1
-# GNU-MIPS-NEXT:   0x0000000070000019 (MIPS_DELTA_INSTANCE) 0x1000
-# GNU-MIPS-NEXT:   0x000000007000001a (MIPS_DELTA_INSTANCE_NO) 0x1
-# GNU-MIPS-NEXT:   0x000000007000001b (MIPS_DELTA_RELOC)   0x1000
-# GNU-MIPS-NEXT:   0x000000007000001c (MIPS_DELTA_RELOC_NO) 0x1
-# GNU-MIPS-NEXT:   0x000000007000001d (MIPS_DELTA_SYM)     0x1000
-# GNU-MIPS-NEXT:   0x000000007000001e (MIPS_DELTA_SYM_NO)  0x1
-# GNU-MIPS-NEXT:   0x0000000070000020 (MIPS_DELTA_CLASSSYM) 0x1000
-# GNU-MIPS-NEXT:   0x0000000070000021 (MIPS_DELTA_CLASSSYM_NO) 0x1
-# GNU-MIPS-NEXT:   0x0000000070000022 (MIPS_CXX_FLAGS)     0x88887777
-# GNU-MIPS-NEXT:   0x0000000070000023 (MIPS_PIXIE_INIT)    0x1000
-# GNU-MIPS-NEXT:   0x0000000070000025 (MIPS_LOCALPAGE_GOTIDX) 0x1
-# GNU-MIPS-NEXT:   0x0000000070000026 (MIPS_LOCAL_GOTIDX)  0x1
-# GNU-MIPS-NEXT:   0x0000000070000027 (MIPS_HIDDEN_GOTIDX) 0x1
-# GNU-MIPS-NEXT:   0x0000000070000028 (MIPS_PROTECTED_GOTIDX) 0x1
-# GNU-MIPS-NEXT:   0x0000000070000029 (MIPS_OPTIONS)       0x1000
-# GNU-MIPS-NEXT:   0x000000007000002a (MIPS_INTERFACE)     0x1000
-# GNU-MIPS-NEXT:   0x000000007000002b (MIPS_DYNSTR_ALIGN)  0x88888888
-# GNU-MIPS-NEXT:   0x000000007000002c (MIPS_INTERFACE_SIZE) 0x10
+# GNU-MIPS:      Dynamic section at offset {{.*}} contains 47 entries:
+# GNU-MIPS-NEXT:   Tag                Type                         Name/Value
+# GNU-MIPS-NEXT:   0x0000000000000004 (HASH)                       0x1000
+# GNU-MIPS-NEXT:   0x0000000070000001 (MIPS_RLD_VERSION)           305419896
+# GNU-MIPS-NEXT:   0x0000000070000002 (MIPS_TIME_STAMP)            0x11223344
+# GNU-MIPS-NEXT:   0x0000000070000003 (MIPS_ICHECKSUM)             0x11112222
+# GNU-MIPS-NEXT:   0x0000000070000004 (MIPS_IVERSION)              0x1
+# GNU-MIPS-NEXT:   0x0000000070000005 (MIPS_FLAGS)                 QUICKSTART SGI_ONLY PIXIE CORD
+# GNU-MIPS-NEXT:   0x0000000070000006 (MIPS_BASE_ADDRESS)          0x87654321
+# GNU-MIPS-NEXT:   0x0000000070000007 (MIPS_MSYM)                  0x1000
+# GNU-MIPS-NEXT:   0x0000000070000008 (MIPS_CONFLICT)              0x1000
+# GNU-MIPS-NEXT:   0x0000000070000009 (MIPS_LIBLIST)               0x1000
+# GNU-MIPS-NEXT:   0x000000007000000a (MIPS_LOCAL_GOTNO)           1
+# GNU-MIPS-NEXT:   0x000000007000000b (MIPS_CONFLICTNO)            0x1
+# GNU-MIPS-NEXT:   0x0000000070000010 (MIPS_LIBLISTNO)             0x1
+# GNU-MIPS-NEXT:   0x0000000070000011 (MIPS_SYMTABNO)              1
+# GNU-MIPS-NEXT:   0x0000000070000012 (MIPS_UNREFEXTNO)            0
+# GNU-MIPS-NEXT:   0x0000000070000013 (MIPS_GOTSYM)                0x0
+# GNU-MIPS-NEXT:   0x0000000070000014 (MIPS_HIPAGENO)              0x88776655
+# GNU-MIPS-NEXT:   0x0000000070000016 (MIPS_RLD_MAP)               0x1000
+# GNU-MIPS-NEXT:   0x0000000070000017 (MIPS_DELTA_CLASS)           0x1000
+# GNU-MIPS-NEXT:   0x0000000070000018 (MIPS_DELTA_CLASS_NO)        0x1
+# GNU-MIPS-NEXT:   0x0000000070000019 (MIPS_DELTA_INSTANCE)        0x1000
+# GNU-MIPS-NEXT:   0x000000007000001a (MIPS_DELTA_INSTANCE_NO)     0x1
+# GNU-MIPS-NEXT:   0x000000007000001b (MIPS_DELTA_RELOC)           0x1000
+# GNU-MIPS-NEXT:   0x000000007000001c (MIPS_DELTA_RELOC_NO)        0x1
+# GNU-MIPS-NEXT:   0x000000007000001d (MIPS_DELTA_SYM)             0x1000
+# GNU-MIPS-NEXT:   0x000000007000001e (MIPS_DELTA_SYM_NO)          0x1
+# GNU-MIPS-NEXT:   0x0000000070000020 (MIPS_DELTA_CLASSSYM)        0x1000
+# GNU-MIPS-NEXT:   0x0000000070000021 (MIPS_DELTA_CLASSSYM_NO)     0x1
+# GNU-MIPS-NEXT:   0x0000000070000022 (MIPS_CXX_FLAGS)             0x88887777
+# GNU-MIPS-NEXT:   0x0000000070000023 (MIPS_PIXIE_INIT)            0x1000
+# GNU-MIPS-NEXT:   0x0000000070000025 (MIPS_LOCALPAGE_GOTIDX)      0x1
+# GNU-MIPS-NEXT:   0x0000000070000026 (MIPS_LOCAL_GOTIDX)          0x1
+# GNU-MIPS-NEXT:   0x0000000070000027 (MIPS_HIDDEN_GOTIDX)         0x1
+# GNU-MIPS-NEXT:   0x0000000070000028 (MIPS_PROTECTED_GOTIDX)      0x1
+# GNU-MIPS-NEXT:   0x0000000070000029 (MIPS_OPTIONS)               0x1000
+# GNU-MIPS-NEXT:   0x000000007000002a (MIPS_INTERFACE)             0x1000
+# GNU-MIPS-NEXT:   0x000000007000002b (MIPS_DYNSTR_ALIGN)          0x88888888
+# GNU-MIPS-NEXT:   0x000000007000002c (MIPS_INTERFACE_SIZE)        0x10
 # GNU-MIPS-NEXT:   0x000000007000002d (MIPS_RLD_TEXT_RESOLVE_ADDR) 0x8
-# GNU-MIPS-NEXT:   0x000000007000002e (MIPS_PERF_SUFFIX)   0x0
-# GNU-MIPS-NEXT:   0x000000007000002f (MIPS_COMPACT_SIZE)  0x10
-# GNU-MIPS-NEXT:   0x0000000070000030 (MIPS_GP_VALUE)      0x1
-# GNU-MIPS-NEXT:   0x0000000070000031 (MIPS_AUX_DYNAMIC)   0x1000
-# GNU-MIPS-NEXT:   0x0000000070000032 (MIPS_PLTGOT)        0x1000
-# GNU-MIPS-NEXT:   0x0000000070000034 (MIPS_RWPLT)         0x1000
-# GNU-MIPS-NEXT:   0x0000000070000035 (MIPS_RLD_MAP_REL)   0x1000
-# GNU-MIPS-NEXT:   0x000000001234abcd (unknown)            0x1
-# GNU-MIPS-NEXT:   0x0000000000000000 (NULL)               0x0
-
-
-# Test that PPC machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=3 %S/Inputs/elf-dynamic-tags-machine-specific.yaml -o %t.ppc
+# GNU-MIPS-NEXT:   0x000000007000002e (MIPS_PERF_SUFFIX)           0x0
+# GNU-MIPS-NEXT:   0x000000007000002f (MIPS_COMPACT_SIZE)          0x10
+# GNU-MIPS-NEXT:   0x0000000070000030 (MIPS_GP_VALUE)              0x1
+# GNU-MIPS-NEXT:   0x0000000070000031 (MIPS_AUX_DYNAMIC)           0x1000
+# GNU-MIPS-NEXT:   0x0000000070000032 (MIPS_PLTGOT)                0x1000
+# GNU-MIPS-NEXT:   0x0000000070000034 (MIPS_RWPLT)                 0x1000
+# GNU-MIPS-NEXT:   0x0000000070000035 (MIPS_RLD_MAP_REL)           0x1000
+# GNU-MIPS-NEXT:   0x0000000000000000 (NULL)                       0x0
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_MIPS
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_HASH
+        Value: 0x1000
+      - Tag:   DT_MIPS_RLD_VERSION
+        Value: 0x12345678
+      - Tag:   DT_MIPS_TIME_STAMP
+        Value: 0x11223344
+      - Tag:   DT_MIPS_ICHECKSUM
+        Value: 0x11112222
+      - Tag:   DT_MIPS_IVERSION
+        Value: 0x1
+      - Tag:   DT_MIPS_FLAGS
+        Value: 0x11111111
+      - Tag:   DT_MIPS_BASE_ADDRESS
+        Value: 0x87654321
+      - Tag:   DT_MIPS_MSYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_CONFLICT
+        Value: 0x1000
+      - Tag:   DT_MIPS_LIBLIST
+        Value: 0x1000
+      - Tag:   DT_MIPS_LOCAL_GOTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_CONFLICTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_LIBLISTNO
+        Value: 0x1
+      - Tag:   DT_MIPS_SYMTABNO
+        Value: 0x1
+      - Tag:   DT_MIPS_UNREFEXTNO
+        Value: 0x0
+      - Tag:   DT_MIPS_GOTSYM
+        Value: 0x0
+      - Tag:   DT_MIPS_HIPAGENO
+        Value: 0x88776655
+      - Tag:   DT_MIPS_RLD_MAP
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASS
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASS_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_INSTANCE
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_INSTANCE_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_RELOC
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_RELOC_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_SYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_SYM_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_DELTA_CLASSSYM
+        Value: 0x1000
+      - Tag:   DT_MIPS_DELTA_CLASSSYM_NO
+        Value: 0x1
+      - Tag:   DT_MIPS_CXX_FLAGS
+        Value: 0x88887777
+      - Tag:   DT_MIPS_PIXIE_INIT
+        Value: 0x1000
+      - Tag:   DT_MIPS_LOCALPAGE_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_LOCAL_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_HIDDEN_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_PROTECTED_GOTIDX
+        Value: 0x1
+      - Tag:   DT_MIPS_OPTIONS
+        Value: 0x1000
+      - Tag:   DT_MIPS_INTERFACE
+        Value: 0x1000
+      - Tag:   DT_MIPS_DYNSTR_ALIGN
+        Value: 0x88888888
+      - Tag:   DT_MIPS_INTERFACE_SIZE
+        Value: 0x10
+      - Tag:   DT_MIPS_RLD_TEXT_RESOLVE_ADDR
+        Value: 0x8
+      - Tag:   DT_MIPS_PERF_SUFFIX
+        Value: 0x0
+      - Tag:   DT_MIPS_COMPACT_SIZE
+        Value: 0x10
+      - Tag:   DT_MIPS_GP_VALUE
+        Value: 0x1
+      - Tag:   DT_MIPS_AUX_DYNAMIC
+        Value: 0x1000
+      - Tag:   DT_MIPS_PLTGOT
+        Value: 0x1000
+      - Tag:   DT_MIPS_RWPLT
+        Value: 0x1000
+      - Tag:   DT_MIPS_RLD_MAP_REL
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
+
+## Case 3: Test that PPC machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=3 %s -o %t.ppc
 # RUN: llvm-readobj --dynamic-table %t.ppc | FileCheck %s --check-prefix=LLVM-PPC
 # RUN: llvm-readelf --dynamic-table %t.ppc | FileCheck %s --check-prefix=GNU-PPC
 
-# LLVM-PPC:      DynamicSection [ (4 entries)
-# LLVM-PPC-NEXT:   Tag        Type                 Name/Value
-# LLVM-PPC-NEXT:   0x70000000 PPC_GOT              0x200C0
-# LLVM-PPC-NEXT:   0x70000001 PPC_OPT              0x1
-# LLVM-PPC-NEXT:   0x1234ABCD unknown              0x1
-# LLVM-PPC-NEXT:   0x00000000 NULL                 0x0
+# LLVM-PPC:      DynamicSection [ (3 entries)
+# LLVM-PPC-NEXT:   Tag        Type    Name/Value
+# LLVM-PPC-NEXT:   0x70000000 PPC_GOT 0x200C0
+# LLVM-PPC-NEXT:   0x70000001 PPC_OPT 0x1
+# LLVM-PPC-NEXT:   0x00000000 NULL    0x0
 # LLVM-PPC-NEXT: ]
 
-# GNU-PPC:      Dynamic section at offset {{.*}} contains 4 entries:
-# GNU-PPC-NEXT:   Tag        Type                 Name/Value
-# GNU-PPC-NEXT:   0x70000000 (PPC_GOT)            0x200c0
-# GNU-PPC-NEXT:   0x70000001 (PPC_OPT)            0x1
-# GNU-PPC-NEXT:   0x1234abcd (unknown)            0x1
-# GNU-PPC-NEXT:   0x00000000 (NULL)               0x0
+# GNU-PPC:      Dynamic section at offset {{.*}} contains 3 entries:
+# GNU-PPC-NEXT:   Tag        Type      Name/Value
+# GNU-PPC-NEXT:   0x70000000 (PPC_GOT) 0x200c0
+# GNU-PPC-NEXT:   0x70000001 (PPC_OPT) 0x1
+# GNU-PPC-NEXT:   0x00000000 (NULL)    0x0
 
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2MSB
+  Type:    ET_EXEC
+  Machine: EM_PPC
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_PPC_GOT
+        Value: 0x200c0
+      - Tag:   DT_PPC_OPT
+        Value: 1
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
 
-# Test that PPC64 machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=4 %S/Inputs/elf-dynamic-tags-machine-specific.yaml -o %t.ppc64
+## Case 4: Test that PPC64 machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=4 %s -o %t.ppc64
 # RUN: llvm-readobj --dynamic-table %t.ppc64 | FileCheck %s --check-prefix=LLVM-PPC64
 # RUN: llvm-readelf --dynamic-table %t.ppc64 | FileCheck %s --check-prefix=GNU-PPC64
 
-# LLVM-PPC64:      DynamicSection [ (4 entries)
-# LLVM-PPC64-NEXT:   Tag                Type                 Name/Value
-# LLVM-PPC64-NEXT:   0x0000000000000004 HASH                 0x1000
-# LLVM-PPC64-NEXT:   0x0000000070000000 PPC64_GLINK          0x1000
-# LLVM-PPC64-NEXT:   0x000000001234ABCD unknown              0x1
-# LLVM-PPC64-NEXT:   0x0000000000000000 NULL                 0x0
+# LLVM-PPC64:      DynamicSection [ (2 entries)
+# LLVM-PPC64-NEXT:   Tag                Type        Name/Value
+# LLVM-PPC64-NEXT:   0x0000000070000000 PPC64_GLINK 0x1000
+# LLVM-PPC64-NEXT:   0x0000000000000000 NULL        0x0
 # LLVM-PPC64-NEXT: ]
 
-# GNU-PPC64:      Dynamic section at offset {{.*}} contains 4 entries:
-# GNU-PPC64-NEXT:   Tag                Type                 Name/Value
-# GNU-PPC64-NEXT:   0x0000000000000004 (HASH)               0x1000
-# GNU-PPC64-NEXT:   0x0000000070000000 (PPC64_GLINK)        0x1000
-# GNU-PPC64-NEXT:   0x000000001234abcd (unknown)            0x1
-# GNU-PPC64-NEXT:   0x0000000000000000 (NULL)               0x0
+# GNU-PPC64:      Dynamic section at offset {{.*}} contains 2 entries:
+# GNU-PPC64-NEXT:   Tag                Type          Name/Value
+# GNU-PPC64-NEXT:   0x0000000070000000 (PPC64_GLINK) 0x1000
+# GNU-PPC64-NEXT:   0x0000000000000000 (NULL)        0x0
 
-# Test that AARCH64 machine-specific tags can be dumped.
-# RUN: yaml2obj --docnum=5 %S/Inputs/elf-dynamic-tags-machine-specific.yaml -o %t.aarch64
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_PPC64
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_PPC64_GLINK
+        Value: 0x1000
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic
+
+## Case 5: Test that AARCH64 machine-specific tags can be dumped.
+# RUN: yaml2obj --docnum=5 %s -o %t.aarch64
 # RUN: llvm-readobj --dynamic-table %t.aarch64 | FileCheck %s --check-prefix=LLVM-AARCH64
 # RUN: llvm-readelf --dynamic-table %t.aarch64 | FileCheck %s --check-prefix=GNU-AARCH64
 
-# LLVM-AARCH64:     DynamicSection [ (5 entries)
-# LLVM-AARCH64-NEXT:  Tag                Type                 Name/Value
-# LLVM-AARCH64-NEXT:  0x0000000000000004 HASH                 0x1000
-# LLVM-AARCH64-NEXT:  0x0000000070000001 AARCH64_BTI_PLT      0
-# LLVM-AARCH64-NEXT:  0x0000000070000003 AARCH64_PAC_PLT      0
-# LLVM-AARCH64-NEXT:  0x000000001234ABCD unknown              0x1
-# LLVM-AARCH64-NEXT:  0x0000000000000000 NULL                 0x0
+# LLVM-AARCH64:     DynamicSection [ (3 entries)
+# LLVM-AARCH64-NEXT:  Tag                Type            Name/Value
+# LLVM-AARCH64-NEXT:  0x0000000070000001 AARCH64_BTI_PLT 1
+# LLVM-AARCH64-NEXT:  0x0000000070000003 AARCH64_PAC_PLT 2
+# LLVM-AARCH64-NEXT:  0x0000000000000000 NULL            0x0
 # LLVM-AARCH64-NEXT:]
 
-# GNU-AARCH64:      Dynamic section at offset {{.*}} contains 5 entries:
-# GNU-AARCH64-NEXT:  Tag                Type                 Name/Value
-# GNU-AARCH64-NEXT:  0x0000000000000004 (HASH)               0x1000
-# GNU-AARCH64-NEXT:  0x0000000070000001 (AARCH64_BTI_PLT)    0
-# GNU-AARCH64-NEXT:  0x0000000070000003 (AARCH64_PAC_PLT)    0
-# GNU-AARCH64-NEXT:  0x000000001234abcd (unknown)            0x1
-# GNU-AARCH64-NEXT:  0x0000000000000000 (NULL)               0x0
+# GNU-AARCH64:      Dynamic section at offset {{.*}} contains 3 entries:
+# GNU-AARCH64-NEXT:  Tag                Type              Name/Value
+# GNU-AARCH64-NEXT:  0x0000000070000001 (AARCH64_BTI_PLT) 1
+# GNU-AARCH64-NEXT:  0x0000000070000003 (AARCH64_PAC_PLT) 2
+# GNU-AARCH64-NEXT:  0x0000000000000000 (NULL)            0x0
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_AARCH64
+Sections:
+  - Name: .dynamic
+    Type: SHT_DYNAMIC
+    Entries:
+      - Tag:   DT_AARCH64_BTI_PLT
+        Value: 1
+      - Tag:   DT_AARCH64_PAC_PLT
+        Value: 2
+      - Tag:   DT_NULL
+        Value: 0
+ProgramHeaders:
+  - Type: PT_LOAD
+    Sections:
+      - Section: .dynamic
+  - Type: PT_DYNAMIC
+    Sections:
+      - Section: .dynamic


        


More information about the llvm-commits mailing list