[llvm\test\Object] - An initial step to cleanup the test cases.
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 8 Jul 2019 16:53:39 +0000 (16:53 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 8 Jul 2019 16:53:39 +0000 (16:53 +0000)
This patch removes trivial-object-test.elf-i386,
trivial-object-test.elf-x86-64 and trivial-object-test2.elf-x86-64
precompiled objects from test/Object/Inputs folder.

I adjusted the existent test cases to use YAML instead.

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

llvm-svn: 365348

19 files changed:
llvm/test/Object/Inputs/trivial-object-test.elf-i386 [deleted file]
llvm/test/Object/Inputs/trivial-object-test.elf-x86-64 [deleted file]
llvm/test/Object/Inputs/trivial-object-test2.elf-x86-64 [deleted file]
llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
llvm/test/Object/X86/objdump-trivial-object.test
llvm/test/Object/archive-symtab.test
llvm/test/Object/mri-addmod.test
llvm/test/Object/nm-error.test
llvm/test/Object/nm-shared-object.test
llvm/test/Object/nm-trivial-object.test
llvm/test/Object/obj2yaml.test
llvm/test/Object/objdump-file-header.test
llvm/test/Object/objdump-relocations.test
llvm/test/Object/objdump-section-content.test
llvm/test/Object/objdump-sectionheaders.test
llvm/test/Object/objdump-symbol-table.test
llvm/test/Object/readobj-absent.test
llvm/test/Object/readobj.test [deleted file]
llvm/test/tools/llvm-readobj/elf-no-action.test [new file with mode: 0644]

diff --git a/llvm/test/Object/Inputs/trivial-object-test.elf-i386 b/llvm/test/Object/Inputs/trivial-object-test.elf-i386
deleted file mode 100644 (file)
index 1a0ea40..0000000
Binary files a/llvm/test/Object/Inputs/trivial-object-test.elf-i386 and /dev/null differ
diff --git a/llvm/test/Object/Inputs/trivial-object-test.elf-x86-64 b/llvm/test/Object/Inputs/trivial-object-test.elf-x86-64
deleted file mode 100644 (file)
index 889f5d9..0000000
Binary files a/llvm/test/Object/Inputs/trivial-object-test.elf-x86-64 and /dev/null differ
diff --git a/llvm/test/Object/Inputs/trivial-object-test2.elf-x86-64 b/llvm/test/Object/Inputs/trivial-object-test2.elf-x86-64
deleted file mode 100644 (file)
index 9124518..0000000
Binary files a/llvm/test/Object/Inputs/trivial-object-test2.elf-x86-64 and /dev/null differ
index e417ec4..0fff390 100644 (file)
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-i386 \
-RUN:              | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-x86-64 \
-RUN:              | FileCheck %s -check-prefix COFF-x86-64
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-i386 \
-RUN:              | FileCheck %s -check-prefix MACHO-i386
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-x86-64 \
-RUN:              | FileCheck %s -check-prefix MACHO-x86-64
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
-RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.elf-x86-64 \
-RUN:              | FileCheck %s -check-prefix ELF-x86-64
+# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-i386 \
+# RUN:              | FileCheck %s -check-prefix COFF-i386
 
-COFF-i386: file format COFF-i386
-COFF-i386: Disassembly of section .text:
-COFF-i386:        0:       83 ec 0c                                        subl    $12, %esp
-COFF-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
-COFF-i386:        b:       c7 04 24 00 00 00 00                            movl    $0, (%esp)
-COFF-i386:                              e: IMAGE_REL_I386_DIR32  L_.str
-COFF-i386:       12:       e8 00 00 00 00                                  calll   0
-COFF-i386:                             13: IMAGE_REL_I386_REL32  _puts
-COFF-i386:       17:       e8 00 00 00 00                                  calll   0
-COFF-i386:                             18: IMAGE_REL_I386_REL32  _SomeOtherFunction
-COFF-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
-COFF-i386:       20:       83 c4 0c                                        addl    $12, %esp
-COFF-i386:       23:       c3                                              ret
+COFF-i386: file format COFF-i386
+COFF-i386: Disassembly of section .text:
+COFF-i386:        0:       83 ec 0c                                        subl    $12, %esp
+COFF-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
+COFF-i386:        b:       c7 04 24 00 00 00 00                            movl    $0, (%esp)
+COFF-i386:                              e: IMAGE_REL_I386_DIR32  L_.str
+COFF-i386:       12:       e8 00 00 00 00                                  calll   0
+COFF-i386:                             13: IMAGE_REL_I386_REL32  _puts
+COFF-i386:       17:       e8 00 00 00 00                                  calll   0
+COFF-i386:                             18: IMAGE_REL_I386_REL32  _SomeOtherFunction
+COFF-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
+COFF-i386:       20:       83 c4 0c                                        addl    $12, %esp
+COFF-i386:       23:       c3                                              ret
 
-COFF-x86-64: file format COFF-x86-64
-COFF-x86-64: Disassembly of section .text:
-COFF-x86-64:        0:       48 83 ec 28                                     subq    $40, %rsp
-COFF-x86-64:        4:       c7 44 24 24 00 00 00 00                         movl    $0, 36(%rsp)
-COFF-x86-64:        c:       48 8d 0d 00 00 00 00                            leaq    (%rip), %rcx
-COFF-x86-64:                               f: IMAGE_REL_AMD64_REL32 L.str
-COFF-x86-64:       13:       e8 00 00 00 00                                  callq   0
-COFF-x86-64:                              14: IMAGE_REL_AMD64_REL32 puts
-COFF-x86-64:       18:       e8 00 00 00 00                                  callq   0
-COFF-x86-64:                              19: IMAGE_REL_AMD64_REL32 SomeOtherFunction
-COFF-x86-64:       1d:       8b 44 24 24                                     movl    36(%rsp), %eax
-COFF-x86-64:       21:       48 83 c4 28                                     addq    $40, %rsp
-COFF-x86-64:       25:       c3                                              ret
+# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.coff-x86-64 \
+# RUN:              | FileCheck %s -check-prefix COFF-x86-64
 
-MACHO-i386: file format Mach-O 32-bit i386
-MACHO-i386: Disassembly of section __TEXT,__text:
-MACHO-i386: _main:
-MACHO-i386:        0:       83 ec 0c                                        subl    $12, %esp
-MACHO-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
-MACHO-i386:        b:       c7 04 24 24 00 00 00                            movl    $36, (%esp)
-MACHO-i386:                                e: GENERIC_RELOC_VANILLA __cstring
-MACHO-i386:       12:       e8 1f 00 00 00                                  calll   31
-MACHO-i386:                               13: GENERIC_RELOC_VANILLA __jump_table
-MACHO-i386:       17:       e8 15 00 00 00                                  calll   21
-MACHO-i386:                               18: GENERIC_RELOC_VANILLA __jump_table
-MACHO-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
-MACHO-i386:       20:       83 c4 0c                                        addl    $12, %esp
-MACHO-i386:       23:       c3                                              ret
+# COFF-x86-64: file format COFF-x86-64
+# COFF-x86-64: Disassembly of section .text:
+# COFF-x86-64:        0:       48 83 ec 28                                     subq    $40, %rsp
+# COFF-x86-64:        4:       c7 44 24 24 00 00 00 00                         movl    $0, 36(%rsp)
+# COFF-x86-64:        c:       48 8d 0d 00 00 00 00                            leaq    (%rip), %rcx
+# COFF-x86-64:                               f: IMAGE_REL_AMD64_REL32 L.str
+# COFF-x86-64:       13:       e8 00 00 00 00                                  callq   0
+# COFF-x86-64:                              14: IMAGE_REL_AMD64_REL32 puts
+# COFF-x86-64:       18:       e8 00 00 00 00                                  callq   0
+# COFF-x86-64:                              19: IMAGE_REL_AMD64_REL32 SomeOtherFunction
+# COFF-x86-64:       1d:       8b 44 24 24                                     movl    36(%rsp), %eax
+# COFF-x86-64:       21:       48 83 c4 28                                     addq    $40, %rsp
+# COFF-x86-64:       25:       c3                                              ret
 
-MACHO-x86-64: file format Mach-O 64-bit x86-64
-MACHO-x86-64: Disassembly of section __TEXT,__text:
-MACHO-x86-64: _main:
-MACHO-x86-64:        0:       48 83 ec 08                                     subq    $8, %rsp
-MACHO-x86-64:        4:       c7 44 24 04 00 00 00 00                         movl    $0, 4(%rsp)
-MACHO-x86-64:        c:       48 8d 3d 00 00 00 00                            leaq    (%rip), %rdi
-MACHO-x86-64:                                f: X86_64_RELOC_SIGNED   L_.str
-MACHO-x86-64:       13:       e8 00 00 00 00                                  callq   0
-MACHO-x86-64:                               14: X86_64_RELOC_BRANCH   _puts
-MACHO-x86-64:       18:       30 c0                                           xorb    %al, %al
-MACHO-x86-64:       1a:       e8 00 00 00 00                                  callq   0
-MACHO-x86-64:                               1b: X86_64_RELOC_BRANCH   _SomeOtherFunction
-MACHO-x86-64:       1f:       8b 44 24 04                                     movl    4(%rsp), %eax
-MACHO-x86-64:       23:       48 83 c4 08                                     addq    $8, %rsp
-MACHO-x86-64:       27:       c3                                              ret
+# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-i386 \
+# RUN:              | FileCheck %s -check-prefix MACHO-i386
 
-ELF-i386: file format ELF32-i386
-ELF-i386: Disassembly of section .text:
-ELF-i386: main:
-ELF-i386:        0:     83 ec 0c                                        subl    $12, %esp
-ELF-i386:        3:     c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
-ELF-i386:        b:     c7 04 24 00 00 00 00                            movl    $0, (%esp)
-ELF-i386:                              e: R_386_32      .rodata.str1.1
-ELF-i386:       12:     e8 fc ff ff ff                                  calll   -4
-ELF-i386:                             13: R_386_PC32    puts
-ELF-i386:       17:     e8 fc ff ff ff                                  calll   -4
-ELF-i386:                             18: R_386_PC32    SomeOtherFunction
-ELF-i386:       1c:     8b 44 24 08                                     movl    8(%esp), %eax
-ELF-i386:       20:     83 c4 0c                                        addl    $12, %esp
-ELF-i386:       23:     c3                                              ret
+# MACHO-i386: file format Mach-O 32-bit i386
+# MACHO-i386: Disassembly of section __TEXT,__text:
+# MACHO-i386: _main:
+# MACHO-i386:        0:       83 ec 0c                                        subl    $12, %esp
+# MACHO-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
+# MACHO-i386:        b:       c7 04 24 24 00 00 00                            movl    $36, (%esp)
+# MACHO-i386:                                e: GENERIC_RELOC_VANILLA __cstring
+# MACHO-i386:       12:       e8 1f 00 00 00                                  calll   31
+# MACHO-i386:                               13: GENERIC_RELOC_VANILLA __jump_table
+# MACHO-i386:       17:       e8 15 00 00 00                                  calll   21
+# MACHO-i386:                               18: GENERIC_RELOC_VANILLA __jump_table
+# MACHO-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
+# MACHO-i386:       20:       83 c4 0c                                        addl    $12, %esp
+# MACHO-i386:       23:       c3                                              ret
 
-ELF-x86-64: file format ELF64-x86-64
-ELF-x86-64: Disassembly of section .text:
-ELF-x86-64: main:
-ELF-x86-64:        0:   48 83 ec 08                                     subq    $8, %rsp
-ELF-x86-64:        4:   c7 44 24 04 00 00 00 00                         movl    $0, 4(%rsp)
-ELF-x86-64:        c:   bf 00 00 00 00                                  movl    $0, %edi
-ELF-x86-64:                            d: R_X86_64_32S  .rodata.str1.1
-ELF-x86-64:       11:   e8 00 00 00 00                                  callq   0
-ELF-x86-64:                           12: R_X86_64_PC32 puts-4
-ELF-x86-64:       16:   30 c0                                           xorb    %al, %al
-ELF-x86-64:       18:   e8 00 00 00 00                                  callq   0
-ELF-x86-64:                           19: R_X86_64_PC32 SomeOtherFunction-4
-ELF-x86-64:       1d:   8b 44 24 04                                     movl    4(%rsp), %eax
-ELF-x86-64:       21:   48 83 c4 08                                     addq    $8, %rsp
-ELF-x86-64:       25:   c3                                              ret
+# RUN: llvm-objdump -d -r %p/../Inputs/trivial-object-test.macho-x86-64 \
+# RUN:              | FileCheck %s -check-prefix MACHO-x86-64
+
+# MACHO-x86-64: file format Mach-O 64-bit x86-64
+# MACHO-x86-64: Disassembly of section __TEXT,__text:
+# MACHO-x86-64: _main:
+# MACHO-x86-64:        0:       48 83 ec 08                                     subq    $8, %rsp
+# MACHO-x86-64:        4:       c7 44 24 04 00 00 00 00                         movl    $0, 4(%rsp)
+# MACHO-x86-64:        c:       48 8d 3d 00 00 00 00                            leaq    (%rip), %rdi
+# MACHO-x86-64:                                f: X86_64_RELOC_SIGNED   L_.str
+# MACHO-x86-64:       13:       e8 00 00 00 00                                  callq   0
+# MACHO-x86-64:                               14: X86_64_RELOC_BRANCH   _puts
+# MACHO-x86-64:       18:       30 c0                                           xorb    %al, %al
+# MACHO-x86-64:       1a:       e8 00 00 00 00                                  callq   0
+# MACHO-x86-64:                               1b: X86_64_RELOC_BRANCH   _SomeOtherFunction
+# MACHO-x86-64:       1f:       8b 44 24 04                                     movl    4(%rsp), %eax
+# MACHO-x86-64:       23:       48 83 c4 08                                     addq    $8, %rsp
+# MACHO-x86-64:       27:       c3                                              ret
+
+# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
+# RUN: llvm-objdump -d -r %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
+
+# ELF-i386: file format ELF32-i386
+# ELF-i386: Disassembly of section .text:
+# ELF-i386: main:
+# ELF-i386:        0:     83 ec 0c                                        subl    $12, %esp
+# ELF-i386:        3:     c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
+# ELF-i386:        b:     c7 04 24 00 00 00 00                            movl    $0, (%esp)
+# ELF-i386:                              e: R_386_32      .rodata.str1.1
+# ELF-i386:       12:     e8 fc ff ff ff                                  calll   -4
+# ELF-i386:                             13: R_386_PC32    puts
+# ELF-i386:       17:     e8 fc ff ff ff                                  calll   -4
+# ELF-i386:                             18: R_386_PC32    SomeOtherFunction
+# ELF-i386:       1c:     8b 44 24 08                                     movl    8(%esp), %eax
+# ELF-i386:       20:     83 c4 0c                                        addl    $12, %esp
+# ELF-i386:       23:     c3                                              ret
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+    Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
+  - Name:    .rodata.str1.1
+    Type:    SHT_PROGBITS
+  - Name:    .rel.text
+    Type:    SHT_REL
+    Info:    .text
+    Relocations:
+      - Offset: 0x000000000000000E
+        Symbol: .rodata.str1.1
+        Type:   R_386_32
+      - Offset: 0x0000000000000013
+        Symbol: puts
+        Type:   R_386_PC32
+      - Offset: 0x0000000000000018
+        Symbol: SomeOtherFunction
+        Type:   R_386_PC32
+Symbols:
+  - Name:    .rodata.str1.1
+    Type:    STT_SECTION
+    Section: .rodata.str1.1
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
+# RUN: llvm-objdump -d -r %t.elf-x86-64 | FileCheck %s -check-prefix ELF-x86-64
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+    Content: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
+  - Name:    .rodata.str1.1
+    Type:    SHT_PROGBITS
+  - Name:    .rela.text
+    Type:    SHT_RELA
+    Info:    .text
+    Relocations:
+      - Offset: 0x000000000000000D
+        Symbol: .rodata.str1.1
+        Type:   R_X86_64_32S
+      - Offset: 0x0000000000000012
+        Symbol: puts
+        Type:   R_X86_64_PC32
+        Addend: -4
+      - Offset: 0x0000000000000019
+        Symbol: SomeOtherFunction
+        Type:   R_X86_64_PC32
+        Addend: -4
+Symbols:
+  - Name:    .rodata.str1.1
+    Type:    STT_SECTION
+    Section: .rodata.str1.1
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# ELF-x86-64: file format ELF64-x86-64
+# ELF-x86-64: Disassembly of section .text:
+# ELF-x86-64: main:
+# ELF-x86-64:        0:   48 83 ec 08                                     subq    $8, %rsp
+# ELF-x86-64:        4:   c7 44 24 04 00 00 00 00                         movl    $0, 4(%rsp)
+# ELF-x86-64:        c:   bf 00 00 00 00                                  movl    $0, %edi
+# ELF-x86-64:                            d: R_X86_64_32S  .rodata.str1.1
+# ELF-x86-64:       11:   e8 00 00 00 00                                  callq   0
+# ELF-x86-64:                           12: R_X86_64_PC32 puts-4
+# ELF-x86-64:       16:   30 c0                                           xorb    %al, %al
+# ELF-x86-64:       18:   e8 00 00 00 00                                  callq   0
+# ELF-x86-64:                           19: R_X86_64_PC32 SomeOtherFunction-4
+# ELF-x86-64:       1d:   8b 44 24 04                                     movl    4(%rsp), %eax
+# ELF-x86-64:       21:   48 83 c4 08                                     addq    $8, %rsp
+# ELF-x86-64:       25:   c3                                              ret
index 8f9ea97..3071db1 100644 (file)
@@ -1,54 +1,80 @@
-RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-i386 \
-RUN:              | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-x86-64 \
-RUN:              | FileCheck %s -check-prefix COFF-x86-64
-RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
-RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.elf-x86-64 \
-RUN:              | FileCheck %s -check-prefix ELF-x86-64
-
-COFF-i386: file format COFF-i386
-COFF-i386: Disassembly of section .text:
-COFF-i386:        0:       83 ec 0c                                        subl    $12, %esp
-COFF-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
-COFF-i386:        b:       c7 04 24 00 00 00 00                            movl    $0, (%esp)
-COFF-i386:       12:       e8 00 00 00 00                                  calll   0
-COFF-i386:       17:       e8 00 00 00 00                                  calll   0
-COFF-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
-COFF-i386:       20:       83 c4 0c                                        addl    $12, %esp
-COFF-i386:       23:       c3                                              ret
-
-COFF-x86-64: file format COFF-x86-64
-COFF-x86-64: Disassembly of section .text:
-COFF-x86-64:        0:       48 83 ec 28                                     subq    $40, %rsp
-COFF-x86-64:        4:       c7 44 24 24 00 00 00 00                         movl    $0, 36(%rsp)
-COFF-x86-64:        c:       48 8d 0d 00 00 00 00                            leaq    (%rip), %rcx
-COFF-x86-64:       13:       e8 00 00 00 00                                  callq   0
-COFF-x86-64:       18:       e8 00 00 00 00                                  callq   0
-COFF-x86-64:       1d:       8b 44 24 24                                     movl    36(%rsp), %eax
-COFF-x86-64:       21:       48 83 c4 28                                     addq    $40, %rsp
-COFF-x86-64:       25:       c3                                              ret
-
-
-ELF-i386: file format ELF32-i386
-ELF-i386: Disassembly of section .text:
-ELF-i386:        0:       83 ec 0c                                        subl    $12, %esp
-ELF-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
-ELF-i386:        b:       c7 04 24 00 00 00 00                            movl    $0, (%esp)
-ELF-i386:       12:       e8 fc ff ff ff                                  calll   -4
-ELF-i386:       17:       e8 fc ff ff ff                                  calll   -4
-ELF-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
-ELF-i386:       20:       83 c4 0c                                        addl    $12, %esp
-ELF-i386:       23:       c3                                              ret
-
-ELF-x86-64: file format ELF64-x86-64
-ELF-x86-64: Disassembly of section .text:
-ELF-x86-64:        0:       48 83 ec 08                                     subq    $8, %rsp
-ELF-x86-64:        4:       c7 44 24 04 00 00 00 00                         movl    $0, 4(%rsp)
-ELF-x86-64:        c:       bf 00 00 00 00                                  movl    $0, %edi
-ELF-x86-64:       11:       e8 00 00 00 00                                  callq   0
-ELF-x86-64:       16:       30 c0                                           xorb    %al, %al
-ELF-x86-64:       18:       e8 00 00 00 00                                  callq   0
-ELF-x86-64:       1d:       8b 44 24 04                                     movl    4(%rsp), %eax
-ELF-x86-64:       21:       48 83 c4 08                                     addq    $8, %rsp
-ELF-x86-64:       25:       c3                                              ret
+# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-i386 \
+# RUN:              | FileCheck %s -check-prefix COFF-i386
+
+# COFF-i386: file format COFF-i386
+# COFF-i386: Disassembly of section .text:
+# COFF-i386:        0:  83 ec 0c                      subl    $12, %esp
+# COFF-i386:        3:  c7 44 24 08 00 00 00 00       movl    $0, 8(%esp)
+# COFF-i386:        b:  c7 04 24 00 00 00 00          movl    $0, (%esp)
+# COFF-i386:       12: e8 00 00 00 00                 calll   0
+# COFF-i386:       17: e8 00 00 00 00                 calll   0
+# COFF-i386:       1c: 8b 44 24 08                    movl    8(%esp), %eax
+# COFF-i386:       20: 83 c4 0c                       addl    $12, %esp
+# COFF-i386:       23: c3                             ret
+
+# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-x86-64 \
+# RUN:              | FileCheck %s -check-prefix COFF-x86-64
+
+# COFF-x86-64: file format COFF-x86-64
+# COFF-x86-64: Disassembly of section .text:
+# COFF-x86-64:        0: 48 83 ec 28                  subq    $40, %rsp
+# COFF-x86-64:        4: c7 44 24 24 00 00 00 00      movl    $0, 36(%rsp)
+# COFF-x86-64:        c: 48 8d 0d 00 00 00 00         leaq    (%rip), %rcx
+# COFF-x86-64:       13: e8 00 00 00 00               callq   0
+# COFF-x86-64:       18: e8 00 00 00 00               callq   0
+# COFF-x86-64:       1d: 8b 44 24 24                  movl    36(%rsp), %eax
+# COFF-x86-64:       21: 48 83 c4 28                  addq    $40, %rsp
+# COFF-x86-64:       25: c3                           ret
+
+# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
+# RUN: llvm-objdump -d %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
+
+# ELF-i386: file format ELF32-i386
+# ELF-i386: Disassembly of section .text:
+# ELF-i386:        0: 83 ec 0c                        subl    $12, %esp
+# ELF-i386:        3: c7 44 24 08 00 00 00 00         movl    $0, 8(%esp)
+# ELF-i386:        b: c7 04 24 00 00 00 00            movl    $0, (%esp)
+# ELF-i386:       12: e8 fc ff ff ff                  calll   -4
+# ELF-i386:       17: e8 fc ff ff ff                  calll   -4
+# ELF-i386:       1c: 8b 44 24 08                     movl    8(%esp), %eax
+# ELF-i386:       20: 83 c4 0c                        addl    $12, %esp
+# ELF-i386:       23: c3                              ret
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+    Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
+
+# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
+# RUN: llvm-objdump -d %t.elf-x86-64 | FileCheck %s -check-prefix ELF-x86-64
+
+# ELF-x86-64: file format ELF64-x86-64
+# ELF-x86-64: Disassembly of section .text:
+# ELF-x86-64:        0: 48 83 ec 08                   subq    $8, %rsp
+# ELF-x86-64:        4: c7 44 24 04 00 00 00 00       movl    $0, 4(%rsp)
+# ELF-x86-64:        c: bf 00 00 00 00                movl    $0, %edi
+# ELF-x86-64:       11: e8 00 00 00 00                callq   0
+# ELF-x86-64:       16: 30 c0                         xorb    %al, %al
+# ELF-x86-64:       18: e8 00 00 00 00                callq   0
+# ELF-x86-64:       1d: 8b 44 24 04                   movl    4(%rsp), %eax
+# ELF-x86-64:       21: 48 83 c4 08                   addq    $8, %rsp
+# ELF-x86-64:       25: c3                            ret
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+    Content: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
index 96f4813..813801d 100644 (file)
-RUN: rm -f %t.a
-RUN: llvm-ar rcsU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
-RUN: llvm-nm -M %t.a | FileCheck %s
-
-RUN: rm -f %t.a
-RUN: env SYM64_THRESHOLD=1 llvm-ar rcsU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
-RUN: llvm-nm -M %t.a | FileCheck %s
-RUXX: grep SYM64 %t.a
-
-CHECK: Archive map
-CHECK-NEXT: main in trivial-object-test.elf-x86-64
-CHECK-NEXT: foo in trivial-object-test2.elf-x86-64
-CHECK-NEXT: main in trivial-object-test2.elf-x86-64
-CHECK-NOT: bar
-
-
-RUN: rm -f %t.a
-RUN: llvm-ar --format=gnu rcT %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
-RUN: llvm-nm -M %t.a | FileCheck --check-prefix=THIN %s
-
-THIN: Archive map
-THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test.elf-x86-64
-THIN-NEXT: foo in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
-THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
-
-
-CHECK: trivial-object-test.elf-x86-64:
-CHECK-NEXT:                  U SomeOtherFunction
-CHECK-NEXT: 0000000000000000 T main
-CHECK-NEXT:                  U puts
-
-CHECK: trivial-object-test2.elf-x86-64:
-CHECK-NEXT: 0000000000000000 t bar
-CHECK-NEXT: 0000000000000006 T foo
-CHECK-NEXT: 0000000000000016 T main
-
-RUN: rm -f %t.a
-RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
-RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
-
-NOMAP-NOT: Archive map
-
-RUN: llvm-ar s %t.a
-RUN: llvm-nm -M %t.a | FileCheck %s
-
-check that the archive does have a corrupt symbol table.
-RUN: rm -f %t.a
-RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
-RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
-
-CORRUPT: Archive map
-CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
-CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
-CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
-
-CORRUPT: trivial-object-test.elf-x86-64:
-CORRUPT-NEXT:                  U SomeOtherFunction
-CORRUPT-NEXT: 0000000000000000 T main
-CORRUPT-NEXT:                  U puts
-
-CORRUPT: trivial-object-test2.elf-x86-64:
-CORRUPT-NEXT: 0000000000000000 t bar
-CORRUPT-NEXT: 0000000000000006 T foo
-CORRUPT-NEXT: 0000000000000016 T main
-
-check that the we *don't* update the symbol table.
-RUN: llvm-ar s %t.a
-RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
-
-repeate the test with llvm-ranlib
-
-RUN: rm -f %t.a
-RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
-RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
-
-RUN: llvm-ranlib %t.a
-RUN: llvm-nm -M %t.a | FileCheck %s
-
-RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
-RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
-
-BSD-MachO: Archive map
-BSD-MachO: _bar in bar.o
-BSD-MachO: _foo in foo.o
-
-RUN: rm -f %t.a
-RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
-RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
-
-RUN: rm -f %t.a
-RUN: env SYM64_THRESHOLD=1 llvm-ar --format=darwin rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
-RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
-RUN: grep '__\.SYMDEF_64' %t.a
-
-MACHO: Archive map
-MACHO-NEXT: _main in trivial-object-test.macho-x86-64
-MACHO-NEXT: _foo in trivial-object-test2.macho-x86-64
-MACHO-NEXT: _main in trivial-object-test2.macho-x86-64
-MACHO-NOT: {{^}}bar
-
-MACHO: trivial-object-test.macho-x86-64
-MACHO-NEXT: 0000000000000028 s L_.str
-MACHO-NEXT:                  U _SomeOtherFunction
-MACHO-NEXT: 0000000000000000 T _main
-MACHO-NEXT:                  U _puts
-
-MACHO: trivial-object-test2.macho-x86-64
-MACHO-NEXT: 0000000000000000 t _bar
-MACHO-NEXT: 0000000000000001 T _foo
-MACHO-NEXT: 0000000000000002 T _main
-
-RUN: llvm-nm -M %p/Inputs/macho-toc64-archive-x86_64.a | FileCheck --check-prefix=MACHO-TOC64 %s
-
-MACHO-TOC64: Archive map
-MACHO-TOC64-NEXT: _test in test.o
-MACHO-TOC64-NEXT: _test in xtest.o
-
-RUN: rm -f %t.a
-RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
-RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
-
-COFF-SHORT-IMPORT:      Archive map
-COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
-COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
-COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
-COFF-SHORT-IMPORT-NOT:  _bar in coff-short-import-data
-
-Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
-8 + 60 + 36 == 104
-RUN: rm -f %t.a
-RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
-RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
-MACHO-SYMTAB-ALIGN: !<arch>
-MACHO-SYMTAB-ALIGN-NEXT: #1/12           {{..........}}  0     0     0       36        `
-
-Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
-8 + 60 + 52 == 120
-RUN: rm -f %t.a
-RUN: llvm-ar --format=bsd rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test.macho-x86-64
-RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN2 %s < %t.a
-MACHO-SYMTAB-ALIGN2: !<arch>
-MACHO-SYMTAB-ALIGN2-NEXT: #1/12           0           0     0     0       52        `
-
-With a gnu symbol table we only align to two
-8 + 60 + 14 = 82
-RUN: rm -f %t.a
-RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
-RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
-GNU-SYMTAB-ALIGN: !<arch>
-GNU-SYMTAB-ALIGN-NEXT: /               0           0     0     0       14        `
-
-
-** Test the behavior of an empty archive:
-
-No symbol table emitted for GNU archives
-RUN: rm -f %t.a
-RUN: llvm-ar rcs --format=gnu %t.a
-RUN: not grep -q '/               ' %t.a
-
-No symbol table for BSD archives
-RUN: rm -f %t.a
-RUN: llvm-ar rcs --format=bsd %t.a
-RUN: not grep -q '__\.SYMDEF' %t.a
-
-And we do emit a symbol table for DARWIN archives
-RUN: rm -f %t.a
-RUN: llvm-ar rcs --format=darwin %t.a
-RUN: grep -q '__\.SYMDEF' %t.a
+# RUN: yaml2obj -docnum=1 %s > %t.elf-x86-64
+# RUN: yaml2obj -docnum=2 %s > %t2.elf-x86-64
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    bar
+    Type:    STT_FUNC
+    Section: .text
+  - Name:    foo
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Value:   0x0000000000000006
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Value:   0x0000000000000016
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcsU %t.a %t.elf-x86-64 %t2.elf-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck %s
+
+# RUN: rm -f %t.a
+# RUN: env SYM64_THRESHOLD=1 llvm-ar rcsU %t.a %t.elf-x86-64 %t2.elf-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck %s
+# RUXX: grep SYM64 %t.a
+
+# CHECK: Archive map
+# CHECK-NEXT: main in {{.*}}.elf-x86-64
+# CHECK-NEXT: foo in {{.*}}2.elf-x86-64
+# CHECK-NEXT: main in {{.*}}2.elf-x86-64
+# CHECK-NOT: bar
+
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=gnu rcT %t.a %t.elf-x86-64 %t2.elf-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck -DFILE=%/t.elf-x86-64 -DFILE2=%/t2.elf-x86-64 --check-prefix=THIN %s
+
+# THIN: Archive map
+# THIN-NEXT: main in [[FILE]]
+# THIN-NEXT: foo in [[FILE2]]
+# THIN-NEXT: main in [[FILE2]]
+
+
+# CHECK: {{.*}}.elf-x86-64:
+# CHECK-NEXT:                  U SomeOtherFunction
+# CHECK-NEXT: 0000000000000000 T main
+# CHECK-NEXT:                  U puts
+
+# CHECK: {{.*}}2.elf-x86-64:
+# CHECK-NEXT: 0000000000000000 t bar
+# CHECK-NEXT: 0000000000000006 T foo
+# CHECK-NEXT: 0000000000000016 T main
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcSU %t.a %t.elf-x86-64 %t2.elf-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
+
+# NOMAP-NOT: Archive map
+
+# RUN: llvm-ar s %t.a
+# RUN: llvm-nm -M %t.a | FileCheck %s
+
+## Check that the archive does have a corrupt symbol table.
+# RUN: rm -f %t.a
+# RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
+# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
+
+# CORRUPT: Archive map
+# CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
+# CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
+# CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
+
+# CORRUPT: {{.*}}.elf-x86-64:
+# CORRUPT-NEXT:                  U SomeOtherFunction
+# CORRUPT-NEXT: 0000000000000000 T main
+# CORRUPT-NEXT:                  U puts
+
+# CORRUPT: {{.*}}2.elf-x86-64:
+# CORRUPT-NEXT: 0000000000000000 t bar
+# CORRUPT-NEXT: 0000000000000006 T foo
+# CORRUPT-NEXT: 0000000000000016 T main
+
+## Check that the we *don't* update the symbol table.
+# RUN: llvm-ar s %t.a
+# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
+
+## Repeat the test with llvm-ranlib.
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcSU %t.a %t.elf-x86-64 %t2.elf-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
+
+# RUN: llvm-ranlib %t.a
+# RUN: llvm-nm -M %t.a | FileCheck %s
+
+# RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
+# RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
+
+# BSD-MachO: Archive map
+# BSD-MachO: _bar in bar.o
+# BSD-MachO: _foo in foo.o
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
+
+# RUN: rm -f %t.a
+# RUN: env SYM64_THRESHOLD=1 llvm-ar --format=darwin rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
+# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
+# RUN: grep '__\.SYMDEF_64' %t.a
+
+# MACHO: Archive map
+# MACHO-NEXT: _main in trivial-object-test.macho-x86-64
+# MACHO-NEXT: _foo in trivial-object-test2.macho-x86-64
+# MACHO-NEXT: _main in trivial-object-test2.macho-x86-64
+# MACHO-NOT: {{^}}bar
+
+# MACHO: trivial-object-test.macho-x86-64
+# MACHO-NEXT: 0000000000000028 s L_.str
+# MACHO-NEXT:                  U _SomeOtherFunction
+# MACHO-NEXT: 0000000000000000 T _main
+# MACHO-NEXT:                  U _puts
+
+# MACHO: trivial-object-test2.macho-x86-64
+# MACHO-NEXT: 0000000000000000 t _bar
+# MACHO-NEXT: 0000000000000001 T _foo
+# MACHO-NEXT: 0000000000000002 T _main
+
+# RUN: llvm-nm -M %p/Inputs/macho-toc64-archive-x86_64.a | FileCheck --check-prefix=MACHO-TOC64 %s
+
+# MACHO-TOC64: Archive map
+# MACHO-TOC64-NEXT: _test in test.o
+# MACHO-TOC64-NEXT: _test in xtest.o
+
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
+# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
+
+# COFF-SHORT-IMPORT:      Archive map
+# COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
+# COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
+# COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
+# COFF-SHORT-IMPORT-NOT:  _bar in coff-short-import-data
+
+## Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
+## 8 + 60 + 36 == 104
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
+# RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
+# MACHO-SYMTAB-ALIGN: !<arch>
+# MACHO-SYMTAB-ALIGN-NEXT: #1/12           {{..........}}  0     0     0       36        `
+
+## Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
+## 8 + 60 + 52 == 120
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=bsd rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test.macho-x86-64
+# RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN2 %s < %t.a
+# MACHO-SYMTAB-ALIGN2: !<arch>
+# MACHO-SYMTAB-ALIGN2-NEXT: #1/12           0           0     0     0       52        `
+
+## With a gnu symbol table we only align to two
+# 8 + 60 + 14 = 82
+# RUN: rm -f %t.a
+# RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
+# RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
+# GNU-SYMTAB-ALIGN: !<arch>
+# GNU-SYMTAB-ALIGN-NEXT: /               0           0     0     0       14        `
+
+
+## ** Test the behavior of an empty archive:
+
+## No symbol table emitted for GNU archives
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs --format=gnu %t.a
+# RUN: not grep -q '/               ' %t.a
+
+## No symbol table for BSD archives
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs --format=bsd %t.a
+# RUN: not grep -q '__\.SYMDEF' %t.a
+
+## And we do emit a symbol table for DARWIN archives
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs --format=darwin %t.a
+# RUN: grep -q '__\.SYMDEF' %t.a
index f104848..4a0372a 100644 (file)
@@ -1,33 +1,82 @@
-; RUN: echo create %t.a > %t.mri
-; RUN: echo "addmod  \"%p/Inputs/trivial-object-test.elf-x86-64\" " >> %t.mri
-; RUN: echo save >> %t.mri
-; RUN: echo end >> %t.mri
-
-; RUN: llvm-ar -M  < %t.mri
-; RUN: llvm-nm -M %t.a | FileCheck %s
-
-; CHECK:      Archive map
-; CHECK-NEXT: main in trivial-object-test.elf-x86-64
-
-; CHECK:      trivial-object-test.elf-x86-64:
-; CHECK-NEXT:                  U SomeOtherFunction
-; CHECK-NEXT: 0000000000000000 T main
-; CHECK-NEXT:                  U puts
-
-; Now test that CREATE overwrites an existing file.
-; RUN: echo create %t.a > %t2.mri
-; RUN: echo addmod %p/Inputs/trivial-object-test2.elf-x86-64 >> %t2.mri
-; RUN: echo save >> %t2.mri
-; RUN: echo end >> %t2.mri
-
-; RUN: llvm-ar -M  < %t2.mri
-; RUN: llvm-nm -M %t.a | FileCheck --check-prefix=NEW %s
-
-; NEW: Archive map
-; NEW-NEXT: foo in trivial-object-test2.elf-x86-64
-; NEW-NEXT: main in trivial-object-test2.elf-x86-64
-
-; NEW: trivial-object-test2.elf-x86-64:
-; NEW-NEXT: 0000000000000000 t bar
-; NEW-NEXT: 0000000000000006 T foo
-; NEW-NEXT: 0000000000000016 T main
+# RUN: yaml2obj -docnum=1 %s > %t.elf-x86-64
+# RUN: echo create %t.a > %t.mri
+# RUN: echo 'addmod "%t.elf-x86-64"' >> %t.mri
+# RUN: echo save >> %t.mri
+# RUN: echo end >> %t.mri
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Size:    0x0000000000000024
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: llvm-ar -M  < %t.mri
+# RUN: llvm-nm -M %t.a | FileCheck %s
+
+# CHECK:      Archive map
+# CHECK-NEXT: main in {{.*}}elf-x86-64
+
+# CHECK:      {{.*}}elf-x86-64:
+# CHECK-NEXT:                  U SomeOtherFunction
+# CHECK-NEXT: 0000000000000000 T main
+# CHECK-NEXT:                  U puts
+
+## Now test that CREATE overwrites an existing file.
+# RUN: yaml2obj -docnum=2 %s > %t2.elf-x86-64
+
+# RUN: echo create %t.a > %t2.mri
+# RUN: echo addmod %t2.elf-x86-64 >> %t2.mri
+# RUN: echo save >> %t2.mri
+# RUN: echo end >> %t2.mri
+
+# RUN: llvm-ar -M  < %t2.mri
+# RUN: llvm-nm -M %t.a | FileCheck --check-prefix=NEW %s
+
+# NEW: Archive map
+# NEW-NEXT: foo in {{.*}}2.elf-x86-64
+# NEW-NEXT: main in {{.*}}2.elf-x86-64
+
+# NEW: {{.*}}2.elf-x86-64:
+# NEW-NEXT: 0000000000000000 t bar
+# NEW-NEXT: 0000000000000006 T foo
+# NEW-NEXT: 0000000000000016 T main
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    bar
+    Type:    STT_FUNC
+    Section: .text
+  - Name:    foo
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Value:   0x0000000000000006
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Value:   0x0000000000000016
index bed9ccb..9b66e10 100644 (file)
@@ -1,15 +1,19 @@
-Test that llvm-nm returns an error because of the unknown file type, but
-keeps processing subsequent files.
+## Test that llvm-nm returns an error because of the unknown file type, but
+## keeps processing subsequent files.
 
-RUN: touch %t
-RUN: not llvm-nm %p/Inputs/trivial-object-test.elf-i386 %t \
-RUN:             %p/Inputs/trivial-object-test.elf-i386 | \
-RUN: FileCheck %s
+# RUN: yaml2obj %s > %t-i386
+# RUN: touch %t
+# RUN: not llvm-nm %t-i386 %t %t-i386 | FileCheck %s
 
-CHECK:          U SomeOtherFunction
-CHECK: 00000000 T main
-CHECK:          U puts
+# CHECK: U foo
+# CHECK: U foo
 
-CHECK:          U SomeOtherFunction
-CHECK: 00000000 T main
-CHECK:          U puts
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Symbols:
+  - Name:    foo
+    Binding: STB_GLOBAL
index 9865383..6358295 100644 (file)
@@ -1,35 +1,46 @@
-RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
-RUN:         | FileCheck %s -check-prefix ELF-32
-
-ELF-32-NOT: U
-ELF-32: 000012c8 A __bss_start
-ELF-32: 000012c8 A _edata
-ELF-32: 000012cc A _end
-ELF-32: 000012c8 B common_sym
-ELF-32: 000012c4 D defined_sym
-ELF-32: 000001f0 T global_func
-ELF-32: 00000000 D tls_sym
-
-RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
-RUN:         | FileCheck %s -check-prefix ELF-64
-
-ELF-64-NOT: U
-ELF-64: 0000000000200454 A __bss_start
-ELF-64: 0000000000200454 A _edata
-ELF-64: 0000000000200458 A _end
-ELF-64: 0000000000200454 B common_sym
-ELF-64: 0000000000200450 D defined_sym
-ELF-64: 00000000000002f0 T global_func
-ELF-64: 0000000000000000 D tls_sym
-
-RUN: not llvm-nm -D %p/Inputs/weak-global-symbol.macho-i386 2>&1 \
-RUN:         | FileCheck %s -check-prefix ERROR
-
-RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
-RUN:         | FileCheck %s -check-prefix ERROR
-
-ERROR: File format has no dynamic symbol table.
-
-RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 2>&1 \
-RUN:         | FileCheck %s -check-prefix=NO-SYMBOLS
-NO-SYMBOLS: no symbols
+# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
+# RUN:         | FileCheck %s -check-prefix ELF-32
+
+# ELF-32-NOT: U
+# ELF-32: 000012c8 A __bss_start
+# ELF-32: 000012c8 A _edata
+# ELF-32: 000012cc A _end
+# ELF-32: 000012c8 B common_sym
+# ELF-32: 000012c4 D defined_sym
+# ELF-32: 000001f0 T global_func
+# ELF-32: 00000000 D tls_sym
+
+# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
+# RUN:         | FileCheck %s -check-prefix ELF-64
+
+# ELF-64-NOT: U
+# ELF-64: 0000000000200454 A __bss_start
+# ELF-64: 0000000000200454 A _edata
+# ELF-64: 0000000000200458 A _end
+# ELF-64: 0000000000200454 B common_sym
+# ELF-64: 0000000000200450 D defined_sym
+# ELF-64: 00000000000002f0 T global_func
+# ELF-64: 0000000000000000 D tls_sym
+
+# RUN: not llvm-nm -D %p/Inputs/weak-global-symbol.macho-i386 2>&1 \
+# RUN:         | FileCheck %s -check-prefix ERROR
+
+# RUN: not llvm-nm -D %p/Inputs/trivial-object-test.coff-i386 2>&1 \
+# RUN:         | FileCheck %s -check-prefix ERROR
+
+# ERROR: File format has no dynamic symbol table.
+
+# RUN: yaml2obj %s > %t.elf-i386
+# RUN: llvm-nm -D %t.elf-i386 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
+
+# NO-SYMBOLS: no symbols
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Symbols:
+  - Name:    foo
+    Binding: STB_GLOBAL
index 086456e..d2c93ca 100644 (file)
-RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
-RUN:         | FileCheck %s -check-prefix COFF32
-RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
-RUN:         | FileCheck %s -check-prefix COFF64
-RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
-RUN:         | FileCheck %s -check-prefix WASM
-RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
-RUN:         | FileCheck %s -check-prefix ELF
-RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
-RUN:         | FileCheck %s -check-prefix ELF-SIZE
-RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
-RUN:         | FileCheck %s -check-prefix ELF-o
-RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
-RUN:         | FileCheck %s -check-prefix ELF-u
-RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
-RUN:         | FileCheck %s -check-prefix ELF64
-RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
-RUN:         | FileCheck %s -check-prefix WEAK-ELF64
-RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
-RUN:         | FileCheck %s -check-prefix ABSOLUTE-ELF64
-RUN: llvm-nm -a %p/Inputs/IsNAN.o \
-RUN:         | FileCheck %s -check-prefix ELF64-DEBUG-SYMS
-RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
-RUN:         | FileCheck %s -check-prefix macho
-RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
-RUN:         | FileCheck %s -check-prefix macho-U
-RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
-RUN:         | FileCheck %s -check-prefix macho64
-RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-tdb
-RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-j
-RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-r
-RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
-RUN:         | FileCheck %s -check-prefix macho-s
-RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-x
-RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-o
-RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-pa
-RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
-RUN:         | FileCheck %s -check-prefix macho-u
-RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
-RUN:         | FileCheck %s -check-prefix COFF-COMMON
-RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
-RUN:         | FileCheck %s -check-prefix ELF-SEC-ADDR64
-RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
-RUN:         | FileCheck %s -check-prefix ELF-THUMB
-RUN: mkdir -p %t
-RUN: cd %t
-RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
-RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
-
-
-COFF32: 00000000 d .data
-COFF32-NEXT: 00000000 t .text
-COFF32-NEXT: 00000000 d L_.str
-COFF32-NEXT:          U _SomeOtherFunction
-COFF32-NEXT: 00000000 T _main
-COFF32-NEXT:          U _puts
-
-
-WASM:      00000000 d .L.str
-WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
-WASM-NEXT:          U SomeOtherFunction
-WASM-NEXT: 00000001 T main
-WASM-NEXT:          U puts
-WASM-NEXT: 00000010 D var
-
-
-COFF64: 00000000 d .data
-COFF64-NEXT: 00000000 t .text
-COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
-COFF64-NEXT: 00000000 d L.str
-COFF64-NEXT:          U SomeOtherFunction
-COFF64-NEXT: 00000000 T main
-COFF64-NEXT:          U puts
-
-COFF-COMMON: 00000000 b .bss
-COFF-COMMON-NEXT: 00000000 d .data
-COFF-COMMON-NEXT: 00000000 d .drectve
-COFF-COMMON-NEXT: 00000000 n .file
-COFF-COMMON-NEXT: 00000000 r .rdata$zzz
-COFF-COMMON-NEXT: 00000000 t .text
-COFF-COMMON-NEXT:          C _a
-
-
-ELF-NOT:      U
-ELF:          U SomeOtherFunction
-ELF: 00000000 T main
-ELF:          U puts
-
-ELF-SIZE:                        U SomeOtherFunction
-ELF-SIZE-NEXT: 00000000 00000024 T main
-ELF-SIZE-NEXT:                   U puts
-
-ELF-o: {{.*}}/trivial-object-test.elf-i386:          U SomeOtherFunction
-ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
-ELF-o: {{.*}}/trivial-object-test.elf-i386:          U puts
-
-ELF-u:          U SomeOtherFunction
-ELF-u:          U puts
-
-ELF64:                  U SomeOtherFunction
-ELF64: 0000000000000000 T main
-ELF64:                  U puts
-
-WEAK-ELF64:                  w f1
-WEAK-ELF64: 0000000000000000 W f2
-WEAK-ELF64:                  v x1
-WEAK-ELF64: 0000000000000000 V x2
-
-ABSOLUTE-ELF64: 0000000000000123 a a1
-ABSOLUTE-ELF64: 0000000000000123 A a2
-
-ELF64-DEBUG-SYMS: 00000000 b .bss
-ELF64-DEBUG-SYMS-NEXT: 00000000 n .comment
-ELF64-DEBUG-SYMS-NEXT: 00000000 d .data
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_abbrev
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_aranges
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_frame
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_info
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_line
-ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_pubnames
-ELF64-DEBUG-SYMS-NEXT: 00000000 n .note.GNU-stack
-ELF64-DEBUG-SYMS-NEXT: 00000000 t .text
-ELF64-DEBUG-SYMS-NEXT: 00000000 a IsNAN.cpp
-ELF64-DEBUG-SYMS-NEXT: 00000014 T _ZN4llvm5IsNANEd
-ELF64-DEBUG-SYMS-NEXT: 00000000 T _ZN4llvm5IsNANEf
-ELF64-DEBUG-SYMS-NEXT:          U __isnan
-ELF64-DEBUG-SYMS-NEXT:          U __isnanf
-
-macho:          U _SomeOtherFunction
-macho: 00000000 T _main
-macho:          U _puts
-
-macho-U-NOT:          U _SomeOtherFunction
-macho-U: 00000000 T _main
-macho-U-NOT:          U _puts
-
-macho64: 0000000000000028 s L_.str
-macho64:                  U _SomeOtherFunction
-macho64: 0000000000000000 T _main
-macho64:                  U _puts
-
-macho-tdb: 0000000000000030 s EH_frame0
-macho-tdb: 0000000000000070 b _b
-macho-tdb: 000000000000000c D _d
-macho-tdb: 0000000000000000 T _t
-macho-tdb: 0000000000000048 S _t.eh
-
-macho-j: EH_frame0
-macho-j: _b
-macho-j: _d
-macho-j: _t
-macho-j: _t.eh
-
-macho-r: 0000000000000048 S _t.eh
-macho-r-NEXT: 0000000000000000 T _t
-macho-r-NEXT: 000000000000000c D _d
-macho-r-NEXT: 0000000000000070 b _b
-macho-r-NEXT: 0000000000000030 s EH_frame0
-
-macho-s: 000000000000000c D _d
-macho-s-NOT: 0000000000000048 S _t.eh
-macho-s-NOT: 0000000000000000 T _t
-macho-s-NOT: 0000000000000070 b _b
-macho-s-NOT: 0000000000000030 s EH_frame0
-
-macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
-macho-x: 0000000000000070 0e 03 0000 0000000d _b
-macho-x: 000000000000000c 0f 02 0000 00000004 _d
-macho-x: 0000000000000000 0f 01 0000 00000001 _t
-macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
-
-
-macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
-macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
-macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
-macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
-macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
-
-macho-pa: 0000000000000000 - 00 0000    SO /Volumes/SandBox/
-macho-pa: 0000000000000000 - 00 0000    SO hello.c
-macho-pa: 0000000053c8408d - 03 0001   OSO /Volumes/SandBox/hello.o
-macho-pa: 0000000100000f30 - 01 0000 BNSYM
-macho-pa: 0000000100000f30 - 01 0000   FUN _main
-macho-pa: 000000000000003b - 00 0000   FUN
-macho-pa: 000000000000003b - 01 0000 ENSYM
-macho-pa: 0000000000000000 - 01 0000    SO
-macho-pa: 0000000100000000 T __mh_execute_header
-macho-pa: 0000000100000f30 T _main
-macho-pa:                  U _printf
-macho-pa:                  U dyld_stub_binder
-
-macho-u: _printf
-macho-u: dyld_stub_binder
-
-Test that nm uses addresses even with ELF .o files.
-ELF-SEC-ADDR64:      0000000000000058 D a
-ELF-SEC-ADDR64-NEXT: 000000000000005c D b
-ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
-ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
-ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
-
-
-Test that we drop the thumb bit only from function addresses.
-ELF-THUMB: 00000000 t f
-ELF-THUMB: 00000003 t g
-
-A-OUT:          U _SomeOtherFunction
-A-OUT: 00000000 T _main
-A-OUT:          U _puts
+# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
+# RUN:         | FileCheck %s -check-prefix COFF32
+
+# COFF32: 00000000 d .data
+# COFF32-NEXT: 00000000 t .text
+# COFF32-NEXT: 00000000 d L_.str
+# COFF32-NEXT:          U _SomeOtherFunction
+# COFF32-NEXT: 00000000 T _main
+# COFF32-NEXT:          U _puts
+
+# RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
+# RUN:         | FileCheck %s -check-prefix COFF64
+
+# COFF64: 00000000 d .data
+# COFF64-NEXT: 00000000 t .text
+# COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
+# COFF64-NEXT: 00000000 d L.str
+# COFF64-NEXT:          U SomeOtherFunction
+# COFF64-NEXT: 00000000 T main
+# COFF64-NEXT:          U puts
+
+# RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
+# RUN:         | FileCheck %s -check-prefix WASM
+
+# WASM:      00000000 d .L.str
+# WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
+# WASM-NEXT:          U SomeOtherFunction
+# WASM-NEXT: 00000001 T main
+# WASM-NEXT:          U puts
+# WASM-NEXT: 00000010 D var
+
+# RUN: yaml2obj -docnum=1 %s > %t.elf-i386
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Size:    0x0000000000000024
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: llvm-nm %t.elf-i386 | FileCheck %s -check-prefix=ELF
+
+# ELF-NOT: U
+# ELF:          U SomeOtherFunction
+# ELF: 00000000 T main
+# ELF:          U puts
+
+# RUN: llvm-nm -o %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix=ELF-o
+
+# RUN: llvm-nm %t.elf-i386 -S | FileCheck %s -check-prefix ELF-SIZE
+
+# ELF-SIZE:                        U SomeOtherFunction
+# ELF-SIZE-NEXT: 00000000 00000024 T main
+# ELF-SIZE-NEXT:                   U puts
+
+# ELF-o-NOT: U
+# ELF-o: [[FILE]]:          U SomeOtherFunction
+# ELF-o: [[FILE]]: 00000000 T main
+# ELF-o: [[FILE]]:          U puts
+
+# RUN: llvm-nm -u %t.elf-i386 | FileCheck %s -check-prefix ELF-u
+
+# ELF-u: U SomeOtherFunction
+# ELF-u: U puts
+
+# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
+# RUN: llvm-nm %t.elf-x86-64 | FileCheck %s -check-prefix ELF64
+
+# ELF64:                  U SomeOtherFunction
+# ELF64: 0000000000000000 T main
+# ELF64:                  U puts
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  .text
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+Symbols:
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Size:    0x0000000000000024
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
+# RUN:         | FileCheck %s -check-prefix WEAK-ELF64
+
+# WEAK-ELF64:                  w f1
+# WEAK-ELF64: 0000000000000000 W f2
+# WEAK-ELF64:                  v x1
+# WEAK-ELF64: 0000000000000000 V x2
+
+# RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
+# RUN:         | FileCheck %s -check-prefix ABSOLUTE-ELF64
+
+# ABSOLUTE-ELF64: 0000000000000123 a a1
+# ABSOLUTE-ELF64: 0000000000000123 A a2
+
+# RUN: llvm-nm -a %p/Inputs/IsNAN.o \
+# RUN:         | FileCheck %s -check-prefix ELF64-DEBUG-SYMS
+
+# ELF64-DEBUG-SYMS: 00000000 b .bss
+# ELF64-DEBUG-SYMS-NEXT: 00000000 n .comment
+# ELF64-DEBUG-SYMS-NEXT: 00000000 d .data
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_abbrev
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_aranges
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_frame
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_info
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_line
+# ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_pubnames
+# ELF64-DEBUG-SYMS-NEXT: 00000000 n .note.GNU-stack
+# ELF64-DEBUG-SYMS-NEXT: 00000000 t .text
+# ELF64-DEBUG-SYMS-NEXT: 00000000 a IsNAN.cpp
+# ELF64-DEBUG-SYMS-NEXT: 00000014 T _ZN4llvm5IsNANEd
+# ELF64-DEBUG-SYMS-NEXT: 00000000 T _ZN4llvm5IsNANEf
+# ELF64-DEBUG-SYMS-NEXT:          U __isnan
+# ELF64-DEBUG-SYMS-NEXT:          U __isnanf
+
+# RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
+# RUN:         | FileCheck %s -check-prefix ELF-SEC-ADDR64
+
+## Test that llvm-nm uses addresses even with ELF .o files.
+# ELF-SEC-ADDR64:      0000000000000058 D a
+# ELF-SEC-ADDR64-NEXT: 000000000000005c D b
+# ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
+# ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
+# ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
+
+# RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
+# RUN:         | FileCheck %s -check-prefix ELF-THUMB
+
+## Test that we drop the thumb bit only from function addresses.
+# ELF-THUMB: 00000000 t f
+# ELF-THUMB: 00000003 t g
+
+# RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
+# RUN:         | FileCheck %s -check-prefix macho
+
+# macho:          U _SomeOtherFunction
+# macho: 00000000 T _main
+# macho:          U _puts
+
+# RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
+# RUN:         | FileCheck %s -check-prefix macho-U
+
+# macho-U-NOT:          U _SomeOtherFunction
+# macho-U: 00000000 T _main
+# macho-U-NOT:          U _puts
+
+# RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
+# RUN:         | FileCheck %s -check-prefix macho64
+
+# macho64: 0000000000000028 s L_.str
+# macho64:                  U _SomeOtherFunction
+# macho64: 0000000000000000 T _main
+# macho64:                  U _puts
+
+# RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-tdb
+
+# macho-tdb: 0000000000000030 s EH_frame0
+# macho-tdb: 0000000000000070 b _b
+# macho-tdb: 000000000000000c D _d
+# macho-tdb: 0000000000000000 T _t
+# macho-tdb: 0000000000000048 S _t.eh
+
+# RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-j
+
+# macho-j: EH_frame0
+# macho-j: _b
+# macho-j: _d
+# macho-j: _t
+# macho-j: _t.eh
+
+# RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-r
+
+# macho-r: 0000000000000048 S _t.eh
+# macho-r-NEXT: 0000000000000000 T _t
+# macho-r-NEXT: 000000000000000c D _d
+# macho-r-NEXT: 0000000000000070 b _b
+# macho-r-NEXT: 0000000000000030 s EH_frame0
+
+# RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
+# RUN:         | FileCheck %s -check-prefix macho-s
+
+# macho-s: 000000000000000c D _d
+# macho-s-NOT: 0000000000000048 S _t.eh
+# macho-s-NOT: 0000000000000000 T _t
+# macho-s-NOT: 0000000000000070 b _b
+# macho-s-NOT: 0000000000000030 s EH_frame0
+
+# RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-x
+
+# macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
+# macho-x: 0000000000000070 0e 03 0000 0000000d _b
+# macho-x: 000000000000000c 0f 02 0000 00000004 _d
+# macho-x: 0000000000000000 0f 01 0000 00000001 _t
+# macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
+
+# RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-o
+
+# macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
+# macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
+# macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
+# macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
+# macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
+
+# RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-pa
+
+# macho-pa: 0000000000000000 - 00 0000    SO /Volumes/SandBox/
+# macho-pa: 0000000000000000 - 00 0000    SO hello.c
+# macho-pa: 0000000053c8408d - 03 0001   OSO /Volumes/SandBox/hello.o
+# macho-pa: 0000000100000f30 - 01 0000 BNSYM
+# macho-pa: 0000000100000f30 - 01 0000   FUN _main
+# macho-pa: 000000000000003b - 00 0000   FUN
+# macho-pa: 000000000000003b - 01 0000 ENSYM
+# macho-pa: 0000000000000000 - 01 0000    SO
+# macho-pa: 0000000100000000 T __mh_execute_header
+# macho-pa: 0000000100000f30 T _main
+# macho-pa:                  U _printf
+# macho-pa:                  U dyld_stub_binder
+
+# RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
+# RUN:         | FileCheck %s -check-prefix macho-u
+
+# macho-u: _printf
+# macho-u: dyld_stub_binder
+
+# RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
+# RUN:         | FileCheck %s -check-prefix COFF-COMMON
+
+# COFF-COMMON: 00000000 b .bss
+# COFF-COMMON-NEXT: 00000000 d .data
+# COFF-COMMON-NEXT: 00000000 d .drectve
+# COFF-COMMON-NEXT: 00000000 n .file
+# COFF-COMMON-NEXT: 00000000 r .rdata$zzz
+# COFF-COMMON-NEXT: 00000000 t .text
+# COFF-COMMON-NEXT:          C _a
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
+# RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
+
+# A-OUT:          U _SomeOtherFunction
+# A-OUT: 00000000 T _main
+# A-OUT:          U _puts
index 043bf79..00457ee 100644 (file)
-RUN: obj2yaml %p/Inputs/trivial-object-test.coff-i386 | FileCheck %s --check-prefix COFF-I386
-RUN: obj2yaml %p/Inputs/trivial-object-test.coff-x86-64 | FileCheck %s --check-prefix COFF-X86-64
-RUN: obj2yaml %p/Inputs/trivial-object-test.coff-armnt | FileCheck %s --check-prefix COFF-ARMNT
-RUN: obj2yaml %p/Inputs/trivial-object-test.coff-arm64 | FileCheck %s --check-prefix COFF-ARM64
-RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL
-RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL
-RUN: obj2yaml %p/Inputs/trivial-object-test.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64
-RUN: obj2yaml %p/Inputs/trivial-object-test.elf-avr | FileCheck %s --check-prefix ELF-AVR
-RUN: obj2yaml %p/Inputs/trivial-object-test.wasm | FileCheck %s --check-prefix WASM
-RUN: obj2yaml %p/Inputs/unwind-section.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64-UNWIND
-
-COFF-I386: header:
-COFF-I386-NEXT:  Machine: IMAGE_FILE_MACHINE_I386
-
-COFF-I386: sections:
-COFF-I386-NEXT:  - Name: .text
-COFF-I386-NEXT:    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
-COFF-I386-NEXT:    Alignment: 16
-COFF-I386-NEXT:    SectionData:  83EC0CC744240800000000C7042400000000E800000000E8000000008B44240883C40CC3
-
-COFF-I386:    Relocations:
-COFF-I386-NEXT:      - VirtualAddress: 14
-COFF-I386-NEXT:        SymbolName: L_.str
-COFF-I386-NEXT:        Type: IMAGE_REL_I386_DIR32
-
-COFF-I386:           - VirtualAddress: 19
-COFF-I386-NEXT:        SymbolName: _puts
-COFF-I386-NEXT:        Type: IMAGE_REL_I386_REL32
-
-COFF-I386:           - VirtualAddress: 24
-COFF-I386-NEXT:        SymbolName: _SomeOtherFunction
-COFF-I386-NEXT:        Type: IMAGE_REL_I386_REL32
-
-COFF-I386:       - Name: .data
-COFF-I386-NEXT:    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-I386-NEXT:    Alignment: 1
-COFF-I386-NEXT:    SectionData: 48656C6C6F20576F726C642100
-
-COFF-I386: symbols:
-COFF-I386-NEXT:  - Name: .text
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 1
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT:    SectionDefinition:
-COFF-I386-NEXT:      Length:          36
-COFF-I386-NEXT:      NumberOfRelocations: 3
-COFF-I386-NEXT:      NumberOfLinenumbers: 0
-COFF-I386-NEXT:      CheckSum:        0
-COFF-I386-NEXT:      Number:          1
-
-COFF-I386:       - Name: .data
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 2
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT:    SectionDefinition:
-COFF-I386-NEXT:      Length:          13
-COFF-I386-NEXT:      NumberOfRelocations: 0
-COFF-I386-NEXT:      NumberOfLinenumbers: 0
-COFF-I386-NEXT:      CheckSum:        0
-COFF-I386-NEXT:      Number:          2
-
-COFF-I386:       - Name: _main
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 1
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_FUNCTION
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-I386:       - Name: L_.str
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 2
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
-
-COFF-I386:       - Name: _puts
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 0
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-I386:       - Name: _SomeOtherFunction
-COFF-I386-NEXT:    Value: 0
-COFF-I386-NEXT:    SectionNumber: 0
-COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-
-COFF-X86-64: header:
-COFF-X86-64-NEXT:  Machine: IMAGE_FILE_MACHINE_AMD64
-
-COFF-X86-64: sections:
-COFF-X86-64-NEXT:   - Name: .text
-COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
-COFF-X86-64-NEXT:     Alignment: 16
-COFF-X86-64-NEXT:     SectionData: 4883EC28C744242400000000488D0D00000000E800000000E8000000008B4424244883C428C3
-
-COFF-X86-64:     Relocations:
-COFF-X86-64-NEXT:       - VirtualAddress: 15
-COFF-X86-64-NEXT:         SymbolName: L.str
-COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
-
-COFF-X86-64:            - VirtualAddress: 20
-COFF-X86-64-NEXT:         SymbolName: puts
-COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
-
-COFF-X86-64:            - VirtualAddress: 25
-COFF-X86-64-NEXT:         SymbolName: SomeOtherFunction
-COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
-
-COFF-X86-64:        - Name: .data
-COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-X86-64-NEXT:     Alignment: 1
-COFF-X86-64-NEXT:     SectionData: 48656C6C6F20576F726C642100
-
-COFF-X86-64:        - Name: '.CRT$XCU'
-COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
-COFF-X86-64-NEXT:     Alignment: 8
-COFF-X86-64-NEXT:     SectionData:  '0000000000000000'
-
-COFF-X86-64:     Relocations:
-COFF-X86-64-NEXT:       - VirtualAddress: 0
-COFF-X86-64-NEXT:         SymbolName: '??__Ex@@YAXXZ'
-COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_ADDR64
-
-COFF-X86-64: symbols:
-COFF-X86-64-NEXT:   - Name: .text
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 1
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-X86-64-NEXT:    SectionDefinition:
-COFF-X86-64-NEXT:      Length:          38
-COFF-X86-64-NEXT:      NumberOfRelocations: 3
-COFF-X86-64-NEXT:      NumberOfLinenumbers: 0
-COFF-X86-64-NEXT:      CheckSum:        0
-COFF-X86-64-NEXT:      Number:          1
-
-COFF-X86-64:        - Name: .data
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 2
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-X86-64-NEXT:    SectionDefinition:
-COFF-X86-64-NEXT:      Length:          13
-COFF-X86-64-NEXT:      NumberOfRelocations: 0
-COFF-X86-64-NEXT:      NumberOfLinenumbers: 0
-COFF-X86-64-NEXT:      CheckSum:        0
-COFF-X86-64-NEXT:      Number:          2
-
-COFF-X86-64:        - Name: main
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 1
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_FUNCTION
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-X86-64:        - Name: L.str
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 2
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-
-COFF-X86-64:        - Name: puts
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 0
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-X86-64:        - Name: SomeOtherFunction
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 0
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-X86-64:        - Name: '??__Ex@@YAXXZ'
-COFF-X86-64-NEXT:     Value: 0
-COFF-X86-64-NEXT:     SectionNumber: 3
-COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_FUNCTION
-COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-
-COFF-ARMNT: header:
-COFF-ARMNT-NEXT:  Machine: IMAGE_FILE_MACHINE_ARMNT
-
-COFF-ARMNT: sections:
-COFF-ARMNT-NEXT:   - Name: .text
-COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
-COFF-ARMNT-NEXT:     Alignment: 4
-COFF-ARMNT-NEXT:     SectionData: 00F000F87047
-
-COFF-ARMNT:     Relocations:
-COFF-ARMNT-NEXT:       - VirtualAddress: 0
-COFF-ARMNT-NEXT:         SymbolName: otherFunc
-COFF-ARMNT-NEXT:         Type: IMAGE_REL_ARM_BLX23T
-
-COFF-ARMNT:        - Name: .data
-COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-ARMNT-NEXT:     Alignment: 4
-COFF-ARMNT-NEXT:     SectionData: ''
-
-COFF-ARMNT:        - Name: .bss
-COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-ARMNT-NEXT:     Alignment: 4
-COFF-ARMNT-NEXT:     SectionData: ''
-
-COFF-ARMNT: symbols:
-COFF-ARMNT-NEXT:   - Name: .text
-COFF-ARMNT-NEXT:     Value: 0
-COFF-ARMNT-NEXT:     SectionNumber: 1
-COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARMNT-NEXT:     SectionDefinition:
-COFF-ARMNT-NEXT:       Length:          6
-COFF-ARMNT-NEXT:       NumberOfRelocations: 1
-COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
-COFF-ARMNT-NEXT:       CheckSum:        879026160
-COFF-ARMNT-NEXT:       Number:          1
-
-COFF-ARMNT:        - Name: .data
-COFF-ARMNT-NEXT:     Value: 0
-COFF-ARMNT-NEXT:     SectionNumber: 2
-COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARMNT-NEXT:     SectionDefinition:
-COFF-ARMNT-NEXT:       Length:          0
-COFF-ARMNT-NEXT:       NumberOfRelocations: 0
-COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
-COFF-ARMNT-NEXT:       CheckSum:        0
-COFF-ARMNT-NEXT:       Number:          2
-
-COFF-ARMNT:        - Name: .bss
-COFF-ARMNT-NEXT:     Value: 0
-COFF-ARMNT-NEXT:     SectionNumber: 3
-COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARMNT-NEXT:     SectionDefinition:
-COFF-ARMNT-NEXT:       Length:          0
-COFF-ARMNT-NEXT:       NumberOfRelocations: 0
-COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
-COFF-ARMNT-NEXT:       CheckSum:        0
-COFF-ARMNT-NEXT:       Number:          3
-
-COFF-ARMNT:        - Name: main
-COFF-ARMNT-NEXT:     Value: 0
-COFF-ARMNT-NEXT:     SectionNumber: 1
-COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-ARMNT:        - Name: otherFunc
-COFF-ARMNT-NEXT:     Value: 0
-COFF-ARMNT-NEXT:     SectionNumber: 0
-COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-ARM64: header:
-COFF-ARM64-NEXT:  Machine: IMAGE_FILE_MACHINE_ARM64
-
-COFF-ARM64: sections:
-COFF-ARM64-NEXT:   - Name: .text
-COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
-COFF-ARM64-NEXT:     Alignment: 4
-COFF-ARM64-NEXT:     SectionData: 00000094C0035FD6
-
-COFF-ARM64:     Relocations:
-COFF-ARM64-NEXT:       - VirtualAddress: 0
-COFF-ARM64-NEXT:         SymbolName: otherFunc
-COFF-ARM64-NEXT:         Type: IMAGE_REL_ARM64_BRANCH26
-
-COFF-ARM64:        - Name: .data
-COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-ARM64-NEXT:     Alignment: 4
-COFF-ARM64-NEXT:     SectionData: ''
-
-COFF-ARM64:        - Name: .bss
-COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
-COFF-ARM64-NEXT:     Alignment: 4
-COFF-ARM64-NEXT:     SectionData: ''
-
-COFF-ARM64: symbols:
-COFF-ARM64-NEXT:   - Name: .text
-COFF-ARM64-NEXT:     Value: 0
-COFF-ARM64-NEXT:     SectionNumber: 1
-COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARM64-NEXT:     SectionDefinition:
-COFF-ARM64-NEXT:       Length:          8
-COFF-ARM64-NEXT:       NumberOfRelocations: 1
-COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
-COFF-ARM64-NEXT:       CheckSum:        35579893
-COFF-ARM64-NEXT:       Number:          1
-
-COFF-ARM64:        - Name: .data
-COFF-ARM64-NEXT:     Value: 0
-COFF-ARM64-NEXT:     SectionNumber: 2
-COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARM64-NEXT:     SectionDefinition:
-COFF-ARM64-NEXT:       Length:          0
-COFF-ARM64-NEXT:       NumberOfRelocations: 0
-COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
-COFF-ARM64-NEXT:       CheckSum:        0
-COFF-ARM64-NEXT:       Number:          2
-
-COFF-ARM64:        - Name: .bss
-COFF-ARM64-NEXT:     Value: 0
-COFF-ARM64-NEXT:     SectionNumber: 3
-COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-ARM64-NEXT:     SectionDefinition:
-COFF-ARM64-NEXT:       Length:          0
-COFF-ARM64-NEXT:       NumberOfRelocations: 0
-COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
-COFF-ARM64-NEXT:       CheckSum:        0
-COFF-ARM64-NEXT:       Number:          3
-
-COFF-ARM64:        - Name: main
-COFF-ARM64-NEXT:     Value: 0
-COFF-ARM64-NEXT:     SectionNumber: 1
-COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-COFF-ARM64:        - Name: otherFunc
-COFF-ARM64-NEXT:     Value: 0
-COFF-ARM64-NEXT:     SectionNumber: 0
-COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
-COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
-COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
-
-ELF-MIPSEL:      FileHeader:
-ELF-MIPSEL-NEXT:   Class:           ELFCLASS32
-ELF-MIPSEL-NEXT:   Data:            ELFDATA2LSB
-ELF-MIPSEL-NEXT:   OSABI:           ELFOSABI_GNU
-ELF-MIPSEL-NEXT:   Type:            ET_REL
-ELF-MIPSEL-NEXT:   Machine:         EM_MIPS
-ELF-MIPSEL-NEXT:   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
-ELF-MIPSEL-NEXT: Sections:
-ELF-MIPSEL-NEXT:   - Name:            .text
-ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
-ELF-MIPSEL-NEXT:     Content:         0000023C00004224E8FFBD271400BFAF1000B0AF218059000000018E000024240000198E09F8200321E000020000198E09F8200321E00002000002241000B08F1400BF8F0800E0031800BD27
-ELF-MIPSEL-NEXT:   - Name:            .rel.text
-ELF-MIPSEL-NEXT:     Type:            SHT_REL
-ELF-MIPSEL-NEXT:     Link:            .symtab
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
-ELF-MIPSEL-NEXT:     EntSize:         0x0000000000000008
-ELF-MIPSEL-NEXT:     Info:            .text
-ELF-MIPSEL-NEXT:     Relocations:
-ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000000
-ELF-MIPSEL-NEXT:         Symbol:          _gp_disp
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_HI16
-ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000004
-ELF-MIPSEL-NEXT:         Symbol:          _gp_disp
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_LO16
-ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000018
-ELF-MIPSEL-NEXT:         Symbol:          '$.str'
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_GOT16
-ELF-MIPSEL-NEXT:       - Offset:          0x000000000000001C
-ELF-MIPSEL-NEXT:         Symbol:          '$.str'
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_LO16
-ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000020
-ELF-MIPSEL-NEXT:         Symbol:          puts
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_CALL16
-ELF-MIPSEL-NEXT:       - Offset:          0x000000000000002C
-ELF-MIPSEL-NEXT:         Symbol:          SomeOtherFunction
-ELF-MIPSEL-NEXT:         Type:            R_MIPS_CALL16
-ELF-MIPSEL-NEXT:   - Name:            .data
-ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
-ELF-MIPSEL-NEXT:   - Name:            .bss
-ELF-MIPSEL-NEXT:     Type:            SHT_NOBITS
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
-ELF-MIPSEL-NEXT:     Size:            0x0000000000000004
-ELF-MIPSEL-NEXT:   - Name:            .mdebug.abi32
-ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
-ELF-MIPSEL-NEXT:   - Name:            .rodata.str1.1
-ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
-ELF-MIPSEL-NEXT:     EntSize:         0x0000000000000001
-ELF-MIPSEL-NEXT:     Content:         48656C6C6F20576F726C640A00
-ELF-MIPSEL-NEXT:   - Name:            .reginfo
-ELF-MIPSEL-NEXT:     Type:            SHT_MIPS_REGINFO
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
-ELF-MIPSEL-NEXT:     Content:         '000000000000000000000000000000000000000000000000'
-ELF-MIPSEL-NEXT:   - Name:            .MIPS.abiflags
-ELF-MIPSEL-NEXT:     Type:            SHT_MIPS_ABIFLAGS
-ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC ]
-ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000008
-ELF-MIPSEL-NEXT:     ISA:             MIPS32
-ELF-MIPSEL-NEXT:     ISARevision:     0x01
-ELF-MIPSEL-NEXT:     FpABI:           FP_DOUBLE
-ELF-MIPSEL-NEXT:     GPRSize:         REG_32
-ELF-MIPSEL-NEXT:     CPR1Size:        REG_32
-ELF-MIPSEL-NEXT:     Flags1:          [ ODDSPREG ]
-ELF-MIPSEL-NEXT: Symbols:
-ELF-MIPSEL-NEXT:     - Name:            trivial.ll
-ELF-MIPSEL-NEXT:       Type:            STT_FILE
-ELF-MIPSEL-NEXT:       Index:           SHN_ABS
-ELF-MIPSEL-NEXT:     - Name:            '$.str'
-ELF-MIPSEL-NEXT:       Type:            STT_OBJECT
-ELF-MIPSEL-NEXT:       Section:         .rodata.str1.1
-ELF-MIPSEL-NEXT:       Size:            0x000000000000000D
-ELF-MIPSEL-NEXT:     - Name:            .text
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .text
-ELF-MIPSEL-NEXT:     - Name:            .data
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .data
-ELF-MIPSEL-NEXT:     - Name:            .bss
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .bss
-ELF-MIPSEL-NEXT:     - Name:            .mdebug.abi32
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .mdebug.abi32
-ELF-MIPSEL-NEXT:     - Name:            .rodata.str1.1
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .rodata.str1.1
-ELF-MIPSEL-NEXT:     - Name:            .reginfo
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .reginfo
-ELF-MIPSEL-NEXT:     - Name:            .MIPS.abiflags
-ELF-MIPSEL-NEXT:       Type:            STT_SECTION
-ELF-MIPSEL-NEXT:       Section:         .MIPS.abiflags
-ELF-MIPSEL-NEXT:     - Name:            main
-ELF-MIPSEL-NEXT:       Type:            STT_FUNC
-ELF-MIPSEL-NEXT:       Section:         .text
-ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
-ELF-MIPSEL-NEXT:       Size:            0x000000000000004C
-ELF-MIPSEL-NEXT:     - Name:            var
-ELF-MIPSEL-NEXT:       Type:            STT_OBJECT
-ELF-MIPSEL-NEXT:       Section:         .bss
-ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
-ELF-MIPSEL-NEXT:       Size:            0x0000000000000004
-ELF-MIPSEL-NEXT:     - Name:            SomeOtherFunction
-ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
-ELF-MIPSEL-NEXT:     - Name:            _gp_disp
-ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
-ELF-MIPSEL-NEXT:     - Name:            puts
-ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
-
-ELF-MIPS64EL:      FileHeader:
-ELF-MIPS64EL-NEXT:   Class:           ELFCLASS64
-ELF-MIPS64EL-NEXT:   Data:            ELFDATA2LSB
-ELF-MIPS64EL-NEXT:   Type:            ET_REL
-ELF-MIPS64EL-NEXT:   Machine:         EM_MIPS
-ELF-MIPS64EL-NEXT:   Flags:           [ EF_MIPS_ARCH_3 ]
-ELF-MIPS64EL-NEXT: Sections:
-ELF-MIPS64EL-NEXT:   - Name:            .text
-ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPS64EL-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
-ELF-MIPS64EL-NEXT:   - Name:            .data
-ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPS64EL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
-ELF-MIPS64EL-NEXT:     Content:         '00000000000000000000000000000000'
-ELF-MIPS64EL-NEXT:   - Name:            .rela.data
-ELF-MIPS64EL-NEXT:     Type:            SHT_RELA
-ELF-MIPS64EL-NEXT:     Link:            .symtab
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000008
-ELF-MIPS64EL-NEXT:     EntSize:         0x0000000000000018
-ELF-MIPS64EL-NEXT:     Info:            .data
-ELF-MIPS64EL-NEXT:     Relocations:
-ELF-MIPS64EL-NEXT:       - Offset:          0
-ELF-MIPS64EL-NEXT:         Symbol:          zed
-ELF-MIPS64EL-NEXT:         Type:            R_MIPS_64
-ELF-MIPS64EL-NEXT:   - Name:            .bss
-ELF-MIPS64EL-NEXT:     Type:            SHT_NOBITS
-ELF-MIPS64EL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
-ELF-MIPS64EL-NEXT:   - Name:            .MIPS.options
-ELF-MIPS64EL-NEXT:     Type:            SHT_MIPS_OPTIONS
-ELF-MIPS64EL-NEXT:     Flags:           [ SHF_ALLOC, SHF_MIPS_NOSTRIP ]
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000008
-ELF-MIPS64EL-NEXT:     EntSize:         0x0000000000000001
-ELF-MIPS64EL-NEXT:     Content:         '01280000000000000000000000000000000000000000000000000000000000000000000000000000'
-ELF-MIPS64EL-NEXT:   - Name:            .pdr
-ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
-ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000004
-ELF-MIPS64EL-NEXT: Symbols:
-ELF-MIPS64EL-NEXT:     - Name:            .text
-ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
-ELF-MIPS64EL-NEXT:       Section:         .text
-ELF-MIPS64EL-NEXT:     - Name:            .data
-ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
-ELF-MIPS64EL-NEXT:       Section:         .data
-ELF-MIPS64EL-NEXT:     - Name:            .bss
-ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
-ELF-MIPS64EL-NEXT:       Section:         .bss
-ELF-MIPS64EL-NEXT:     - Name:            bar
-ELF-MIPS64EL-NEXT:       Section:         .data
-ELF-MIPS64EL-NEXT:     - Name:            .MIPS.options
-ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
-ELF-MIPS64EL-NEXT:       Section:         .MIPS.options
-ELF-MIPS64EL-NEXT:     - Name:            .pdr
-ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
-ELF-MIPS64EL-NEXT:       Section:         .pdr
-ELF-MIPS64EL-NEXT:     - Name:            zed
-ELF-MIPS64EL-NEXT:       Binding:         STB_GLOBAL
-
-ELF-X86-64:      FileHeader:
-ELF-X86-64-NEXT:   Class:           ELFCLASS64
-ELF-X86-64-NEXT:   Data:            ELFDATA2LSB
-ELF-X86-64-NEXT:   OSABI:           ELFOSABI_GNU
-ELF-X86-64-NEXT:   Type:            ET_REL
-ELF-X86-64-NEXT:   Machine:         EM_X86_64
-ELF-X86-64-NEXT: Sections:
-ELF-X86-64-NEXT:   - Name:            .text
-ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
-ELF-X86-64-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000010
-ELF-X86-64-NEXT:     Content:         4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
-ELF-X86-64-NEXT:   - Name:            .rodata.str1.1
-ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
-ELF-X86-64-NEXT:     Flags:           [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
-ELF-X86-64-NEXT:     Address:         0x0000000000000026
-ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000001
-ELF-X86-64-NEXT:     Content:         48656C6C6F20576F726C642100
-ELF-X86-64-NEXT:   - Name:            .note.GNU-stack
-ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
-ELF-X86-64-NEXT:     Address:         0x0000000000000033
-ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000001
-ELF-X86-64-NEXT:   - Name:            .rela.text
-ELF-X86-64-NEXT:     Type:            SHT_RELA
-ELF-X86-64-NEXT:     Address:         0x0000000000000038
-ELF-X86-64-NEXT:     Link:            .symtab
-ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000008
-ELF-X86-64-NEXT:     EntSize:         0x0000000000000018
-ELF-X86-64-NEXT:     Info:            .text
-ELF-X86-64-NEXT:     Relocations:
-ELF-X86-64-NEXT:       - Offset:          0x000000000000000D
-ELF-X86-64-NEXT:         Symbol:          .rodata.str1.1
-ELF-X86-64-NEXT:         Type:            R_X86_64_32S
-ELF-X86-64-NEXT:       - Offset:          0x0000000000000012
-ELF-X86-64-NEXT:         Symbol:          puts
-ELF-X86-64-NEXT:         Type:            R_X86_64_PC32
-ELF-X86-64-NEXT:         Addend:          -4
-ELF-X86-64-NEXT:       - Offset:          0x0000000000000019
-ELF-X86-64-NEXT:         Symbol:          SomeOtherFunction
-ELF-X86-64-NEXT:         Type:            R_X86_64_PC32
-ELF-X86-64-NEXT:         Addend:          -4
-ELF-X86-64-NEXT: Symbols:
-ELF-X86-64-NEXT:     - Name:            trivial-object-test.s
-ELF-X86-64-NEXT:       Type:            STT_FILE
-ELF-X86-64-NEXT:       Index:           SHN_ABS
-ELF-X86-64-NEXT:     - Name:            .text
-ELF-X86-64-NEXT:       Type:            STT_SECTION
-ELF-X86-64-NEXT:       Section:         .text
-ELF-X86-64-NEXT:     - Name:            .rodata.str1.1
-ELF-X86-64-NEXT:       Type:            STT_SECTION
-ELF-X86-64-NEXT:       Section:         .rodata.str1.1
-ELF-X86-64-NEXT:     - Name:            .note.GNU-stack
-ELF-X86-64-NEXT:       Type:            STT_SECTION
-ELF-X86-64-NEXT:       Section:         .note.GNU-stack
-ELF-X86-64-NEXT:     - Name:            main
-ELF-X86-64-NEXT:       Type:            STT_FUNC
-ELF-X86-64-NEXT:       Section:         .text
-ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
-ELF-X86-64-NEXT:       Size:            0x0000000000000026
-ELF-X86-64-NEXT:     - Name:            SomeOtherFunction
-ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
-ELF-X86-64-NEXT:     - Name:            puts
-ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
-
-ELF-AVR:      FileHeader:
-ELF-AVR-NEXT:   Class:           ELFCLASS32
-ELF-AVR-NEXT:   Data:            ELFDATA2LSB
-ELF-AVR-NEXT:   Type:            ET_EXEC
-ELF-AVR-NEXT:   Machine:         EM_AVR
-ELF-AVR-NEXT:   Flags:           [ EF_AVR_ARCH_AVR2 ]
-ELF-AVR-NEXT: Sections:
-ELF-AVR-NEXT:   - Name:            .text
-ELF-AVR-NEXT:     Type:            SHT_PROGBITS
-ELF-AVR-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-ELF-AVR-NEXT:     AddressAlign:    0x0000000000000002
-ELF-AVR-NEXT:     Content:         C20E0895
-ELF-AVR-NEXT:   - Name:            .data
-ELF-AVR-NEXT:     Type:            SHT_PROGBITS
-ELF-AVR-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
-ELF-AVR-NEXT:     Address:         0x0000000000800060
-ELF-AVR-NEXT:     AddressAlign:    0x0000000000000001
-ELF-AVR-NEXT: Symbols:
-ELF-AVR-NEXT:     - Name:           .text
-ELF-AVR-NEXT:       Type:            STT_SECTION
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:     - Name:           .data
-ELF-AVR-NEXT:       Type:            STT_SECTION
-ELF-AVR-NEXT:       Section:         .data
-ELF-AVR-NEXT:       Value:           0x0000000000800060
-ELF-AVR-NEXT:     - Name:            a.o
-ELF-AVR-NEXT:       Type:            STT_FILE
-ELF-AVR-NEXT:       Index:           SHN_ABS
-ELF-AVR-NEXT:     - Name:            main
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:     - Name:            __trampolines_start
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            _etext
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000000004
-ELF-AVR-NEXT:     - Name:            __data_load_end
-ELF-AVR-NEXT:       Index:           SHN_ABS
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000000004
-ELF-AVR-NEXT:     - Name:            __trampolines_end
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            __data_load_start
-ELF-AVR-NEXT:       Index:           SHN_ABS
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000000004
-ELF-AVR-NEXT:     - Name:            __dtors_end
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            __eeprom_end
-ELF-AVR-NEXT:       Section:         .data
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000810000
-ELF-AVR-NEXT:     - Name:            __ctors_start
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            __dtors_start
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            __ctors_end
-ELF-AVR-NEXT:       Section:         .text
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:     - Name:            _edata
-ELF-AVR-NEXT:       Section:         .data
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000800060
-ELF-AVR-NEXT:     - Name:            _end
-ELF-AVR-NEXT:       Section:         .data
-ELF-AVR-NEXT:       Binding:         STB_GLOBAL
-ELF-AVR-NEXT:       Value:           0x0000000000800060
-
-WASM:      --- !WASM
-WASM-NEXT: FileHeader:
-WASM-NEXT:   Version:         0x00000001
-WASM:        - Type:            CUSTOM
-WASM-NEXT:     Name:            linking
-WASM-NEXT:     Version:         2
-WASM-NEXT:     SymbolTable:
-WASM-NEXT:       - Index:           0
-WASM-NEXT:         Kind:            FUNCTION
-WASM-NEXT:         Name:            main
-WASM-NEXT:         Flags:           [  ]
-WASM-NEXT:         Function:        2
-WASM-NEXT:       - Index:           1
-WASM-NEXT:         Kind:            DATA
-WASM-NEXT:         Name:            .L.str
-WASM-NEXT:         Flags:           [ BINDING_LOCAL ]
-WASM-NEXT:         Segment:         0
-WASM-NEXT:         Size:            13
-WASM-NEXT:       - Index:           2
-WASM:              Name:            puts
-WASM:            - Index:           3
-WASM:              Name:            .LSomeOtherFunction_bitcast
-WASM:            - Index:           4
-WASM:              Name:            SomeOtherFunction
-WASM:            - Index:           5
-WASM:              Name:            var
-WASM:          SegmentInfo:
-WASM-NEXT:       - Index:           0
-WASM-NEXT:         Name:            .rodata..L.str
-WASM-NEXT:         Alignment:       0
-WASM-NEXT:         Flags:           [  ]
-WASM-NEXT:       - Index:           1
-WASM:      ...
-
-
-ELF-X86-64-UNWIND:      - Name:            .eh_frame
-ELF-X86-64-UNWIND-NEXT:   Type:            SHT_X86_64_UNWIND
-ELF-X86-64-UNWIND-NEXT:   Flags:           [ SHF_ALLOC ]
-ELF-X86-64-UNWIND-NEXT:   AddressAlign:    0x0000000000000001
-
-RUN: not obj2yaml %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
-ENOENT: Error reading file: {{.*}}.blah: {{[Nn]}}o such file or directory
+# RUN: obj2yaml %p/Inputs/trivial-object-test.coff-i386 | FileCheck %s --check-prefix COFF-I386
+
+# COFF-I386: header:
+# COFF-I386-NEXT:  Machine: IMAGE_FILE_MACHINE_I386
+
+# COFF-I386: sections:
+# COFF-I386-NEXT:  - Name: .text
+# COFF-I386-NEXT:    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+# COFF-I386-NEXT:    Alignment: 16
+# COFF-I386-NEXT:    SectionData:  83EC0CC744240800000000C7042400000000E800000000E8000000008B44240883C40CC3
+
+# COFF-I386:    Relocations:
+# COFF-I386-NEXT:      - VirtualAddress: 14
+# COFF-I386-NEXT:        SymbolName: L_.str
+# COFF-I386-NEXT:        Type: IMAGE_REL_I386_DIR32
+
+# COFF-I386:           - VirtualAddress: 19
+# COFF-I386-NEXT:        SymbolName: _puts
+# COFF-I386-NEXT:        Type: IMAGE_REL_I386_REL32
+
+# COFF-I386:           - VirtualAddress: 24
+# COFF-I386-NEXT:        SymbolName: _SomeOtherFunction
+# COFF-I386-NEXT:        Type: IMAGE_REL_I386_REL32
+
+# COFF-I386:       - Name: .data
+# COFF-I386-NEXT:    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-I386-NEXT:    Alignment: 1
+# COFF-I386-NEXT:    SectionData: 48656C6C6F20576F726C642100
+
+# COFF-I386: symbols:
+# COFF-I386-NEXT:  - Name: .text
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 1
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT:    SectionDefinition:
+# COFF-I386-NEXT:      Length:          36
+# COFF-I386-NEXT:      NumberOfRelocations: 3
+# COFF-I386-NEXT:      NumberOfLinenumbers: 0
+# COFF-I386-NEXT:      CheckSum:        0
+# COFF-I386-NEXT:      Number:          1
+
+# COFF-I386:       - Name: .data
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 2
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT:    SectionDefinition:
+# COFF-I386-NEXT:      Length:          13
+# COFF-I386-NEXT:      NumberOfRelocations: 0
+# COFF-I386-NEXT:      NumberOfLinenumbers: 0
+# COFF-I386-NEXT:      CheckSum:        0
+# COFF-I386-NEXT:      Number:          2
+
+# COFF-I386:       - Name: _main
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 1
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-I386:       - Name: L_.str
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 2
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_STATIC
+
+# COFF-I386:       - Name: _puts
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 0
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-I386:       - Name: _SomeOtherFunction
+# COFF-I386-NEXT:    Value: 0
+# COFF-I386-NEXT:    SectionNumber: 0
+# COFF-I386-NEXT:    SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-I386-NEXT:    ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-I386-NEXT:    StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.coff-x86-64 | FileCheck %s --check-prefix COFF-X86-64
+
+# COFF-X86-64: header:
+# COFF-X86-64-NEXT:  Machine: IMAGE_FILE_MACHINE_AMD64
+
+# COFF-X86-64: sections:
+# COFF-X86-64-NEXT:   - Name: .text
+# COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+# COFF-X86-64-NEXT:     Alignment: 16
+# COFF-X86-64-NEXT:     SectionData: 4883EC28C744242400000000488D0D00000000E800000000E8000000008B4424244883C428C3
+
+# COFF-X86-64:     Relocations:
+# COFF-X86-64-NEXT:       - VirtualAddress: 15
+# COFF-X86-64-NEXT:         SymbolName: L.str
+# COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
+
+# COFF-X86-64:            - VirtualAddress: 20
+# COFF-X86-64-NEXT:         SymbolName: puts
+# COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
+
+# COFF-X86-64:            - VirtualAddress: 25
+# COFF-X86-64-NEXT:         SymbolName: SomeOtherFunction
+# COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_REL32
+
+# COFF-X86-64:        - Name: .data
+# COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-X86-64-NEXT:     Alignment: 1
+# COFF-X86-64-NEXT:     SectionData: 48656C6C6F20576F726C642100
+
+# COFF-X86-64:        - Name: '.CRT$XCU'
+# COFF-X86-64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+# COFF-X86-64-NEXT:     Alignment: 8
+# COFF-X86-64-NEXT:     SectionData:  '0000000000000000'
+
+# COFF-X86-64:     Relocations:
+# COFF-X86-64-NEXT:       - VirtualAddress: 0
+# COFF-X86-64-NEXT:         SymbolName: '??__Ex@@YAXXZ'
+# COFF-X86-64-NEXT:         Type: IMAGE_REL_AMD64_ADDR64
+
+# COFF-X86-64: symbols:
+# COFF-X86-64-NEXT:   - Name: .text
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 1
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-X86-64-NEXT:    SectionDefinition:
+# COFF-X86-64-NEXT:      Length:          38
+# COFF-X86-64-NEXT:      NumberOfRelocations: 3
+# COFF-X86-64-NEXT:      NumberOfLinenumbers: 0
+# COFF-X86-64-NEXT:      CheckSum:        0
+# COFF-X86-64-NEXT:      Number:          1
+
+# COFF-X86-64:        - Name: .data
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 2
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-X86-64-NEXT:    SectionDefinition:
+# COFF-X86-64-NEXT:      Length:          13
+# COFF-X86-64-NEXT:      NumberOfRelocations: 0
+# COFF-X86-64-NEXT:      NumberOfLinenumbers: 0
+# COFF-X86-64-NEXT:      CheckSum:        0
+# COFF-X86-64-NEXT:      Number:          2
+
+# COFF-X86-64:        - Name: main
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 1
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-X86-64:        - Name: L.str
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 2
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+
+# COFF-X86-64:        - Name: puts
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 0
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-X86-64:        - Name: SomeOtherFunction
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 0
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-X86-64:        - Name: '??__Ex@@YAXXZ'
+# COFF-X86-64-NEXT:     Value: 0
+# COFF-X86-64-NEXT:     SectionNumber: 3
+# COFF-X86-64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-X86-64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+# COFF-X86-64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.coff-armnt | FileCheck %s --check-prefix COFF-ARMNT
+
+# COFF-ARMNT: header:
+# COFF-ARMNT-NEXT:  Machine: IMAGE_FILE_MACHINE_ARMNT
+
+# COFF-ARMNT: sections:
+# COFF-ARMNT-NEXT:   - Name: .text
+# COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+# COFF-ARMNT-NEXT:     Alignment: 4
+# COFF-ARMNT-NEXT:     SectionData: 00F000F87047
+
+# COFF-ARMNT:     Relocations:
+# COFF-ARMNT-NEXT:       - VirtualAddress: 0
+# COFF-ARMNT-NEXT:         SymbolName: otherFunc
+# COFF-ARMNT-NEXT:         Type: IMAGE_REL_ARM_BLX23T
+
+# COFF-ARMNT:        - Name: .data
+# COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-ARMNT-NEXT:     Alignment: 4
+# COFF-ARMNT-NEXT:     SectionData: ''
+
+# COFF-ARMNT:        - Name: .bss
+# COFF-ARMNT-NEXT:     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-ARMNT-NEXT:     Alignment: 4
+# COFF-ARMNT-NEXT:     SectionData: ''
+
+# COFF-ARMNT: symbols:
+# COFF-ARMNT-NEXT:   - Name: .text
+# COFF-ARMNT-NEXT:     Value: 0
+# COFF-ARMNT-NEXT:     SectionNumber: 1
+# COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARMNT-NEXT:     SectionDefinition:
+# COFF-ARMNT-NEXT:       Length:          6
+# COFF-ARMNT-NEXT:       NumberOfRelocations: 1
+# COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARMNT-NEXT:       CheckSum:        879026160
+# COFF-ARMNT-NEXT:       Number:          1
+
+# COFF-ARMNT:        - Name: .data
+# COFF-ARMNT-NEXT:     Value: 0
+# COFF-ARMNT-NEXT:     SectionNumber: 2
+# COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARMNT-NEXT:     SectionDefinition:
+# COFF-ARMNT-NEXT:       Length:          0
+# COFF-ARMNT-NEXT:       NumberOfRelocations: 0
+# COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARMNT-NEXT:       CheckSum:        0
+# COFF-ARMNT-NEXT:       Number:          2
+
+# COFF-ARMNT:        - Name: .bss
+# COFF-ARMNT-NEXT:     Value: 0
+# COFF-ARMNT-NEXT:     SectionNumber: 3
+# COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARMNT-NEXT:     SectionDefinition:
+# COFF-ARMNT-NEXT:       Length:          0
+# COFF-ARMNT-NEXT:       NumberOfRelocations: 0
+# COFF-ARMNT-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARMNT-NEXT:       CheckSum:        0
+# COFF-ARMNT-NEXT:       Number:          3
+
+# COFF-ARMNT:        - Name: main
+# COFF-ARMNT-NEXT:     Value: 0
+# COFF-ARMNT-NEXT:     SectionNumber: 1
+# COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-ARMNT:        - Name: otherFunc
+# COFF-ARMNT-NEXT:     Value: 0
+# COFF-ARMNT-NEXT:     SectionNumber: 0
+# COFF-ARMNT-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARMNT-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARMNT-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.coff-arm64 | FileCheck %s --check-prefix COFF-ARM64
+
+# COFF-ARM64: header:
+# COFF-ARM64-NEXT:  Machine: IMAGE_FILE_MACHINE_ARM64
+
+# COFF-ARM64: sections:
+# COFF-ARM64-NEXT:   - Name: .text
+# COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+# COFF-ARM64-NEXT:     Alignment: 4
+# COFF-ARM64-NEXT:     SectionData: 00000094C0035FD6
+
+# COFF-ARM64:     Relocations:
+# COFF-ARM64-NEXT:       - VirtualAddress: 0
+# COFF-ARM64-NEXT:         SymbolName: otherFunc
+# COFF-ARM64-NEXT:         Type: IMAGE_REL_ARM64_BRANCH26
+
+# COFF-ARM64:        - Name: .data
+# COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-ARM64-NEXT:     Alignment: 4
+# COFF-ARM64-NEXT:     SectionData: ''
+
+# COFF-ARM64:        - Name: .bss
+# COFF-ARM64-NEXT:     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+# COFF-ARM64-NEXT:     Alignment: 4
+# COFF-ARM64-NEXT:     SectionData: ''
+
+# COFF-ARM64: symbols:
+# COFF-ARM64-NEXT:   - Name: .text
+# COFF-ARM64-NEXT:     Value: 0
+# COFF-ARM64-NEXT:     SectionNumber: 1
+# COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARM64-NEXT:     SectionDefinition:
+# COFF-ARM64-NEXT:       Length:          8
+# COFF-ARM64-NEXT:       NumberOfRelocations: 1
+# COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARM64-NEXT:       CheckSum:        35579893
+# COFF-ARM64-NEXT:       Number:          1
+
+# COFF-ARM64:        - Name: .data
+# COFF-ARM64-NEXT:     Value: 0
+# COFF-ARM64-NEXT:     SectionNumber: 2
+# COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARM64-NEXT:     SectionDefinition:
+# COFF-ARM64-NEXT:       Length:          0
+# COFF-ARM64-NEXT:       NumberOfRelocations: 0
+# COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARM64-NEXT:       CheckSum:        0
+# COFF-ARM64-NEXT:       Number:          2
+
+# COFF-ARM64:        - Name: .bss
+# COFF-ARM64-NEXT:     Value: 0
+# COFF-ARM64-NEXT:     SectionNumber: 3
+# COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-ARM64-NEXT:     SectionDefinition:
+# COFF-ARM64-NEXT:       Length:          0
+# COFF-ARM64-NEXT:       NumberOfRelocations: 0
+# COFF-ARM64-NEXT:       NumberOfLinenumbers: 0
+# COFF-ARM64-NEXT:       CheckSum:        0
+# COFF-ARM64-NEXT:       Number:          3
+
+# COFF-ARM64:        - Name: main
+# COFF-ARM64-NEXT:     Value: 0
+# COFF-ARM64-NEXT:     SectionNumber: 1
+# COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# COFF-ARM64:        - Name: otherFunc
+# COFF-ARM64-NEXT:     Value: 0
+# COFF-ARM64-NEXT:     SectionNumber: 0
+# COFF-ARM64-NEXT:     SimpleType: IMAGE_SYM_TYPE_NULL
+# COFF-ARM64-NEXT:     ComplexType: IMAGE_SYM_DTYPE_NULL
+# COFF-ARM64-NEXT:     StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL
+
+# ELF-MIPSEL:      FileHeader:
+# ELF-MIPSEL-NEXT:   Class:           ELFCLASS32
+# ELF-MIPSEL-NEXT:   Data:            ELFDATA2LSB
+# ELF-MIPSEL-NEXT:   OSABI:           ELFOSABI_GNU
+# ELF-MIPSEL-NEXT:   Type:            ET_REL
+# ELF-MIPSEL-NEXT:   Machine:         EM_MIPS
+# ELF-MIPSEL-NEXT:   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
+# ELF-MIPSEL-NEXT: Sections:
+# ELF-MIPSEL-NEXT:   - Name:            .text
+# ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
+# ELF-MIPSEL-NEXT:     Content:         0000023C00004224E8FFBD271400BFAF1000B0AF218059000000018E000024240000198E09F8200321E000020000198E09F8200321E00002000002241000B08F1400BF8F0800E0031800BD27
+# ELF-MIPSEL-NEXT:   - Name:            .rel.text
+# ELF-MIPSEL-NEXT:     Type:            SHT_REL
+# ELF-MIPSEL-NEXT:     Link:            .symtab
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
+# ELF-MIPSEL-NEXT:     EntSize:         0x0000000000000008
+# ELF-MIPSEL-NEXT:     Info:            .text
+# ELF-MIPSEL-NEXT:     Relocations:
+# ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000000
+# ELF-MIPSEL-NEXT:         Symbol:          _gp_disp
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_HI16
+# ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000004
+# ELF-MIPSEL-NEXT:         Symbol:          _gp_disp
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_LO16
+# ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000018
+# ELF-MIPSEL-NEXT:         Symbol:          '$.str'
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_GOT16
+# ELF-MIPSEL-NEXT:       - Offset:          0x000000000000001C
+# ELF-MIPSEL-NEXT:         Symbol:          '$.str'
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_LO16
+# ELF-MIPSEL-NEXT:       - Offset:          0x0000000000000020
+# ELF-MIPSEL-NEXT:         Symbol:          puts
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_CALL16
+# ELF-MIPSEL-NEXT:       - Offset:          0x000000000000002C
+# ELF-MIPSEL-NEXT:         Symbol:          SomeOtherFunction
+# ELF-MIPSEL-NEXT:         Type:            R_MIPS_CALL16
+# ELF-MIPSEL-NEXT:   - Name:            .data
+# ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
+# ELF-MIPSEL-NEXT:   - Name:            .bss
+# ELF-MIPSEL-NEXT:     Type:            SHT_NOBITS
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000004
+# ELF-MIPSEL-NEXT:     Size:            0x0000000000000004
+# ELF-MIPSEL-NEXT:   - Name:            .mdebug.abi32
+# ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-MIPSEL-NEXT:   - Name:            .rodata.str1.1
+# ELF-MIPSEL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-MIPSEL-NEXT:     EntSize:         0x0000000000000001
+# ELF-MIPSEL-NEXT:     Content:         48656C6C6F20576F726C640A00
+# ELF-MIPSEL-NEXT:   - Name:            .reginfo
+# ELF-MIPSEL-NEXT:     Type:            SHT_MIPS_REGINFO
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-MIPSEL-NEXT:     Content:         '000000000000000000000000000000000000000000000000'
+# ELF-MIPSEL-NEXT:   - Name:            .MIPS.abiflags
+# ELF-MIPSEL-NEXT:     Type:            SHT_MIPS_ABIFLAGS
+# ELF-MIPSEL-NEXT:     Flags:           [ SHF_ALLOC ]
+# ELF-MIPSEL-NEXT:     AddressAlign:    0x0000000000000008
+# ELF-MIPSEL-NEXT:     ISA:             MIPS32
+# ELF-MIPSEL-NEXT:     ISARevision:     0x01
+# ELF-MIPSEL-NEXT:     FpABI:           FP_DOUBLE
+# ELF-MIPSEL-NEXT:     GPRSize:         REG_32
+# ELF-MIPSEL-NEXT:     CPR1Size:        REG_32
+# ELF-MIPSEL-NEXT:     Flags1:          [ ODDSPREG ]
+# ELF-MIPSEL-NEXT: Symbols:
+# ELF-MIPSEL-NEXT:     - Name:            trivial.ll
+# ELF-MIPSEL-NEXT:       Type:            STT_FILE
+# ELF-MIPSEL-NEXT:       Index:           SHN_ABS
+# ELF-MIPSEL-NEXT:     - Name:            '$.str'
+# ELF-MIPSEL-NEXT:       Type:            STT_OBJECT
+# ELF-MIPSEL-NEXT:       Section:         .rodata.str1.1
+# ELF-MIPSEL-NEXT:       Size:            0x000000000000000D
+# ELF-MIPSEL-NEXT:     - Name:            .text
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .text
+# ELF-MIPSEL-NEXT:     - Name:            .data
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .data
+# ELF-MIPSEL-NEXT:     - Name:            .bss
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .bss
+# ELF-MIPSEL-NEXT:     - Name:            .mdebug.abi32
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .mdebug.abi32
+# ELF-MIPSEL-NEXT:     - Name:            .rodata.str1.1
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .rodata.str1.1
+# ELF-MIPSEL-NEXT:     - Name:            .reginfo
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .reginfo
+# ELF-MIPSEL-NEXT:     - Name:            .MIPS.abiflags
+# ELF-MIPSEL-NEXT:       Type:            STT_SECTION
+# ELF-MIPSEL-NEXT:       Section:         .MIPS.abiflags
+# ELF-MIPSEL-NEXT:     - Name:            main
+# ELF-MIPSEL-NEXT:       Type:            STT_FUNC
+# ELF-MIPSEL-NEXT:       Section:         .text
+# ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
+# ELF-MIPSEL-NEXT:       Size:            0x000000000000004C
+# ELF-MIPSEL-NEXT:     - Name:            var
+# ELF-MIPSEL-NEXT:       Type:            STT_OBJECT
+# ELF-MIPSEL-NEXT:       Section:         .bss
+# ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
+# ELF-MIPSEL-NEXT:       Size:            0x0000000000000004
+# ELF-MIPSEL-NEXT:     - Name:            SomeOtherFunction
+# ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
+# ELF-MIPSEL-NEXT:     - Name:            _gp_disp
+# ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
+# ELF-MIPSEL-NEXT:     - Name:            puts
+# ELF-MIPSEL-NEXT:       Binding:         STB_GLOBAL
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL
+
+# ELF-MIPS64EL:      FileHeader:
+# ELF-MIPS64EL-NEXT:   Class:           ELFCLASS64
+# ELF-MIPS64EL-NEXT:   Data:            ELFDATA2LSB
+# ELF-MIPS64EL-NEXT:   Type:            ET_REL
+# ELF-MIPS64EL-NEXT:   Machine:         EM_MIPS
+# ELF-MIPS64EL-NEXT:   Flags:           [ EF_MIPS_ARCH_3 ]
+# ELF-MIPS64EL-NEXT: Sections:
+# ELF-MIPS64EL-NEXT:   - Name:            .text
+# ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPS64EL-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
+# ELF-MIPS64EL-NEXT:   - Name:            .data
+# ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPS64EL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
+# ELF-MIPS64EL-NEXT:     Content:         '00000000000000000000000000000000'
+# ELF-MIPS64EL-NEXT:   - Name:            .rela.data
+# ELF-MIPS64EL-NEXT:     Type:            SHT_RELA
+# ELF-MIPS64EL-NEXT:     Link:            .symtab
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000008
+# ELF-MIPS64EL-NEXT:     EntSize:         0x0000000000000018
+# ELF-MIPS64EL-NEXT:     Info:            .data
+# ELF-MIPS64EL-NEXT:     Relocations:
+# ELF-MIPS64EL-NEXT:       - Offset:          0
+# ELF-MIPS64EL-NEXT:         Symbol:          zed
+# ELF-MIPS64EL-NEXT:         Type:            R_MIPS_64
+# ELF-MIPS64EL-NEXT:   - Name:            .bss
+# ELF-MIPS64EL-NEXT:     Type:            SHT_NOBITS
+# ELF-MIPS64EL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
+# ELF-MIPS64EL-NEXT:   - Name:            .MIPS.options
+# ELF-MIPS64EL-NEXT:     Type:            SHT_MIPS_OPTIONS
+# ELF-MIPS64EL-NEXT:     Flags:           [ SHF_ALLOC, SHF_MIPS_NOSTRIP ]
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000008
+# ELF-MIPS64EL-NEXT:     EntSize:         0x0000000000000001
+# ELF-MIPS64EL-NEXT:     Content:         '01280000000000000000000000000000000000000000000000000000000000000000000000000000'
+# ELF-MIPS64EL-NEXT:   - Name:            .pdr
+# ELF-MIPS64EL-NEXT:     Type:            SHT_PROGBITS
+# ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000004
+# ELF-MIPS64EL-NEXT: Symbols:
+# ELF-MIPS64EL-NEXT:     - Name:            .text
+# ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
+# ELF-MIPS64EL-NEXT:       Section:         .text
+# ELF-MIPS64EL-NEXT:     - Name:            .data
+# ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
+# ELF-MIPS64EL-NEXT:       Section:         .data
+# ELF-MIPS64EL-NEXT:     - Name:            .bss
+# ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
+# ELF-MIPS64EL-NEXT:       Section:         .bss
+# ELF-MIPS64EL-NEXT:     - Name:            bar
+# ELF-MIPS64EL-NEXT:       Section:         .data
+# ELF-MIPS64EL-NEXT:     - Name:            .MIPS.options
+# ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
+# ELF-MIPS64EL-NEXT:       Section:         .MIPS.options
+# ELF-MIPS64EL-NEXT:     - Name:            .pdr
+# ELF-MIPS64EL-NEXT:       Type:            STT_SECTION
+# ELF-MIPS64EL-NEXT:       Section:         .pdr
+# ELF-MIPS64EL-NEXT:     - Name:            zed
+# ELF-MIPS64EL-NEXT:       Binding:         STB_GLOBAL
+
+# RUN: yaml2obj %s > %t-x86-64
+# RUN: obj2yaml %t-x86-64 | FileCheck %s --check-prefix ELF-X86-64
+
+# ELF-X86-64:      FileHeader:
+# ELF-X86-64-NEXT:   Class:           ELFCLASS64
+# ELF-X86-64-NEXT:   Data:            ELFDATA2LSB
+# ELF-X86-64-NEXT:   OSABI:           ELFOSABI_GNU
+# ELF-X86-64-NEXT:   Type:            ET_REL
+# ELF-X86-64-NEXT:   Machine:         EM_X86_64
+# ELF-X86-64-NEXT: Sections:
+# ELF-X86-64-NEXT:   - Name:            .text
+# ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
+# ELF-X86-64-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+# ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000010
+# ELF-X86-64-NEXT:     Content:         4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
+# ELF-X86-64-NEXT:   - Name:            .rodata.str1.1
+# ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
+# ELF-X86-64-NEXT:     Flags:           [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
+# ELF-X86-64-NEXT:     Address:         0x0000000000000026
+# ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-X86-64-NEXT:     Content:         48656C6C6F20576F726C642100
+# ELF-X86-64-NEXT:   - Name:            .note.GNU-stack
+# ELF-X86-64-NEXT:     Type:            SHT_PROGBITS
+# ELF-X86-64-NEXT:     Address:         0x0000000000000033
+# ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-X86-64-NEXT:   - Name:            .rela.text
+# ELF-X86-64-NEXT:     Type:            SHT_RELA
+# ELF-X86-64-NEXT:     Address:         0x0000000000000038
+# ELF-X86-64-NEXT:     Link:            .symtab
+# ELF-X86-64-NEXT:     AddressAlign:    0x0000000000000008
+# ELF-X86-64-NEXT:     EntSize:         0x0000000000000018
+# ELF-X86-64-NEXT:     Info:            .text
+# ELF-X86-64-NEXT:     Relocations:
+# ELF-X86-64-NEXT:       - Offset:          0x000000000000000D
+# ELF-X86-64-NEXT:         Symbol:          .rodata.str1.1
+# ELF-X86-64-NEXT:         Type:            R_X86_64_32S
+# ELF-X86-64-NEXT:       - Offset:          0x0000000000000012
+# ELF-X86-64-NEXT:         Symbol:          puts
+# ELF-X86-64-NEXT:         Type:            R_X86_64_PC32
+# ELF-X86-64-NEXT:         Addend:          -4
+# ELF-X86-64-NEXT:       - Offset:          0x0000000000000019
+# ELF-X86-64-NEXT:         Symbol:          SomeOtherFunction
+# ELF-X86-64-NEXT:         Type:            R_X86_64_PC32
+# ELF-X86-64-NEXT:         Addend:          -4
+# ELF-X86-64-NEXT: Symbols:
+# ELF-X86-64-NEXT:     - Name:            trivial-object-test.s
+# ELF-X86-64-NEXT:       Type:            STT_FILE
+# ELF-X86-64-NEXT:       Index:           SHN_ABS
+# ELF-X86-64-NEXT:     - Name:            .text
+# ELF-X86-64-NEXT:       Type:            STT_SECTION
+# ELF-X86-64-NEXT:       Section:         .text
+# ELF-X86-64-NEXT:     - Name:            .rodata.str1.1
+# ELF-X86-64-NEXT:       Type:            STT_SECTION
+# ELF-X86-64-NEXT:       Section:         .rodata.str1.1
+# ELF-X86-64-NEXT:     - Name:            .note.GNU-stack
+# ELF-X86-64-NEXT:       Type:            STT_SECTION
+# ELF-X86-64-NEXT:       Section:         .note.GNU-stack
+# ELF-X86-64-NEXT:     - Name:            main
+# ELF-X86-64-NEXT:       Type:            STT_FUNC
+# ELF-X86-64-NEXT:       Section:         .text
+# ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
+# ELF-X86-64-NEXT:       Size:            0x0000000000000026
+# ELF-X86-64-NEXT:     - Name:            SomeOtherFunction
+# ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
+# ELF-X86-64-NEXT:     - Name:            puts
+# ELF-X86-64-NEXT:       Binding:         STB_GLOBAL
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  OSABI:   ELFOSABI_GNU
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:         .text
+    Type:         SHT_PROGBITS
+    Flags:        [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign: 0x0000000000000010
+    Content:      4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
+  - Name:         .rodata.str1.1
+    Type:         SHT_PROGBITS
+    Flags:        [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
+    Address:      0x0000000000000026
+    AddressAlign: 0x0000000000000001
+    Content:      48656C6C6F20576F726C642100
+  - Name:         .note.GNU-stack
+    Type:         SHT_PROGBITS
+    Address:      0x0000000000000033
+    AddressAlign: 0x0000000000000001
+  - Name:         .rela.text
+    Type:         SHT_RELA
+    Address:      0x0000000000000038
+    Link:         .symtab
+    AddressAlign: 0x0000000000000008
+    EntSize:      0x0000000000000018
+    Info:         .text
+    Relocations:
+      - Offset: 0x000000000000000D
+        Symbol: .rodata.str1.1
+        Type:   R_X86_64_32S
+      - Offset: 0x0000000000000012
+        Symbol: puts
+        Type:   R_X86_64_PC32
+        Addend: -4
+      - Offset: 0x0000000000000019
+        Symbol: SomeOtherFunction
+        Type:   R_X86_64_PC32
+        Addend: -4
+Symbols:
+  - Name:    trivial-object-test.s
+    Type:    STT_FILE
+    Index:   SHN_ABS
+  - Name:    .text
+    Type:    STT_SECTION
+    Section: .text
+  - Name:    .rodata.str1.1
+    Type:    STT_SECTION
+    Section: .rodata.str1.1
+  - Name:    .note.GNU-stack
+    Type:    STT_SECTION
+    Section: .note.GNU-stack
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Size:    0x0000000000000026
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.elf-avr | FileCheck %s --check-prefix ELF-AVR
+
+# ELF-AVR:      FileHeader:
+# ELF-AVR-NEXT:   Class:           ELFCLASS32
+# ELF-AVR-NEXT:   Data:            ELFDATA2LSB
+# ELF-AVR-NEXT:   Type:            ET_EXEC
+# ELF-AVR-NEXT:   Machine:         EM_AVR
+# ELF-AVR-NEXT:   Flags:           [ EF_AVR_ARCH_AVR2 ]
+# ELF-AVR-NEXT: Sections:
+# ELF-AVR-NEXT:   - Name:            .text
+# ELF-AVR-NEXT:     Type:            SHT_PROGBITS
+# ELF-AVR-NEXT:     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+# ELF-AVR-NEXT:     AddressAlign:    0x0000000000000002
+# ELF-AVR-NEXT:     Content:         C20E0895
+# ELF-AVR-NEXT:   - Name:            .data
+# ELF-AVR-NEXT:     Type:            SHT_PROGBITS
+# ELF-AVR-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
+# ELF-AVR-NEXT:     Address:         0x0000000000800060
+# ELF-AVR-NEXT:     AddressAlign:    0x0000000000000001
+# ELF-AVR-NEXT: Symbols:
+# ELF-AVR-NEXT:     - Name:           .text
+# ELF-AVR-NEXT:       Type:            STT_SECTION
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:     - Name:           .data
+# ELF-AVR-NEXT:       Type:            STT_SECTION
+# ELF-AVR-NEXT:       Section:         .data
+# ELF-AVR-NEXT:       Value:           0x0000000000800060
+# ELF-AVR-NEXT:     - Name:            a.o
+# ELF-AVR-NEXT:       Type:            STT_FILE
+# ELF-AVR-NEXT:       Index:           SHN_ABS
+# ELF-AVR-NEXT:     - Name:            main
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:     - Name:            __trampolines_start
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            _etext
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000000004
+# ELF-AVR-NEXT:     - Name:            __data_load_end
+# ELF-AVR-NEXT:       Index:           SHN_ABS
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000000004
+# ELF-AVR-NEXT:     - Name:            __trampolines_end
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            __data_load_start
+# ELF-AVR-NEXT:       Index:           SHN_ABS
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000000004
+# ELF-AVR-NEXT:     - Name:            __dtors_end
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            __eeprom_end
+# ELF-AVR-NEXT:       Section:         .data
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000810000
+# ELF-AVR-NEXT:     - Name:            __ctors_start
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            __dtors_start
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            __ctors_end
+# ELF-AVR-NEXT:       Section:         .text
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:     - Name:            _edata
+# ELF-AVR-NEXT:       Section:         .data
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000800060
+# ELF-AVR-NEXT:     - Name:            _end
+# ELF-AVR-NEXT:       Section:         .data
+# ELF-AVR-NEXT:       Binding:         STB_GLOBAL
+# ELF-AVR-NEXT:       Value:           0x0000000000800060
+
+# RUN: obj2yaml %p/Inputs/trivial-object-test.wasm | FileCheck %s --check-prefix WASM
+
+# WASM:      --- !WASM
+# WASM-NEXT: FileHeader:
+# WASM-NEXT:   Version:         0x00000001
+# WASM:        - Type:            CUSTOM
+# WASM-NEXT:     Name:            linking
+# WASM-NEXT:     Version:         2
+# WASM-NEXT:     SymbolTable:
+# WASM-NEXT:       - Index:           0
+# WASM-NEXT:         Kind:            FUNCTION
+# WASM-NEXT:         Name:            main
+# WASM-NEXT:         Flags:           [  ]
+# WASM-NEXT:         Function:        2
+# WASM-NEXT:       - Index:           1
+# WASM-NEXT:         Kind:            DATA
+# WASM-NEXT:         Name:            .L.str
+# WASM-NEXT:         Flags:           [ BINDING_LOCAL ]
+# WASM-NEXT:         Segment:         0
+# WASM-NEXT:         Size:            13
+# WASM-NEXT:       - Index:           2
+# WASM:              Name:            puts
+# WASM:            - Index:           3
+# WASM:              Name:            .LSomeOtherFunction_bitcast
+# WASM:            - Index:           4
+# WASM:              Name:            SomeOtherFunction
+# WASM:            - Index:           5
+# WASM:              Name:            var
+# WASM:          SegmentInfo:
+# WASM-NEXT:       - Index:           0
+# WASM-NEXT:         Name:            .rodata..L.str
+# WASM-NEXT:         Alignment:       0
+# WASM-NEXT:         Flags:           [  ]
+# WASM-NEXT:       - Index:           1
+# WASM:      ...
+
+# RUN: obj2yaml %p/Inputs/unwind-section.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64-UNWIND
+
+# ELF-X86-64-UNWIND:      - Name:            .eh_frame
+# ELF-X86-64-UNWIND-NEXT:   Type:            SHT_X86_64_UNWIND
+# ELF-X86-64-UNWIND-NEXT:   Flags:           [ SHF_ALLOC ]
+# ELF-X86-64-UNWIND-NEXT:   AddressAlign:    0x0000000000000001
+
+# RUN: not obj2yaml %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
+# ENOENT: Error reading file: {{.*}}.blah: {{[Nn]}}o such file or directory
index a552113..e53f6e1 100644 (file)
@@ -1,17 +1,22 @@
-RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -f - | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -f %p/Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
+# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -f - | FileCheck %s -check-prefix COFF-i386
 
-XFAIL: *
+# COFF-i386: : file format COFF-i386
+# COFF-i386: architecture: i386
+# COFF-i386: start address: 0x00000000{{$}}
 
-COFF-i386: : file format
-COFF-i386: architecture: i386
-COFF-i386: HAS_RELOC
-COFF-i386: HAS_SYMS
-COFF-i386: start address 0x
+# RUN: yaml2obj %s > %t-i386
+# RUN: llvm-objdump -f %t-i386 | FileCheck %s -check-prefix ELF-i386
 
-ELF-i386: : file format elf
-ELF-i386: architecture: i386
-ELF-i386: HAS_RELOC
-ELF-i386: HAS_SYMS
-ELF-i386: start address 0x
+# ELF-i386: : file format ELF32-i386
+# ELF-i386: architecture: i386
+# ELF-i386: start address: 0x00000000{{$}}
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Symbols:
+  - Name:    foo
+    Binding: STB_GLOBAL
index 22d2baa..a916a0f 100644 (file)
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-i386 \
-RUN:              | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \
-RUN:              | FileCheck %s -check-prefix COFF-x86-64
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-x86-64 \
-RUN:              | FileCheck %s -check-prefix ELF-x86-64
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-hexagon \
-RUN:              | FileCheck %s -check-prefix ELF-hexagon
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mips64el \
-RUN:              | FileCheck %s -check-prefix ELF-MIPS64EL
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mipsel \
-RUN:              | FileCheck %s -check-prefix ELF-MIPSEL
-RUN: llvm-objdump -r %p/Inputs/trivial-object-test.wasm \
-RUN:              | FileCheck %s -check-prefix WASM
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-i386 \
+# RUN:              | FileCheck %s -check-prefix COFF-i386
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \
+# RUN:              | FileCheck %s -check-prefix COFF-x86-64
 
-RUN: llvm-objdump -r %p/Inputs/relocations.elf-x86-64 \
-RUN:              | FileCheck %s -check-prefix ELF-complex-x86-64
+# RUN: yaml2obj -docnum=1 %s > %t-i386
+# RUN: llvm-objdump -r %t-i386 | FileCheck %s -check-prefix ELF-i386
 
-COFF-i386: .text
-COFF-i386: IMAGE_REL_I386_DIR32 L_.str
-COFF-i386: IMAGE_REL_I386_REL32 _puts
-COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction
+# ELF-i386: .text
+# ELF-i386: R_386_32 .section
+# ELF-i386: R_386_PC32 symbol
 
-COFF-x86-64: .text
-COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str
-COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
-COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name: .text
+    Type: SHT_PROGBITS
+  - Name: .section
+    Type: SHT_PROGBITS
+  - Name: .rel.text
+    Type: SHT_REL
+    Link: .symtab
+    Info: .text
+    Relocations:
+      - Offset: 0x0
+        Symbol: .section
+        Type:   R_386_32
+      - Offset: 0x1
+        Symbol: symbol
+        Type:   R_386_PC32
+Symbols:
+  - Name:    .section
+    Type:    STT_SECTION
+    Section: .section
+  - Name:    symbol
+    Binding: STB_GLOBAL
 
-ELF-i386: .text
-ELF-i386: R_386_32 .rodata.str1.1
-ELF-i386: R_386_PC32 puts
-ELF-i386: R_386_PC32 SomeOtherFunction
+# RUN: yaml2obj -docnum=2 %s > %t-x86-64
+# RUN: llvm-objdump -r %t-x86-64 | FileCheck %s -check-prefix ELF-x86-64
 
-ELF-x86-64: .text
-ELF-x86-64: R_X86_64_32S .rodata.str1.1
-ELF-x86-64: R_X86_64_PC32 puts
-ELF-x86-64: R_X86_64_PC32 SomeOtherFunction
+# ELF-x86-64: .text
+# ELF-x86-64: R_X86_64_32S .section
+# ELF-x86-64: R_X86_64_PC32 symbol
 
-ELF-hexagon: .text
-ELF-hexagon: R_HEX_GOTREL_HI16 .main
-ELF-hexagon: R_HEX_GOTREL_LO16 .main
-ELF-hexagon: R_HEX_HI16 puts
-ELF-hexagon: R_HEX_LO16 puts
-ELF-hexagon: R_HEX_B15_PCREL testf
-ELF-hexagon: R_HEX_B22_PCREL puts
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name: .text
+    Type: SHT_PROGBITS
+  - Name: .section
+    Type: SHT_PROGBITS
+  - Name: .rel.text
+    Type: SHT_REL
+    Link: .symtab
+    Info: .text
+    Relocations:
+      - Offset: 0x0
+        Symbol: .section
+        Type:   R_X86_64_32S
+      - Offset: 0x1
+        Symbol: symbol
+        Type:   R_X86_64_PC32
+Symbols:
+  - Name:    .section
+    Type:    STT_SECTION
+    Section: .section
+  - Name:    symbol
+    Binding: STB_GLOBAL
 
-// Note: this file was produced with gas to make sure we don't end up in a
-// situation where LLVM produces and accepts a broken file.
-ELF-MIPS64EL: .data
-ELF-MIPS64EL: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE zed
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-hexagon \
+# RUN:              | FileCheck %s -check-prefix ELF-hexagon
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mips64el \
+# RUN:              | FileCheck %s -check-prefix ELF-MIPS64EL
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mipsel \
+# RUN:              | FileCheck %s -check-prefix ELF-MIPSEL
+# RUN: llvm-objdump -r %p/Inputs/trivial-object-test.wasm \
+# RUN:              | FileCheck %s -check-prefix WASM
 
-ELF-MIPSEL: .text
-ELF-MIPSEL: R_MIPS_HI16 _gp_disp
-ELF-MIPSEL: R_MIPS_LO16 _gp_disp
-ELF-MIPSEL: R_MIPS_GOT16 $.str
-ELF-MIPSEL: R_MIPS_LO16 $.str
-ELF-MIPSEL: R_MIPS_CALL16 puts
-ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
+# RUN: llvm-objdump -r %p/Inputs/relocations.elf-x86-64 \
+# RUN:              | FileCheck %s -check-prefix ELF-complex-x86-64
 
-WASM:      CODE
-WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
-WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
-WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
-WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
+# COFF-i386: .text
+# COFF-i386: IMAGE_REL_I386_DIR32 L_.str
+# COFF-i386: IMAGE_REL_I386_REL32 _puts
+# COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction
 
-ELF-complex-x86-64: .text
-ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_16 .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_32 .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_32S .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_64 .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_PC32 .data-4
-ELF-complex-x86-64-NEXT: R_X86_64_32 .data
-ELF-complex-x86-64-NEXT: R_X86_64_32 .data+4
+# COFF-x86-64: .text
+# COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str
+# COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
+# COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
+
+# ELF-hexagon: .text
+# ELF-hexagon: R_HEX_GOTREL_HI16 .main
+# ELF-hexagon: R_HEX_GOTREL_LO16 .main
+# ELF-hexagon: R_HEX_HI16 puts
+# ELF-hexagon: R_HEX_LO16 puts
+# ELF-hexagon: R_HEX_B15_PCREL testf
+# ELF-hexagon: R_HEX_B22_PCREL puts
+
+## Note: this file was produced with gas to make sure we don't end up in a
+## situation where LLVM produces and accepts a broken file.
+# ELF-MIPS64EL: .data
+# ELF-MIPS64EL: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE zed
+
+# ELF-MIPSEL: .text
+# ELF-MIPSEL: R_MIPS_HI16 _gp_disp
+# ELF-MIPSEL: R_MIPS_LO16 _gp_disp
+# ELF-MIPSEL: R_MIPS_GOT16 $.str
+# ELF-MIPSEL: R_MIPS_LO16 $.str
+# ELF-MIPSEL: R_MIPS_CALL16 puts
+# ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
+
+# WASM:      CODE
+# WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
+# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
+# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
+# WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
+
+# ELF-complex-x86-64: .text
+# ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_16 .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_32 .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_32S .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_64 .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_PC32 .data-4
+# ELF-complex-x86-64-NEXT: R_X86_64_32 .data
+# ELF-complex-x86-64-NEXT: R_X86_64_32 .data+4
index e0199b3..877fd96 100644 (file)
@@ -1,24 +1,41 @@
-RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -s - | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -s %p/Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
-RUN: llvm-objdump -s %p/Inputs/shared-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix BSS
+# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -s - | FileCheck %s -check-prefix COFF-i386
 
-COFF-i386: file format
-COFF-i386: Contents of section .text:
-COFF-i386:  0000 83ec0cc7 44240800 000000c7 04240000  ....D$.......$..
-COFF-i386:  0010 0000e800 000000e8 00000000 8b442408  .............D$.
-COFF-i386:  0020 83c40cc3                             ....
-COFF-i386: Contents of section .data:
-COFF-i386:  0000 48656c6c 6f20576f 726c6421 00        Hello World!.
+COFF-i386: file format
+COFF-i386: Contents of section .text:
+COFF-i386:  0000 83ec0cc7 44240800 000000c7 04240000  ....D$.......$..
+COFF-i386:  0010 0000e800 000000e8 00000000 8b442408  .............D$.
+COFF-i386:  0020 83c40cc3                             ....
+COFF-i386: Contents of section .data:
+COFF-i386:  0000 48656c6c 6f20576f 726c6421 00        Hello World!.
 
-ELF-i386: trivial-object-test.elf-i386:     file format
-ELF-i386: Contents of section .text:
-ELF-i386:  0000 83ec0cc7 44240800 000000c7 04240000  ....D$.......$..
-ELF-i386:  0010 0000e8fc ffffffe8 fcffffff 8b442408  .............D$.
-ELF-i386:  0020 83c40cc3                             ....
-ELF-i386: Contents of section .rodata.str1.1:
-ELF-i386:  0024 48656c6c 6f20576f 726c6421 00        Hello World!.
+# RUN: yaml2obj %s > %t.elf-i386
+# RUN: llvm-objdump -s %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix ELF-i386
 
-BSS: Contents of section .bss:
-BSS-NEXT: <skipping contents of bss section at [12c8, 12cc)>
+# ELF-i386: [[FILE]]:     file format
+# ELF-i386: Contents of section .text:
+# ELF-i386:  0000 83ec0cc7 44240800 000000c7 04240000  ....D$.......$..
+# ELF-i386:  0010 0000e8fc ffffffe8 fcffffff 8b442408  .............D$.
+# ELF-i386:  0020 83c40cc3                             ....
+# ELF-i386: Contents of section .rodata.str1.1:
+# ELF-i386:  0024 48656c6c 6f20576f 726c6421 00        Hello World!.
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
+  - Name:    .rodata.str1.1
+    Type:    SHT_PROGBITS
+    Address: 0x0000000000000024
+    Content: 48656C6C6F20576F726C642100
+
+# RUN: llvm-objdump -s %p/Inputs/shared-object-test.elf-i386 \
+# RUN:              | FileCheck %s -check-prefix BSS
+
+# BSS: Contents of section .bss:
+# BSS-NEXT: <skipping contents of bss section at [12c8, 12cc)>
index 973e1ca..434d73e 100644 (file)
@@ -1,16 +1,42 @@
-; RUN: llvm-objdump -h %p/Inputs/trivial-object-test.elf-x86-64 \
-; RUN:              | FileCheck %s
+# RUN: yaml2obj %s > %t.elf-x86-64
+# RUN: llvm-objdump -h %t.elf-x86-64 | FileCheck %s
 
-; To verify this, use readelf -S, not objdump -h. Binutils objdump filters the
-; results in a way that we don't emulate.
+# To verify this, use readelf -S, not objdump -h. Binutils objdump filters the
+# results in a way that we don't emulate.
 
-; CHECK: Sections:
-; CHECK: Idx Name          Size     VMA              Type
-; CHECK:   0               00000000 0000000000000000
-; CHECK:   1 .text         00000026 0000000000000000 TEXT
-; CHECK:   2 .rodata.str1.1 0000000d 0000000000000026 DATA
-; CHECK:   3 .note.GNU-stack 00000000 0000000000000033
-; CHECK:   4 .rela.text    00000048 0000000000000038
-; CHECK:   5 .symtab       000000c0 0000000000000080
-; CHECK:   6 .strtab       00000033 0000000000000140
-; CHECK:   7 .shstrtab     0000004b 0000000000000173
+# CHECK: Sections:
+# CHECK: Idx Name          Size     VMA              Type
+# CHECK:   0               00000000 0000000000000000
+# CHECK:   1 .text         00000026 0000000000000000 TEXT
+# CHECK:   2 .rodata.str1.1 0000000d 0000000000000026 DATA
+# CHECK:   3 .note.GNU-stack 00000000 0000000000000033
+# CHECK:   4 .rela.text    00000000 0000000000000038
+# CHECK:   5 .symtab       00000018 0000000000000000
+# CHECK:   6 .strtab       00000001 0000000000000000
+# CHECK:   7 .shstrtab     00000045 0000000000000000
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+    Size:    0x26
+  - Name:    .rodata.str1.1
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
+    Address: 0x0000000000000026
+    Size:    0xd
+  - Name:    .note.GNU-stack
+    Type:    SHT_PROGBITS
+    Address: 0x0000000000000033
+  - Name:    .rela.text
+    Type:    SHT_RELA
+    Address: 0x0000000000000038
+    Link:    .symtab
+    Info:    .text
+    Relocations:
index 8faee11..9c8a6b7 100644 (file)
@@ -1,43 +1,86 @@
-RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -t - \
-RUN:              | FileCheck %s -check-prefix COFF-i386
-RUN: llvm-objdump -t %p/Inputs/trivial-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-i386
-RUN: llvm-objdump -t %p/Inputs/trivial-object-test.macho-i386 \
-RUN:              | FileCheck %s -check-prefix macho-i386
-RUN: llvm-objdump -t %p/Inputs/shared-object-test.elf-i386 \
-RUN:              | FileCheck %s -check-prefix ELF-shared
-
-COFF-i386: file format
-COFF-i386: SYMBOL TABLE:
-COFF-i386: [  0](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
-COFF-i386: AUX scnlen 0x24 nreloc 3 nlnno 0 checksum 0x0 assoc 1 comdat 0
-COFF-i386: [  2](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
-COFF-i386: AUX scnlen 0xd nreloc 0 nlnno 0 checksum 0x0 assoc 2 comdat 0
-COFF-i386: [  4](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000000 _main
-COFF-i386: [  5](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000000 L_.str
-COFF-i386: [  6](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _puts
-COFF-i386: [  7](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _SomeOtherFunction
-
-ELF-i386: trivial-object-test.elf-i386:     file format
-ELF-i386: SYMBOL TABLE:
-ELF-i386: 00000000 l    df *ABS*  00000000 trivial-object-test.s
-ELF-i386: 00000000 l    d  .text  00000000 .text
-ELF-i386: 00000024 l    d  .rodata.str1.1 00000000 .rodata.str1.1
-ELF-i386: 00000031 l    d  .note.GNU-stack        00000000 .note.GNU-stack
-ELF-i386: 00000000 g     F .text  00000024 main
-ELF-i386: 00000000         *UND*  00000000 SomeOtherFunction
-ELF-i386: 00000000         *UND*  00000000 puts
-
-macho-i386: trivial-object-test.macho-i386:        file format Mach-O 32-bit i386
-macho-i386: SYMBOL TABLE:
-macho-i386: 00000000 g     F __TEXT,__text  _main
-macho-i386: 00000000         *UND*          _SomeOtherFunction
-macho-i386: 00000000         *UND*          _puts
-
-ELF-shared: shared-object-test.elf-i386:     file format
-ELF-shared: SYMBOL TABLE:
-ELF-shared: 00000200 l     F .text 00000003 local_func
-ELF-shared: 000012b8 l     O *ABS*           00000000 .hidden _GLOBAL_OFFSET_TABLE_
-ELF-shared: 00001248 l     O *ABS*           00000000 .hidden _DYNAMIC
-ELF-shared: 000012c4 g     O .data           00000004 defined_sym
-ELF-shared: 000001f0 g     F .text 00000003 global_func
+# RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-objdump -t - \
+# RUN:              | FileCheck %s -check-prefix COFF-i386
+
+# COFF-i386: file format
+# COFF-i386: SYMBOL TABLE:
+# COFF-i386: [  0](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
+# COFF-i386: AUX scnlen 0x24 nreloc 3 nlnno 0 checksum 0x0 assoc 1 comdat 0
+# COFF-i386: [  2](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
+# COFF-i386: AUX scnlen 0xd nreloc 0 nlnno 0 checksum 0x0 assoc 2 comdat 0
+# COFF-i386: [  4](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000000 _main
+# COFF-i386: [  5](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000000 L_.str
+# COFF-i386: [  6](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _puts
+# COFF-i386: [  7](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _SomeOtherFunction
+
+# RUN: yaml2obj %s > %t.elf-i386
+# RUN: llvm-objdump -t %t.elf-i386 | FileCheck %s -check-prefix ELF-i386
+
+# ELF-i386: {{.*}}elf-i386:     file format
+# ELF-i386: SYMBOL TABLE:
+# ELF-i386: 00000000 l    df *ABS*  00000000 trivial-object-test.s
+# ELF-i386: 00000000 l    d  .text  00000000 .text
+# ELF-i386: 00000024 l    d  .rodata.str1.1 00000000 .rodata.str1.1
+# ELF-i386: 00000031 l    d  .note.GNU-stack        00000000 .note.GNU-stack
+# ELF-i386: 00000000 g     F .text  00000024 main
+# ELF-i386: 00000000         *UND*  00000000 SomeOtherFunction
+# ELF-i386: 00000000         *UND*  00000000 puts
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+  - Name:    .rodata.str1.1
+    Type:    SHT_PROGBITS
+    Flags:   [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
+    Address: 0x0000000000000024
+  - Name:    .note.GNU-stack
+    Type:    SHT_PROGBITS
+    Address: 0x0000000000000031
+Symbols:
+  - Name:    trivial-object-test.s
+    Type:    STT_FILE
+    Index:   SHN_ABS
+  - Name:    .text
+    Type:    STT_SECTION
+    Section: .text
+  - Name:    .rodata.str1.1
+    Type:    STT_SECTION
+    Section: .rodata.str1.1
+  - Name:    .note.GNU-stack
+    Type:    STT_SECTION
+    Section: .note.GNU-stack
+  - Name:    main
+    Type:    STT_FUNC
+    Section: .text
+    Binding: STB_GLOBAL
+    Size:    0x0000000000000024
+  - Name:    SomeOtherFunction
+    Binding: STB_GLOBAL
+  - Name:    puts
+    Binding: STB_GLOBAL
+
+# RUN: llvm-objdump -t %p/Inputs/trivial-object-test.macho-i386 \
+# RUN:              | FileCheck %s -check-prefix macho-i386
+
+# macho-i386: trivial-object-test.macho-i386:        file format Mach-O 32-bit i386
+# macho-i386: SYMBOL TABLE:
+# macho-i386: 00000000 g     F __TEXT,__text  _main
+# macho-i386: 00000000         *UND*          _SomeOtherFunction
+# macho-i386: 00000000         *UND*          _puts
+
+# RUN: llvm-objdump -t %p/Inputs/shared-object-test.elf-i386 \
+# RUN:              | FileCheck %s -check-prefix ELF-shared
+
+# ELF-shared: shared-object-test.elf-i386:     file format
+# ELF-shared: SYMBOL TABLE:
+# ELF-shared: 00000200 l     F .text 00000003 local_func
+# ELF-shared: 000012b8 l     O *ABS*           00000000 .hidden _GLOBAL_OFFSET_TABLE_
+# ELF-shared: 00001248 l     O *ABS*           00000000 .hidden _DYNAMIC
+# ELF-shared: 000012c4 g     O .data           00000004 defined_sym
+# ELF-shared: 000001f0 g     F .text 00000003 global_func
index b35b55e..40175e7 100644 (file)
@@ -1,2 +1,10 @@
-// Don't crash if required information is absent
-RUN: llvm-readobj --dyn-syms %p/Inputs/trivial-object-test.elf-x86-64
+## Don't crash if required information is absent
+# RUN: yaml2obj %s > %t
+# RUN: llvm-readobj --dyn-syms %t
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_386
diff --git a/llvm/test/Object/readobj.test b/llvm/test/Object/readobj.test
deleted file mode 100644 (file)
index e29f404..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-// Don't crash while reading non-dynamic files.
-RUN: llvm-readobj %p/Inputs/trivial-object-test.elf-x86-64
diff --git a/llvm/test/tools/llvm-readobj/elf-no-action.test b/llvm/test/tools/llvm-readobj/elf-no-action.test
new file mode 100644 (file)
index 0000000..964db74
--- /dev/null
@@ -0,0 +1,50 @@
+## Show the behavior of llvm-readobj/llvm-readelf when no operations are requested.
+
+## Check the behavior on ET_EXEC input.
+
+# RUN: yaml2obj --docnum=1 %s -o %t.exe
+# RUN: llvm-readobj %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix LLVM
+# RUN: llvm-readelf %t.exe | FileCheck %s -DFILE=%t.exe --check-prefix GNU --allow-empty
+
+# LLVM: File: [[FILE]]
+# LLVM: Format: ELF64-x86-64
+# LLVM: Arch: x86_64
+# LLVM: AddressSize: 64bit
+# LLVM: LoadName: <Not found>{{$}}
+# LLVM-EMPTY:
+# LLVM-NOT: {{.}}
+
+# GNU-NOT: {{.}}
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_X86_64
+
+## Check the behavior on ET_REL input.
+
+# RUN: yaml2obj --docnum=2 %s -o %t.o
+# RUN: llvm-readobj %t.o | FileCheck %s -DFILE=%t.o --check-prefix LLVM
+# RUN: llvm-readelf %t.o | FileCheck %s -DFILE=%t.o --check-prefix GNU --allow-empty
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+
+## Check the behavior on ET_DYN input.
+
+# RUN: yaml2obj --docnum=3 %s -o %t.so
+# RUN: llvm-readobj %t.so | FileCheck %s -DFILE=%t.so --check-prefix LLVM
+# RUN: llvm-readelf %t.so | FileCheck %s -DFILE=%t.so --check-prefix GNU --allow-empty
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_X86_64