aboutsummaryrefslogtreecommitdiffstats
path: root/test/tools
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-04-23 16:57:46 -0700
committerStephen Hines <srhines@google.com>2014-04-24 15:53:16 -0700
commit36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch)
treee6cfb69fbbd937f450eeb83bfb83b9da3b01275a /test/tools
parent69a8640022b04415ae9fac62f8ab090601d8f889 (diff)
downloadexternal_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'test/tools')
-rw-r--r--test/tools/llvm-cov/Inputs/copy_block_helper.gcdabin0 -> 432 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/copy_block_helper.gcnobin0 -> 1140 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test.cpp5
-rw-r--r--test/tools/llvm-cov/Inputs/test.cpp.gcov82
-rw-r--r--test/tools/llvm-cov/Inputs/test.gcdabin824 -> 904 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test.gcnobin3112 -> 3552 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test.h3
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a.cpp.gcov111
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a.h.gcov10
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov134
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov12
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov160
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov14
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov160
-rw-r--r--test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov14
-rw-r--r--test/tools/llvm-cov/Inputs/test_-b.output13
-rw-r--r--test/tools/llvm-cov/Inputs/test_-b_-f.output65
-rw-r--r--test/tools/llvm-cov/Inputs/test_-f.output38
-rw-r--r--test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcdabin0 -> 825 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcdabin0 -> 825 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_gcda.cpp.gcov79
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_gcda.h.gcov8
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_gcda.output8
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov79
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_options.h.gcov8
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_options.output8
-rw-r--r--test/tools/llvm-cov/Inputs/test_no_preserve_paths.output8
-rw-r--r--test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov79
-rw-r--r--test/tools/llvm-cov/Inputs/test_objdir.h.gcov8
-rw-r--r--test/tools/llvm-cov/Inputs/test_paths.cpp.gcov79
-rw-r--r--test/tools/llvm-cov/Inputs/test_paths.gcdabin0 -> 904 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test_paths.gcnobin0 -> 4476 bytes
-rw-r--r--test/tools/llvm-cov/Inputs/test_paths.h.gcov8
-rw-r--r--test/tools/llvm-cov/Inputs/test_preserve_paths.output8
-rw-r--r--test/tools/llvm-cov/Inputs/test_read_fail.gcnobin111 -> 71 bytes
-rw-r--r--test/tools/llvm-cov/copy_block_helper.m32
-rw-r--r--test/tools/llvm-cov/lit.local.cfg2
-rw-r--r--test/tools/llvm-cov/llvm-cov.test96
-rw-r--r--test/tools/llvm-objdump/Inputs/export.dll.coff-i386bin0 -> 1052 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/many-relocs.obj-i386bin0 -> 305 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/nop.exe.coff-i386bin7680 -> 6144 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386bin0 -> 4450 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/out-of-section-sym.s15
-rw-r--r--test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exebin0 -> 2560 bytes
-rw-r--r--test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj (renamed from test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64)bin698 -> 698 bytes
-rw-r--r--test/tools/llvm-objdump/coff-many-relocs.test14
-rw-r--r--test/tools/llvm-objdump/coff-private-headers.test70
-rw-r--r--test/tools/llvm-objdump/hex-relocation-addr.test17
-rw-r--r--test/tools/llvm-objdump/out-of-section-sym.test13
-rw-r--r--test/tools/llvm-objdump/win64-unwind-data.test155
-rw-r--r--test/tools/llvm-profdata/Inputs/bad-hash.profdata4
-rw-r--r--test/tools/llvm-profdata/Inputs/bar3-1.profdata6
-rw-r--r--test/tools/llvm-profdata/Inputs/c-general.profdatabin0 -> 1384 bytes
-rw-r--r--test/tools/llvm-profdata/Inputs/empty.profdata0
-rw-r--r--test/tools/llvm-profdata/Inputs/extra-word.profdata2
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3-1.profdata6
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3-2.profdata6
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata13
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata13
-rw-r--r--test/tools/llvm-profdata/Inputs/foo4-1.profdata7
-rw-r--r--test/tools/llvm-profdata/Inputs/foo4-2.profdata7
-rw-r--r--test/tools/llvm-profdata/Inputs/invalid-count-later.profdata4
-rw-r--r--test/tools/llvm-profdata/Inputs/overflow.profdata4
-rw-r--r--test/tools/llvm-profdata/c-general.test24
-rw-r--r--test/tools/llvm-profdata/errors.test13
-rw-r--r--test/tools/llvm-profdata/raw-32-bits-be.test42
-rw-r--r--test/tools/llvm-profdata/raw-32-bits-le.test42
-rw-r--r--test/tools/llvm-profdata/raw-64-bits-be.test42
-rw-r--r--test/tools/llvm-profdata/raw-64-bits-le.test42
-rw-r--r--test/tools/llvm-profdata/raw-magic-but-no-header.test6
-rw-r--r--test/tools/llvm-profdata/simple.test68
-rw-r--r--test/tools/llvm-readobj/ARM/attributes.s287
-rw-r--r--test/tools/llvm-readobj/ARM/lit.local.cfg4
-rw-r--r--test/tools/llvm-readobj/ARM/unwind.s326
-rw-r--r--test/tools/llvm-readobj/Inputs/cxx-cli-aux.cpp2
-rw-r--r--test/tools/llvm-readobj/Inputs/cxx-cli-aux.obj.coff-i386bin0 -> 2682 bytes
-rwxr-xr-xtest/tools/llvm-readobj/Inputs/dynamic-table-exe.mipsbin0 -> 6333 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/dynamic-table-so.mips (renamed from test/tools/llvm-readobj/Inputs/dynamic-table.mips)bin5395 -> 5395 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/dynamic-table.c6
-rw-r--r--test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-i368bin0 -> 1631 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-x86_64bin0 -> 1799 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-i368bin0 -> 2155 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-x86_64bin0 -> 2475 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/nop.exe.coff-x86-64bin0 -> 1024 bytes
-rwxr-xr-xtest/tools/llvm-readobj/Inputs/trivial.obj.coff-armbin0 -> 367 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386bin314 -> 350 bytes
-rw-r--r--test/tools/llvm-readobj/Inputs/zero-string-table.obj.coff-i386bin0 -> 704 bytes
-rw-r--r--test/tools/llvm-readobj/codeview-linetables.test282
-rw-r--r--test/tools/llvm-readobj/coff-zero-string-table.test8
-rw-r--r--test/tools/llvm-readobj/cxx-cli-aux.test42
-rw-r--r--test/tools/llvm-readobj/dynamic.test41
-rw-r--r--test/tools/llvm-readobj/file-headers.test19
-rw-r--r--test/tools/llvm-readobj/peplus.test83
-rw-r--r--test/tools/llvm-readobj/sections-ext.test27
-rw-r--r--test/tools/llvm-readobj/symbols.test22
95 files changed, 2951 insertions, 164 deletions
diff --git a/test/tools/llvm-cov/Inputs/copy_block_helper.gcda b/test/tools/llvm-cov/Inputs/copy_block_helper.gcda
new file mode 100644
index 0000000..d7ff469
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/copy_block_helper.gcda
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/copy_block_helper.gcno b/test/tools/llvm-cov/Inputs/copy_block_helper.gcno
new file mode 100644
index 0000000..a9d1084
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/copy_block_helper.gcno
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test.cpp b/test/tools/llvm-cov/Inputs/test.cpp
index 07bc3f2..e580e5a 100644
--- a/test/tools/llvm-cov/Inputs/test.cpp
+++ b/test/tools/llvm-cov/Inputs/test.cpp
@@ -1,3 +1,4 @@
+#include "test.h"
#include <cstdlib>
bool on = false;
@@ -6,10 +7,6 @@ double grid[10][10] = {0};
const char * hello = "world";
const char * world = "hello";
-struct A {
- virtual void B();
-};
-
void A::B() {}
void useless() {}
diff --git a/test/tools/llvm-cov/Inputs/test.cpp.gcov b/test/tools/llvm-cov/Inputs/test.cpp.gcov
deleted file mode 100644
index a3dacc2..0000000
--- a/test/tools/llvm-cov/Inputs/test.cpp.gcov
+++ /dev/null
@@ -1,82 +0,0 @@
- -: 0:Source:test.cpp
- -: 0:Graph:test.gcno
- -: 0:Data:test.gcda
- -: 0:Runs:2
- -: 0:Programs:1
- -: 1:#include <cstdlib>
- -: 2:
- -: 3:bool on = false;
- -: 4:int len = 42;
- -: 5:double grid[10][10] = {0};
- -: 6:const char * hello = "world";
- -: 7:const char * world = "hello";
- -: 8:
- 4: 9:struct A {
- -: 10: virtual void B();
- -: 11:};
- -: 12:
-8589934592: 13:void A::B() {}
- -: 14:
- #####: 15:void useless() {}
- -: 16:
- -: 17:double more_useless() {
- #####: 18: return 0;
- -: 19:}
- -: 20:
- -: 21:int foo() {
- 2: 22: on = true;
- 2: 23: return 3;
- -: 24:}
- -: 25:
- -: 26:int bar() {
- #####: 27: len--;
- #####: 28: return foo() + 45;
- -: 29:}
- -: 30:
- 8: 31:void assign(int ii, int jj) {
- 8: 32: grid[ii][jj] = (ii+1) * (jj+1);
- 8: 33:}
- -: 34:
- -: 35:void initialize_grid() {
- 12: 36: for (int ii = 0; ii < 2; ii++)
- 24: 37: for (int jj = 0; jj < 2; jj++)
- 12: 38: assign(ii, jj);
- 2: 39:}
- -: 40:
- -: 41:int main() {
- 2: 42: initialize_grid();
- -: 43:
- 2: 44: int a = 2;
- 2: 45: on = rand() % 2;
- 2: 46: if (on) {
- 2: 47: foo();
- 2: 48: ++a;
- 2: 49: } else {
- #####: 50: bar();
- #####: 51: a += rand();
- -: 52: }
- -: 53:
- 44: 54: for (int ii = 0; ii < 10; ++ii) {
- 20: 55: switch (rand() % 5) {
- -: 56: case 0:
- 4: 57: a += rand();
- 4: 58: break;
- -: 59: case 1:
- -: 60: case 2:
- 2: 61: a += rand() / rand();
- 2: 62: break;
- -: 63: case 3:
- 6: 64: a -= rand();
- 6: 65: break;
- -: 66: default:
- 8: 67: a = -1;
- 8: 68: }
- 20: 69: }
- -: 70:
- 2: 71: A thing;
-17179869188: 72: for (uint64_t ii = 0; ii < 4294967296; ++ii)
-8589934592: 73: thing.B();
- -: 74:
- 2: 75: return a + 8 + grid[2][3] + len;
- -: 76: return more_useless();
- -: 77:}
diff --git a/test/tools/llvm-cov/Inputs/test.gcda b/test/tools/llvm-cov/Inputs/test.gcda
index 23d03bd..613e3a8 100644
--- a/test/tools/llvm-cov/Inputs/test.gcda
+++ b/test/tools/llvm-cov/Inputs/test.gcda
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test.gcno b/test/tools/llvm-cov/Inputs/test.gcno
index 6162604..24f1c82 100644
--- a/test/tools/llvm-cov/Inputs/test.gcno
+++ b/test/tools/llvm-cov/Inputs/test.gcno
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test.h b/test/tools/llvm-cov/Inputs/test.h
new file mode 100644
index 0000000..55d9c6a
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test.h
@@ -0,0 +1,3 @@
+struct A {
+ virtual void B();
+};
diff --git a/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov b/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
new file mode 100644
index 0000000..c2210d5
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
@@ -0,0 +1,111 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+8589934592: 10:void A::B() {}
+8589934592: 10-block 0
+ -: 11:
+ #####: 12:void useless() {}
+ $$$$$: 12-block 0
+ -: 13:
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ $$$$$: 15-block 0
+ -: 16:}
+ -: 17:
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ 2: 20-block 0
+ -: 21:}
+ -: 22:
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ $$$$$: 25-block 0
+ -: 26:}
+ -: 27:
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ 8: 30-block 0
+ -: 31:
+ -: 32:void initialize_grid() {
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 2: 33-block 0
+ 6: 33-block 1
+ 4: 33-block 2
+ 12: 34: for (int jj = 0; jj < 2; jj++)
+ 4: 34-block 0
+ 12: 34-block 1
+ 8: 34-block 2
+ 8: 35: assign(ii, jj);
+ 8: 35-block 0
+ 4: 35-block 1
+ 2: 36:}
+ 2: 36-block 0
+ -: 37:
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 43-block 0
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ 2: 46-block 0
+ #####: 47: bar();
+ #####: 48: a += rand();
+ $$$$$: 48-block 0
+ -: 49: }
+ -: 50:
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
+ 2: 51-block 0
+ 22: 51-block 1
+ 20: 51-block 2
+ 20: 52: switch (rand() % 5) {
+ 20: 52-block 0
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ 4: 55-block 0
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ 2: 59-block 0
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ 6: 62-block 0
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 8: 65-block 0
+ 20: 66: }
+ 20: 66-block 0
+ -: 67:
+ 2: 68: A thing;
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+ 2: 69-block 0
+8589934594: 69-block 1
+8589934592: 69-block 2
+8589934592: 70: thing.B();
+8589934592: 70-block 0
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ 2: 72-block 0
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_-a.h.gcov b/test/tools/llvm-cov/Inputs/test_-a.h.gcov
new file mode 100644
index 0000000..a5fe62b
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a.h.gcov
@@ -0,0 +1,10 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ 2: 1:struct A {
+ 2: 1-block 0
+ 2: 1-block 1
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
new file mode 100644
index 0000000..ae21037
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
@@ -0,0 +1,134 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+function _ZN1A1BEv called 8589934592 returned 100% blocks executed 100%
+8589934592: 10:void A::B() {}
+8589934592: 10-block 0
+ -: 11:
+function _Z7uselessv called 0 returned 0% blocks executed 0%
+ #####: 12:void useless() {}
+ $$$$$: 12-block 0
+ -: 13:
+function _Z12more_uselessv called 0 returned 0% blocks executed 0%
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ $$$$$: 15-block 0
+ -: 16:}
+ -: 17:
+function _Z3foov called 2 returned 100% blocks executed 100%
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ 2: 20-block 0
+ -: 21:}
+ -: 22:
+function _Z3barv called 0 returned 0% blocks executed 0%
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ $$$$$: 25-block 0
+ -: 26:}
+ -: 27:
+function _Z6assignii called 8 returned 100% blocks executed 100%
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ 8: 30-block 0
+ -: 31:
+function _Z15initialize_gridv called 2 returned 100% blocks executed 100%
+ -: 32:void initialize_grid() {
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 2: 33-block 0
+ 6: 33-block 1
+branch 0 taken 67%
+branch 1 taken 33%
+ 4: 33-block 2
+ 12: 34: for (int jj = 0; jj < 2; jj++)
+ 4: 34-block 0
+ 12: 34-block 1
+branch 0 taken 67%
+branch 1 taken 33%
+ 8: 34-block 2
+ 8: 35: assign(ii, jj);
+ 8: 35-block 0
+ 4: 35-block 1
+ 2: 36:}
+ 2: 36-block 0
+ -: 37:
+function main called 2 returned 100% blocks executed 94%
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 43-block 0
+branch 0 taken 100%
+branch 1 taken 0%
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ 2: 46-block 0
+ #####: 47: bar();
+ #####: 48: a += rand();
+ $$$$$: 48-block 0
+ -: 49: }
+ -: 50:
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
+ 2: 51-block 0
+ 22: 51-block 1
+branch 0 taken 91%
+branch 1 taken 9%
+ 20: 51-block 2
+ 20: 52: switch (rand() % 5) {
+ 20: 52-block 0
+branch 0 taken 20%
+branch 1 taken 0%
+branch 2 taken 10%
+branch 3 taken 30%
+branch 4 taken 40%
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ 4: 55-block 0
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ 2: 59-block 0
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ 6: 62-block 0
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 8: 65-block 0
+ 20: 66: }
+ 20: 66-block 0
+ -: 67:
+ 2: 68: A thing;
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+ 2: 69-block 0
+8589934594: 69-block 1
+branch 0 taken 99%
+branch 1 taken 1%
+8589934592: 69-block 2
+8589934592: 70: thing.B();
+8589934592: 70-block 0
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ 2: 72-block 0
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
new file mode 100644
index 0000000..f3dabcb
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
@@ -0,0 +1,12 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
+function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
+ 2: 1:struct A {
+ 2: 1-block 0
+ 2: 1-block 1
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
new file mode 100644
index 0000000..cc5940f
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
@@ -0,0 +1,160 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+function _ZN1A1BEv called 8589934592 returned 100% blocks executed 100%
+8589934592: 10:void A::B() {}
+8589934592: 10-block 0
+unconditional 0 taken 8589934592
+ -: 11:
+function _Z7uselessv called 0 returned 0% blocks executed 0%
+ #####: 12:void useless() {}
+ $$$$$: 12-block 0
+unconditional 0 never executed
+ -: 13:
+function _Z12more_uselessv called 0 returned 0% blocks executed 0%
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ $$$$$: 15-block 0
+unconditional 0 never executed
+ -: 16:}
+ -: 17:
+function _Z3foov called 2 returned 100% blocks executed 100%
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ 2: 20-block 0
+unconditional 0 taken 2
+ -: 21:}
+ -: 22:
+function _Z3barv called 0 returned 0% blocks executed 0%
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ $$$$$: 25-block 0
+unconditional 0 never executed
+ -: 26:}
+ -: 27:
+function _Z6assignii called 8 returned 100% blocks executed 100%
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ 8: 30-block 0
+unconditional 0 taken 8
+ -: 31:
+function _Z15initialize_gridv called 2 returned 100% blocks executed 100%
+ -: 32:void initialize_grid() {
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 2: 33-block 0
+unconditional 0 taken 2
+ 6: 33-block 1
+branch 1 taken 4
+branch 2 taken 2
+ 4: 33-block 2
+unconditional 3 taken 4
+ 12: 34: for (int jj = 0; jj < 2; jj++)
+ 4: 34-block 0
+unconditional 0 taken 4
+ 12: 34-block 1
+branch 1 taken 8
+branch 2 taken 4
+ 8: 34-block 2
+unconditional 3 taken 8
+ 8: 35: assign(ii, jj);
+ 8: 35-block 0
+unconditional 0 taken 8
+ 4: 35-block 1
+unconditional 1 taken 4
+ 2: 36:}
+ 2: 36-block 0
+unconditional 0 taken 2
+ -: 37:
+function main called 2 returned 100% blocks executed 94%
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 43-block 0
+branch 0 taken 2
+branch 1 taken 0
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ 2: 46-block 0
+unconditional 0 taken 2
+ #####: 47: bar();
+ #####: 48: a += rand();
+ $$$$$: 48-block 0
+unconditional 0 never executed
+ -: 49: }
+ -: 50:
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
+ 2: 51-block 0
+unconditional 0 taken 2
+ 22: 51-block 1
+branch 1 taken 20
+branch 2 taken 2
+ 20: 51-block 2
+unconditional 3 taken 20
+ 20: 52: switch (rand() % 5) {
+ 20: 52-block 0
+branch 0 taken 4
+branch 1 taken 0
+branch 2 taken 2
+branch 3 taken 6
+branch 4 taken 8
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ 4: 55-block 0
+unconditional 0 taken 4
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ 2: 59-block 0
+unconditional 0 taken 2
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ 6: 62-block 0
+unconditional 0 taken 6
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 8: 65-block 0
+unconditional 0 taken 8
+ 20: 66: }
+ 20: 66-block 0
+unconditional 0 taken 20
+ -: 67:
+ 2: 68: A thing;
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+ 2: 69-block 0
+unconditional 0 taken 2
+8589934594: 69-block 1
+branch 1 taken 8589934592
+branch 2 taken 2
+8589934592: 69-block 2
+unconditional 3 taken 8589934592
+8589934592: 70: thing.B();
+8589934592: 70-block 0
+unconditional 0 taken 8589934592
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ 2: 72-block 0
+unconditional 0 taken 2
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
new file mode 100644
index 0000000..840324e
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
@@ -0,0 +1,14 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
+function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
+ 2: 1:struct A {
+ 2: 1-block 0
+unconditional 0 taken 2
+ 2: 1-block 1
+unconditional 1 taken 2
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
new file mode 100644
index 0000000..0d2c6b3
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
@@ -0,0 +1,160 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+function _ZN1A1BEv called 8589934592 returned 100% blocks executed 100%
+8589934592: 10:void A::B() {}
+8589934592: 10-block 0
+unconditional 0 taken 100%
+ -: 11:
+function _Z7uselessv called 0 returned 0% blocks executed 0%
+ #####: 12:void useless() {}
+ $$$$$: 12-block 0
+unconditional 0 never executed
+ -: 13:
+function _Z12more_uselessv called 0 returned 0% blocks executed 0%
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ $$$$$: 15-block 0
+unconditional 0 never executed
+ -: 16:}
+ -: 17:
+function _Z3foov called 2 returned 100% blocks executed 100%
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ 2: 20-block 0
+unconditional 0 taken 100%
+ -: 21:}
+ -: 22:
+function _Z3barv called 0 returned 0% blocks executed 0%
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ $$$$$: 25-block 0
+unconditional 0 never executed
+ -: 26:}
+ -: 27:
+function _Z6assignii called 8 returned 100% blocks executed 100%
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ 8: 30-block 0
+unconditional 0 taken 100%
+ -: 31:
+function _Z15initialize_gridv called 2 returned 100% blocks executed 100%
+ -: 32:void initialize_grid() {
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 2: 33-block 0
+unconditional 0 taken 100%
+ 6: 33-block 1
+branch 1 taken 67%
+branch 2 taken 33%
+ 4: 33-block 2
+unconditional 3 taken 100%
+ 12: 34: for (int jj = 0; jj < 2; jj++)
+ 4: 34-block 0
+unconditional 0 taken 100%
+ 12: 34-block 1
+branch 1 taken 67%
+branch 2 taken 33%
+ 8: 34-block 2
+unconditional 3 taken 100%
+ 8: 35: assign(ii, jj);
+ 8: 35-block 0
+unconditional 0 taken 100%
+ 4: 35-block 1
+unconditional 1 taken 100%
+ 2: 36:}
+ 2: 36-block 0
+unconditional 0 taken 100%
+ -: 37:
+function main called 2 returned 100% blocks executed 94%
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 43-block 0
+branch 0 taken 100%
+branch 1 taken 0%
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ 2: 46-block 0
+unconditional 0 taken 100%
+ #####: 47: bar();
+ #####: 48: a += rand();
+ $$$$$: 48-block 0
+unconditional 0 never executed
+ -: 49: }
+ -: 50:
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
+ 2: 51-block 0
+unconditional 0 taken 100%
+ 22: 51-block 1
+branch 1 taken 91%
+branch 2 taken 9%
+ 20: 51-block 2
+unconditional 3 taken 100%
+ 20: 52: switch (rand() % 5) {
+ 20: 52-block 0
+branch 0 taken 20%
+branch 1 taken 0%
+branch 2 taken 10%
+branch 3 taken 30%
+branch 4 taken 40%
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ 4: 55-block 0
+unconditional 0 taken 100%
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ 2: 59-block 0
+unconditional 0 taken 100%
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ 6: 62-block 0
+unconditional 0 taken 100%
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 8: 65-block 0
+unconditional 0 taken 100%
+ 20: 66: }
+ 20: 66-block 0
+unconditional 0 taken 100%
+ -: 67:
+ 2: 68: A thing;
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+ 2: 69-block 0
+unconditional 0 taken 100%
+8589934594: 69-block 1
+branch 1 taken 99%
+branch 2 taken 1%
+8589934592: 69-block 2
+unconditional 3 taken 100%
+8589934592: 70: thing.B();
+8589934592: 70-block 0
+unconditional 0 taken 100%
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ 2: 72-block 0
+unconditional 0 taken 100%
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov b/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
new file mode 100644
index 0000000..e7fa658
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
@@ -0,0 +1,14 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
+function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
+ 2: 1:struct A {
+ 2: 1-block 0
+unconditional 0 taken 100%
+ 2: 1-block 1
+unconditional 1 taken 100%
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_-b.output b/test/tools/llvm-cov/Inputs/test_-b.output
new file mode 100644
index 0000000..515987d
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-b.output
@@ -0,0 +1,13 @@
+File 'test.cpp'
+Lines executed:84.21% of 38
+Branches executed:100.00% of 15
+Taken at least once:86.67% of 15
+No calls
+test.cpp:creating 'test.cpp.gcov'
+
+File './test.h'
+Lines executed:100.00% of 1
+No branches
+No calls
+./test.h:creating 'test.h.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_-b_-f.output b/test/tools/llvm-cov/Inputs/test_-b_-f.output
new file mode 100644
index 0000000..c3ccd05
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-b_-f.output
@@ -0,0 +1,65 @@
+Function '_ZN1A1BEv'
+Lines executed:100.00% of 1
+No branches
+No calls
+
+Function '_Z7uselessv'
+Lines executed:0.00% of 1
+No branches
+No calls
+
+Function '_Z12more_uselessv'
+Lines executed:0.00% of 1
+No branches
+No calls
+
+Function '_Z3foov'
+Lines executed:100.00% of 2
+No branches
+No calls
+
+Function '_Z3barv'
+Lines executed:0.00% of 2
+No branches
+No calls
+
+Function '_Z6assignii'
+Lines executed:100.00% of 3
+No branches
+No calls
+
+Function '_Z15initialize_gridv'
+Lines executed:100.00% of 4
+Branches executed:100.00% of 4
+Taken at least once:100.00% of 4
+No calls
+
+Function 'main'
+Lines executed:91.67% of 24
+Branches executed:100.00% of 11
+Taken at least once:81.82% of 11
+No calls
+
+Function '_ZN1AC1Ev'
+Lines executed:100.00% of 1
+No branches
+No calls
+
+Function '_ZN1AC2Ev'
+No executable lines
+No branches
+No calls
+
+File 'test.cpp'
+Lines executed:84.21% of 38
+Branches executed:100.00% of 15
+Taken at least once:86.67% of 15
+No calls
+test.cpp:creating 'test.cpp.gcov'
+
+File './test.h'
+Lines executed:100.00% of 1
+No branches
+No calls
+./test.h:creating 'test.h.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_-f.output b/test/tools/llvm-cov/Inputs/test_-f.output
new file mode 100644
index 0000000..d97aa18
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_-f.output
@@ -0,0 +1,38 @@
+Function '_ZN1A1BEv'
+Lines executed:100.00% of 1
+
+Function '_Z7uselessv'
+Lines executed:0.00% of 1
+
+Function '_Z12more_uselessv'
+Lines executed:0.00% of 1
+
+Function '_Z3foov'
+Lines executed:100.00% of 2
+
+Function '_Z3barv'
+Lines executed:0.00% of 2
+
+Function '_Z6assignii'
+Lines executed:100.00% of 3
+
+Function '_Z15initialize_gridv'
+Lines executed:100.00% of 4
+
+Function 'main'
+Lines executed:91.67% of 24
+
+Function '_ZN1AC1Ev'
+Lines executed:100.00% of 1
+
+Function '_ZN1AC2Ev'
+Lines executed:100.00% of 1
+
+File 'test.cpp'
+Lines executed:84.21% of 38
+test.cpp:creating 'test.cpp.gcov'
+
+File './test.h'
+Lines executed:100.00% of 1
+./test.h:creating 'test.h.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda b/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda
new file mode 100644
index 0000000..8bfd82c
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda b/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda
new file mode 100644
index 0000000..4c729a8
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test_no_gcda.cpp.gcov b/test/tools/llvm-cov/Inputs/test_no_gcda.cpp.gcov
new file mode 100644
index 0000000..31353ca
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_gcda.cpp.gcov
@@ -0,0 +1,79 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:-
+ -: 0:Runs:0
+ -: 0:Programs:0
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+ #####: 10:void A::B() {}
+ -: 11:
+ #####: 12:void useless() {}
+ -: 13:
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ -: 16:}
+ -: 17:
+ -: 18:int foo() {
+ #####: 19: on = true;
+ #####: 20: return 3;
+ -: 21:}
+ -: 22:
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ -: 26:}
+ -: 27:
+ #####: 28:void assign(int ii, int jj) {
+ #####: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ #####: 30:}
+ -: 31:
+ -: 32:void initialize_grid() {
+ #####: 33: for (int ii = 0; ii < 2; ii++)
+ #####: 34: for (int jj = 0; jj < 2; jj++)
+ #####: 35: assign(ii, jj);
+ #####: 36:}
+ -: 37:
+ -: 38:int main() {
+ #####: 39: initialize_grid();
+ -: 40:
+ #####: 41: int a = 2;
+ #####: 42: on = rand() % 2;
+ #####: 43: if (on) {
+ #####: 44: foo();
+ #####: 45: ++a;
+ #####: 46: } else {
+ #####: 47: bar();
+ #####: 48: a += rand();
+ -: 49: }
+ -: 50:
+ #####: 51: for (int ii = 0; ii < 10; ++ii) {
+ #####: 52: switch (rand() % 5) {
+ -: 53: case 0:
+ #####: 54: a += rand();
+ #####: 55: break;
+ -: 56: case 1:
+ -: 57: case 2:
+ #####: 58: a += rand() / rand();
+ #####: 59: break;
+ -: 60: case 3:
+ #####: 61: a -= rand();
+ #####: 62: break;
+ -: 63: default:
+ #####: 64: a = -1;
+ #####: 65: }
+ #####: 66: }
+ -: 67:
+ #####: 68: A thing;
+ #####: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+ #####: 70: thing.B();
+ -: 71:
+ #####: 72: return a + 8 + grid[2][3] + len;
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_no_gcda.h.gcov b/test/tools/llvm-cov/Inputs/test_no_gcda.h.gcov
new file mode 100644
index 0000000..c0a45c6
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_gcda.h.gcov
@@ -0,0 +1,8 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:-
+ -: 0:Runs:0
+ -: 0:Programs:0
+ #####: 1:struct A {
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_no_gcda.output b/test/tools/llvm-cov/Inputs/test_no_gcda.output
new file mode 100644
index 0000000..e994be7
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_gcda.output
@@ -0,0 +1,8 @@
+File 'test.cpp'
+Lines executed:0.00% of 38
+test.cpp:creating 'test.cpp.gcov'
+
+File './test.h'
+Lines executed:0.00% of 1
+./test.h:creating 'test.h.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov b/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
new file mode 100644
index 0000000..871e3ba
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
@@ -0,0 +1,79 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+8589934592: 10:void A::B() {}
+ -: 11:
+ #####: 12:void useless() {}
+ -: 13:
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ -: 16:}
+ -: 17:
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ -: 21:}
+ -: 22:
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ -: 26:}
+ -: 27:
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ -: 31:
+ -: 32:void initialize_grid() {
+ 12: 33: for (int ii = 0; ii < 2; ii++)
+ 24: 34: for (int jj = 0; jj < 2; jj++)
+ 12: 35: assign(ii, jj);
+ 2: 36:}
+ -: 37:
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ #####: 47: bar();
+ #####: 48: a += rand();
+ -: 49: }
+ -: 50:
+ 44: 51: for (int ii = 0; ii < 10; ++ii) {
+ 20: 52: switch (rand() % 5) {
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 20: 66: }
+ -: 67:
+ 2: 68: A thing;
+17179869188: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+8589934592: 70: thing.B();
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_no_options.h.gcov b/test/tools/llvm-cov/Inputs/test_no_options.h.gcov
new file mode 100644
index 0000000..4ba58c9
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_options.h.gcov
@@ -0,0 +1,8 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:test.gcno
+ -: 0:Data:test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ 4: 1:struct A {
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_no_options.output b/test/tools/llvm-cov/Inputs/test_no_options.output
new file mode 100644
index 0000000..8be8c1c
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_options.output
@@ -0,0 +1,8 @@
+File 'test.cpp'
+Lines executed:84.21% of 38
+test.cpp:creating 'test.cpp.gcov'
+
+File './test.h'
+Lines executed:100.00% of 1
+./test.h:creating 'test.h.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output b/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output
new file mode 100644
index 0000000..ada0c36
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_no_preserve_paths.output
@@ -0,0 +1,8 @@
+File 'srcdir/./nested_dir/../test.h'
+Lines executed:100.00% of 1
+srcdir/./nested_dir/../test.h:creating 'test.h.gcov'
+
+File 'srcdir/./nested_dir/../test.cpp'
+Lines executed:84.21% of 38
+srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov b/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
new file mode 100644
index 0000000..abf8856
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
@@ -0,0 +1,79 @@
+ -: 0:Source:test.cpp
+ -: 0:Graph:objdir/test.gcno
+ -: 0:Data:objdir/test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+8589934592: 10:void A::B() {}
+ -: 11:
+ #####: 12:void useless() {}
+ -: 13:
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ -: 16:}
+ -: 17:
+ -: 18:int foo() {
+ 2: 19: on = true;
+ 2: 20: return 3;
+ -: 21:}
+ -: 22:
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ -: 26:}
+ -: 27:
+ 8: 28:void assign(int ii, int jj) {
+ 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 8: 30:}
+ -: 31:
+ -: 32:void initialize_grid() {
+ 12: 33: for (int ii = 0; ii < 2; ii++)
+ 24: 34: for (int jj = 0; jj < 2; jj++)
+ 12: 35: assign(ii, jj);
+ 2: 36:}
+ -: 37:
+ -: 38:int main() {
+ 2: 39: initialize_grid();
+ -: 40:
+ 2: 41: int a = 2;
+ 2: 42: on = rand() % 2;
+ 2: 43: if (on) {
+ 2: 44: foo();
+ 2: 45: ++a;
+ 2: 46: } else {
+ #####: 47: bar();
+ #####: 48: a += rand();
+ -: 49: }
+ -: 50:
+ 44: 51: for (int ii = 0; ii < 10; ++ii) {
+ 20: 52: switch (rand() % 5) {
+ -: 53: case 0:
+ 4: 54: a += rand();
+ 4: 55: break;
+ -: 56: case 1:
+ -: 57: case 2:
+ 2: 58: a += rand() / rand();
+ 2: 59: break;
+ -: 60: case 3:
+ 6: 61: a -= rand();
+ 6: 62: break;
+ -: 63: default:
+ 8: 64: a = -1;
+ 8: 65: }
+ 20: 66: }
+ -: 67:
+ 2: 68: A thing;
+17179869188: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+8589934592: 70: thing.B();
+ -: 71:
+ 2: 72: return a + 8 + grid[2][3] + len;
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_objdir.h.gcov b/test/tools/llvm-cov/Inputs/test_objdir.h.gcov
new file mode 100644
index 0000000..8208d25
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_objdir.h.gcov
@@ -0,0 +1,8 @@
+ -: 0:Source:./test.h
+ -: 0:Graph:objdir/test.gcno
+ -: 0:Data:objdir/test.gcda
+ -: 0:Runs:2
+ -: 0:Programs:1
+ 4: 1:struct A {
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov b/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
new file mode 100644
index 0000000..3982ddf
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
@@ -0,0 +1,79 @@
+ -: 0:Source:srcdir/./nested_dir/../test.cpp
+ -: 0:Graph:test_paths.gcno
+ -: 0:Data:test_paths.gcda
+ -: 0:Runs:3
+ -: 0:Programs:1
+ -: 1:#include "test.h"
+ -: 2:#include <cstdlib>
+ -: 3:
+ -: 4:bool on = false;
+ -: 5:int len = 42;
+ -: 6:double grid[10][10] = {0};
+ -: 7:const char * hello = "world";
+ -: 8:const char * world = "hello";
+ -: 9:
+12884901888: 10:void A::B() {}
+ -: 11:
+ #####: 12:void useless() {}
+ -: 13:
+ -: 14:double more_useless() {
+ #####: 15: return 0;
+ -: 16:}
+ -: 17:
+ -: 18:int foo() {
+ 3: 19: on = true;
+ 3: 20: return 3;
+ -: 21:}
+ -: 22:
+ -: 23:int bar() {
+ #####: 24: len--;
+ #####: 25: return foo() + 45;
+ -: 26:}
+ -: 27:
+ 12: 28:void assign(int ii, int jj) {
+ 12: 29: grid[ii][jj] = (ii+1) * (jj+1);
+ 12: 30:}
+ -: 31:
+ -: 32:void initialize_grid() {
+ 21: 33: for (int ii = 0; ii < 2; ii++)
+ 36: 34: for (int jj = 0; jj < 2; jj++)
+ 18: 35: assign(ii, jj);
+ 3: 36:}
+ -: 37:
+ -: 38:int main() {
+ 3: 39: initialize_grid();
+ -: 40:
+ 3: 41: int a = 2;
+ 3: 42: on = rand() % 2;
+ 3: 43: if (on) {
+ 3: 44: foo();
+ 3: 45: ++a;
+ 3: 46: } else {
+ #####: 47: bar();
+ #####: 48: a += rand();
+ -: 49: }
+ -: 50:
+ 66: 51: for (int ii = 0; ii < 10; ++ii) {
+ 30: 52: switch (rand() % 5) {
+ -: 53: case 0:
+ 6: 54: a += rand();
+ 6: 55: break;
+ -: 56: case 1:
+ -: 57: case 2:
+ 3: 58: a += rand() / rand();
+ 3: 59: break;
+ -: 60: case 3:
+ 9: 61: a -= rand();
+ 9: 62: break;
+ -: 63: default:
+ 12: 64: a = -1;
+ 12: 65: }
+ 30: 66: }
+ -: 67:
+ 3: 68: A thing;
+25769803782: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+12884901888: 70: thing.B();
+ -: 71:
+ 3: 72: return a + 8 + grid[2][3] + len;
+ -: 73: return more_useless();
+ -: 74:}
diff --git a/test/tools/llvm-cov/Inputs/test_paths.gcda b/test/tools/llvm-cov/Inputs/test_paths.gcda
new file mode 100644
index 0000000..7e2cf9e
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_paths.gcda
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test_paths.gcno b/test/tools/llvm-cov/Inputs/test_paths.gcno
new file mode 100644
index 0000000..aada974
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_paths.gcno
Binary files differ
diff --git a/test/tools/llvm-cov/Inputs/test_paths.h.gcov b/test/tools/llvm-cov/Inputs/test_paths.h.gcov
new file mode 100644
index 0000000..95e90ca
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_paths.h.gcov
@@ -0,0 +1,8 @@
+ -: 0:Source:srcdir/./nested_dir/../test.h
+ -: 0:Graph:test_paths.gcno
+ -: 0:Data:test_paths.gcda
+ -: 0:Runs:3
+ -: 0:Programs:1
+ 6: 1:struct A {
+ -: 2: virtual void B();
+ -: 3:};
diff --git a/test/tools/llvm-cov/Inputs/test_preserve_paths.output b/test/tools/llvm-cov/Inputs/test_preserve_paths.output
new file mode 100644
index 0000000..5331972
--- /dev/null
+++ b/test/tools/llvm-cov/Inputs/test_preserve_paths.output
@@ -0,0 +1,8 @@
+File 'srcdir/./nested_dir/../test.h'
+Lines executed:100.00% of 1
+srcdir/./nested_dir/../test.h:creating 'srcdir#nested_dir#^#test.h.gcov'
+
+File 'srcdir/./nested_dir/../test.cpp'
+Lines executed:84.21% of 38
+srcdir/./nested_dir/../test.cpp:creating 'srcdir#nested_dir#^#test.cpp.gcov'
+
diff --git a/test/tools/llvm-cov/Inputs/test_read_fail.gcno b/test/tools/llvm-cov/Inputs/test_read_fail.gcno
index 63b5d71..88073f1 100644
--- a/test/tools/llvm-cov/Inputs/test_read_fail.gcno
+++ b/test/tools/llvm-cov/Inputs/test_read_fail.gcno
Binary files differ
diff --git a/test/tools/llvm-cov/copy_block_helper.m b/test/tools/llvm-cov/copy_block_helper.m
new file mode 100644
index 0000000..1859b88
--- /dev/null
+++ b/test/tools/llvm-cov/copy_block_helper.m
@@ -0,0 +1,32 @@
+// Make sure that compiler-added functions (whose line number is zero) don't
+// crash llvm-cov.
+
+// We need shell for cd
+// REQUIRES: shell
+
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cd %t
+// RUN: cp %s %p/Inputs/copy_block_helper.gc* .
+
+// RUN: llvm-cov copy_block_helper.m | FileCheck %s --check-prefix=STDOUT
+// STDOUT: File 'copy_block_helper.m'
+// STDOUT: Lines executed:100.00% of 5
+// STDOUT: copy_block_helper.m:creating 'copy_block_helper.m.gcov'
+
+// RUN: FileCheck %s --check-prefix=GCOV < %t/copy_block_helper.m.gcov
+// GCOV: -: 0:Runs:1
+// GCOV: -: 0:Programs:1
+
+id test_helper(id (^foo)(void)) { return foo(); } // GCOV: 1: [[@LINE]]:id
+void test(id x) { // GCOV: -: [[@LINE]]:void test
+ test_helper(^{ // GCOV: 2: [[@LINE]]: test_helper
+ return x; // GCOV: 1: [[@LINE]]: return
+ }); // GCOV: -: [[@LINE]]:
+} // GCOV: 1: [[@LINE]]:}
+
+// GCOV: 1: [[@LINE+1]]:int main
+int main(int argc, const char *argv[]) { test(0); }
+
+// llvm-cov doesn't work on big endian yet
+// XFAIL: powerpc64, s390x, mips-, mips64-, sparc
diff --git a/test/tools/llvm-cov/lit.local.cfg b/test/tools/llvm-cov/lit.local.cfg
index df9b335..f738810 100644
--- a/test/tools/llvm-cov/lit.local.cfg
+++ b/test/tools/llvm-cov/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.test']
+config.suffixes = ['.test', '.m']
diff --git a/test/tools/llvm-cov/llvm-cov.test b/test/tools/llvm-cov/llvm-cov.test
index 28738a7..19d3e5d 100644
--- a/test/tools/llvm-cov/llvm-cov.test
+++ b/test/tools/llvm-cov/llvm-cov.test
@@ -1,10 +1,94 @@
-RUN: cd %p/Inputs
-# "cd" is unsupported in lit internal runner.
+# Tests for compatibility between llvm-cov and gcov. These work by
+# comparing llvm-cov against reference outputs generated by gcov 4.2.
+
+# "cd" and globbing are unsupported in lit internal runner.
REQUIRES: shell
-RUN: llvm-cov -gcno=test.gcno -gcda=test.gcda \
-RUN: | diff -aub test.cpp.gcov -
+RUN: rm -rf %t
+RUN: mkdir %t
+RUN: cd %t
+RUN: cp %p/Inputs/test* .
+
+# Basic behaviour with no flags
+RUN: llvm-cov test.c | diff -u test_no_options.output -
+RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_no_options.h.gcov test.h.gcov
+
+# Same, but specifying the object directory
+RUN: mkdir -p %t/objdir
+RUN: cp test.gcno test.gcda %t/objdir
+RUN: llvm-cov -o objdir test.c | diff -u test_no_options.output -
+RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_objdir.h.gcov test.h.gcov
+
+# Specifying an object file
+RUN: llvm-cov -o objdir/test.o test.c | diff -u test_no_options.output -
+RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_objdir.h.gcov test.h.gcov
+
+# Specifying an object file that could be ambiguous with a directory
+RUN: llvm-cov -o objdir/test test.c | diff -u test_no_options.output -
+RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_objdir.h.gcov test.h.gcov
+
+# Preserve paths. This mangles the output filenames.
+RUN: mkdir -p %t/srcdir/nested_dir
+RUN: cp test.cpp test.h %t/srcdir
+RUN: llvm-cov -p test_paths.cpp | diff -u test_preserve_paths.output -
+RUN: diff -aub test_paths.cpp.gcov srcdir#nested_dir#^#test.cpp.gcov
+RUN: diff -aub test_paths.h.gcov srcdir#nested_dir#^#test.h.gcov
+
+# Don't preserve paths. Same results as preserve paths, but no mangling.
+RUN: llvm-cov test_paths.cpp | diff -u test_no_preserve_paths.output -
+RUN: diff -aub test_paths.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_paths.h.gcov test.h.gcov
+
+# Function summaries. This changes stdout, but not the gcov files.
+RUN: llvm-cov test.c -f | diff -u test_-f.output -
+RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_no_options.h.gcov test.h.gcov
+
+# All blocks. This doesn't affect stdout, only the gcov files.
+RUN: llvm-cov test.c -a | diff -u test_no_options.output -
+RUN: diff -aub test_-a.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_-a.h.gcov test.h.gcov
+
+# Branch probabilities.
+RUN: llvm-cov test.c -a -b | diff -u test_-b.output -
+RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_-a_-b.h.gcov test.h.gcov
+
+# Function summaries including branch probabilities.
+
+# FIXME: We don't correctly handle calls when -b and -f are used
+# together, so our output differs from gcov. Remove the 'not' from
+# this test once this is fixed.
+RUN: llvm-cov test.c -a -b -f | not diff -u test_-b_-f.output - >/dev/null
+RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_-a_-b.h.gcov test.h.gcov
+
+# Summarize unconditional branches too.
+RUN: llvm-cov test.c -a -b -u | diff -u test_-b.output -
+RUN: diff -aub test_-a_-b_-u.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_-a_-b_-u.h.gcov test.h.gcov
+
+# Absolute counts for branches.
+RUN: llvm-cov test.c -a -b -c -u | diff -u test_-b.output -
+RUN: diff -aub test_-a_-b_-c_-u.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_-a_-b_-c_-u.h.gcov test.h.gcov
+
+# Missing gcda file just gives 0 counts.
+RUN: llvm-cov test.c -gcda=no_such_gcda_file | diff -u test_no_gcda.output -
+RUN: diff -aub test_no_gcda.cpp.gcov test.cpp.gcov
+RUN: diff -aub test_no_gcda.h.gcov test.h.gcov
+
+# Invalid gcno file.
+RUN: not llvm-cov test.c -gcno=test_read_fail.gcno
+
+# Bad file checksum on gcda.
+RUN: not llvm-cov test.c -gcda=test_file_checksum_fail.gcda
-RUN: not llvm-cov -gcno=test_read_fail.gcno -gcda=test.gcda
+# Bad function checksum on gcda
+RUN: not llvm-cov test.c -gcda=test_func_checksum_fail.gcda
-XFAIL: powerpc64, s390x
+XFAIL: powerpc64, s390x, mips-, mips64-, sparc
diff --git a/test/tools/llvm-objdump/Inputs/export.dll.coff-i386 b/test/tools/llvm-objdump/Inputs/export.dll.coff-i386
new file mode 100644
index 0000000..7b93716
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/export.dll.coff-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386 b/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386
new file mode 100644
index 0000000..c13e235
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/many-relocs.obj-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386 b/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
index 68c9d3d..2cda30f 100644
--- a/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
+++ b/test/tools/llvm-objdump/Inputs/nop.exe.coff-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386 b/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386
new file mode 100644
index 0000000..4c71584
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/out-of-section-sym.elf-i386
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/out-of-section-sym.s b/test/tools/llvm-objdump/Inputs/out-of-section-sym.s
new file mode 100644
index 0000000..9a1349c
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/out-of-section-sym.s
@@ -0,0 +1,15 @@
+// $ cat out-of-section-sym.ld
+// SECTIONS
+// {
+// . = 0x10;
+// .text : { _ftext = . ; *(.text) }
+// . = 0x20;
+// .data : { _fdata = . ; *(.data) }
+// }
+// as --32 out-of-section-sym.s -o out-of-section-sym.o
+// ld -m elf_i386 -Tout-of-section-sym.ld -o out-of-section-sym.elf-i386 \
+// out-of-section-sym.o
+
+.text
+_start:
+ ret
diff --git a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe
new file mode 100644
index 0000000..c701c24
--- /dev/null
+++ b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.exe
Binary files differ
diff --git a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64 b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj
index 63460e7..63460e7 100644
--- a/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64
+++ b/test/tools/llvm-objdump/Inputs/win64-unwind.exe.coff-x86_64.obj
Binary files differ
diff --git a/test/tools/llvm-objdump/coff-many-relocs.test b/test/tools/llvm-objdump/coff-many-relocs.test
new file mode 100644
index 0000000..d6d0d60
--- /dev/null
+++ b/test/tools/llvm-objdump/coff-many-relocs.test
@@ -0,0 +1,14 @@
+// Test that llvm-objdump can handle IMAGE_SCN_LNK_NRELOC_OVFL.
+// RUN: llvm-objdump -r %p/Inputs/many-relocs.obj-i386 | FileCheck %s
+
+CHECK: RELOCATION RECORDS FOR [.text]:
+CHECK-NEXT: IMAGE_REL_I386_DIR16 foo
+CHECK-NEXT: IMAGE_REL_I386_REL16 foo
+CHECK-NEXT: IMAGE_REL_I386_DIR32 foo
+CHECK-NEXT: IMAGE_REL_I386_DIR32NB foo
+CHECK-NEXT: IMAGE_REL_I386_SEG12 foo
+CHECK-NEXT: IMAGE_REL_I386_SECTION foo
+CHECK-NEXT: IMAGE_REL_I386_SECREL foo
+CHECK-NEXT: IMAGE_REL_I386_TOKEN foo
+CHECK-NEXT: IMAGE_REL_I386_SECREL7 foo
+CHECK-NEXT: IMAGE_REL_I386_REL32 foo
diff --git a/test/tools/llvm-objdump/coff-private-headers.test b/test/tools/llvm-objdump/coff-private-headers.test
index d36c148..51bf443 100644
--- a/test/tools/llvm-objdump/coff-private-headers.test
+++ b/test/tools/llvm-objdump/coff-private-headers.test
@@ -1,9 +1,67 @@
-// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | FileCheck %s
+// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | \
+// RUN: FileCheck -check-prefix=IMPORT %s
-CHECK: The Import Tables:
-CHECK-NEXT: lookup 00005028 time 00000000 fwd 00000000 name 00005096 addr 00005058
-CHECK: DLL Name: KERNEL32.dll
-CHECK-NEXT: Hint/Ord Name
-CHECK-NEXT: 365 ExitProcess
+IMPORT: The Import Tables:
+IMPORT: lookup 000021e4 time 00000000 fwd 00000000 name 0000234a addr 00002024
+IMPORT: DLL Name: MSVCR110.dll
+IMPORT-NEXT: Hint/Ord Name
+IMPORT-NEXT: 767 _initterm_e
+IMPORT-NEXT: 766 _initterm
+IMPORT-NEXT: 437 __initenv
+IMPORT-NEXT: 660 _fmode
+IMPORT-NEXT: 571 _commode
+IMPORT-NEXT: 315 ?terminate@@YAXXZ
+IMPORT-NEXT: 424 __crtSetUnhandledExceptionFilter
+IMPORT-NEXT: 892 _lock
+IMPORT-NEXT: 1254 _unlock
+IMPORT-NEXT: 498 __setusermatherr
+IMPORT-NEXT: 428 __dllonexit
+IMPORT-NEXT: 1058 _onexit
+IMPORT-NEXT: 774 _invoke_watson
+IMPORT-NEXT: 575 _controlfp_s
+IMPORT-NEXT: 624 _except_handler4_common
+IMPORT-NEXT: 587 _crt_debugger_hook
+IMPORT-NEXT: 426 __crtUnhandledException
+IMPORT-NEXT: 425 __crtTerminateProcess
+IMPORT-NEXT: 572 _configthreadlocale
+IMPORT-NEXT: 556 _cexit
+IMPORT-NEXT: 633 _exit
+IMPORT-NEXT: 1484 exit
+IMPORT-NEXT: 496 __set_app_type
+IMPORT-NEXT: 436 __getmainargs
+IMPORT-NEXT: 533 _amsg_exit
+IMPORT-NEXT: 555 _calloc_crt
+IMPORT-NEXT: 367 _XcptFilter
+// RUN: llvm-objdump -p %p/Inputs/export.dll.coff-i386 | \
+// RUN: FileCheck -check-prefix=EXPORT %s
+EXPORT: Export Table:
+EXPORT-NEXT: DLL name: export.test.tmp3.dll
+EXPORT-NEXT: Ordinal base: 5
+EXPORT-NEXT: Ordinal RVA Name
+EXPORT-NEXT: 5 0x2008
+EXPORT-NEXT: 6 0x2010 exportfn2
+
+// RUN: llvm-objdump -p %p/Inputs/nop.exe.coff-i386 | \
+// RUN: FileCheck -check-prefix=LOADCFG %s
+
+LOADCFG: Load configuration:
+LOADCFG-NEXT: Timestamp: 0
+LOADCFG-NEXT: Major Version: 0
+LOADCFG-NEXT: Minor Version: 0
+LOADCFG-NEXT: GlobalFlags Clear: 0
+LOADCFG-NEXT: GlobalFlags Set: 0
+LOADCFG-NEXT: Critical Section Default Timeout: 0
+LOADCFG-NEXT: Decommit Free Block Threshold: 0
+LOADCFG-NEXT: Decommit Total Free Threshold: 0
+LOADCFG-NEXT: Lock Prefix Table: 0
+LOADCFG-NEXT: Maximum Allocation Size: 0
+LOADCFG-NEXT: Virtual Memory Threshold: 0
+LOADCFG-NEXT: Process Affinity Mask: 0
+LOADCFG-NEXT: Process Heap Flags: 0
+LOADCFG-NEXT: CSD Version: 0
+LOADCFG-NEXT: Security Cookie: 4206616
+LOADCFG-NEXT: SEH Table: 4202768
+LOADCFG-NEXT: SEH Count: 1
+LOADCFG: SEH Table: 0x401689
diff --git a/test/tools/llvm-objdump/hex-relocation-addr.test b/test/tools/llvm-objdump/hex-relocation-addr.test
new file mode 100644
index 0000000..7e7e97b
--- /dev/null
+++ b/test/tools/llvm-objdump/hex-relocation-addr.test
@@ -0,0 +1,17 @@
+// This test checks that relocation addresses are printed in hex
+// RUN: llvm-objdump -r %p/Inputs/win64-unwind.exe.coff-x86_64.obj | FileCheck %s
+
+CHECK: RELOCATION RECORDS FOR [.pdata]:
+CHECK-NEXT: 0 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 4 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 8 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: c IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 10 IMAGE_REL_AMD64_ADDR32NB func
+CHECK-NEXT: 14 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: 18 IMAGE_REL_AMD64_ADDR32NB smallFunc
+CHECK-NEXT: 1c IMAGE_REL_AMD64_ADDR32NB smallFunc
+CHECK-NEXT: 20 IMAGE_REL_AMD64_ADDR32NB .xdata
+CHECK-NEXT: 24 IMAGE_REL_AMD64_ADDR32NB allocFunc
+CHECK-NEXT: 28 IMAGE_REL_AMD64_ADDR32NB allocFunc
+CHECK-NEXT: 2c IMAGE_REL_AMD64_ADDR32NB .xdata
+
diff --git a/test/tools/llvm-objdump/out-of-section-sym.test b/test/tools/llvm-objdump/out-of-section-sym.test
new file mode 100644
index 0000000..f70dce6
--- /dev/null
+++ b/test/tools/llvm-objdump/out-of-section-sym.test
@@ -0,0 +1,13 @@
+// Check that llvm-objdump does not attempt to disassemble symbols outside
+// of section boundaries.
+// RUN: llvm-objdump -d -t %p/Inputs/out-of-section-sym.elf-i386 | FileCheck %s
+
+CHECK: Disassembly of section .text:
+CHECK-NEXT: _start:
+CHECK-NEXT: 10: c3 retl
+CHECK-NEXT: SYMBOL TABLE:
+CHECK-NEXT: 00000000 *UND* 00000000
+CHECK-NEXT: 00000010 l d .text 00000000 .text
+CHECK-NEXT: 00000010 .text 00000000 _start
+CHECK-NEXT: 00000020 .text 00000000 _fdata
+CHECK-NEXT: 00000010 .text 00000000 _ftext
diff --git a/test/tools/llvm-objdump/win64-unwind-data.test b/test/tools/llvm-objdump/win64-unwind-data.test
index a723ffe..d39d08f 100644
--- a/test/tools/llvm-objdump/win64-unwind-data.test
+++ b/test/tools/llvm-objdump/win64-unwind-data.test
@@ -1,52 +1,107 @@
// This test checks that the unwind data is dumped by llvm-objdump.
-// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64 | FileCheck %s
+// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64.obj \
+// RUN: | FileCheck -check-prefix=OBJ %s
+// RUN: llvm-objdump -u %p/Inputs/win64-unwind.exe.coff-x86_64.exe \
+// RUN: | FileCheck -check-prefix=EXE %s
-CHECK: Unwind info:
-CHECK: Function Table:
-CHECK-NEXT: Start Address: func
-CHECK-NEXT: End Address: func + 0x001b
-CHECK-NEXT: Unwind Info Address: .xdata
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 1 UNW_ExceptionHandler
-CHECK-NEXT: Size of prolog: 18
-CHECK-NEXT: Number of Codes: 8
-CHECK-NEXT: Frame register: RBX
-CHECK-NEXT: Frame offset: 0
-CHECK-NEXT: Unwind Codes:
-CHECK-NEXT: 0x12: UOP_SetFPReg
-CHECK-NEXT: 0x0f: UOP_PushNonVol RBX
-CHECK-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
-CHECK-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
-CHECK-NEXT: 0x04: UOP_AllocSmall 24
-CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
-CHECK: Function Table:
-CHECK-NEXT: Start Address: func + 0x0012
-CHECK-NEXT: End Address: func + 0x0012
-CHECK-NEXT: Unwind Info Address: .xdata + 0x001c
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 4 UNW_ChainInfo
-CHECK-NEXT: Size of prolog: 0
-CHECK-NEXT: Number of Codes: 0
-CHECK-NEXT: No frame pointer used
-CHECK: Function Table:
-CHECK-NEXT: Start Address: smallFunc
-CHECK-NEXT: End Address: smallFunc + 0x0001
-CHECK-NEXT: Unwind Info Address: .xdata + 0x002c
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 0
-CHECK-NEXT: Size of prolog: 0
-CHECK-NEXT: Number of Codes: 0
-CHECK-NEXT: No frame pointer used
-CHECK: Function Table:
-CHECK-NEXT: Start Address: allocFunc
-CHECK-NEXT: End Address: allocFunc + 0x001d
-CHECK-NEXT: Unwind Info Address: .xdata + 0x0034
-CHECK-NEXT: Version: 1
-CHECK-NEXT: Flags: 0
-CHECK-NEXT: Size of prolog: 14
-CHECK-NEXT: Number of Codes: 6
-CHECK-NEXT: No frame pointer used
-CHECK-NEXT: Unwind Codes:
-CHECK-NEXT: 0x0e: UOP_AllocLarge 8454128
-CHECK-NEXT: 0x07: UOP_AllocLarge 8190
-CHECK-NEXT: 0x00: UOP_PushMachFrame w/o error code
+OBJ: Unwind info:
+OBJ: Function Table:
+OBJ-NEXT: Start Address: func
+OBJ-NEXT: End Address: func + 0x001b
+OBJ-NEXT: Unwind Info Address: .xdata
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 1 UNW_ExceptionHandler
+OBJ-NEXT: Size of prolog: 18
+OBJ-NEXT: Number of Codes: 8
+OBJ-NEXT: Frame register: RBX
+OBJ-NEXT: Frame offset: 0
+OBJ-NEXT: Unwind Codes:
+OBJ-NEXT: 0x12: UOP_SetFPReg
+OBJ-NEXT: 0x0f: UOP_PushNonVol RBX
+OBJ-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+OBJ-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
+OBJ-NEXT: 0x04: UOP_AllocSmall 24
+OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
+OBJ: Function Table:
+OBJ-NEXT: Start Address: func + 0x0012
+OBJ-NEXT: End Address: func + 0x0012
+OBJ-NEXT: Unwind Info Address: .xdata + 0x001c
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 4 UNW_ChainInfo
+OBJ-NEXT: Size of prolog: 0
+OBJ-NEXT: Number of Codes: 0
+OBJ-NEXT: No frame pointer used
+OBJ: Function Table:
+OBJ-NEXT: Start Address: smallFunc
+OBJ-NEXT: End Address: smallFunc + 0x0001
+OBJ-NEXT: Unwind Info Address: .xdata + 0x002c
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 0
+OBJ-NEXT: Size of prolog: 0
+OBJ-NEXT: Number of Codes: 0
+OBJ-NEXT: No frame pointer used
+OBJ: Function Table:
+OBJ-NEXT: Start Address: allocFunc
+OBJ-NEXT: End Address: allocFunc + 0x001d
+OBJ-NEXT: Unwind Info Address: .xdata + 0x0034
+OBJ-NEXT: Version: 1
+OBJ-NEXT: Flags: 0
+OBJ-NEXT: Size of prolog: 14
+OBJ-NEXT: Number of Codes: 6
+OBJ-NEXT: No frame pointer used
+OBJ-NEXT: Unwind Codes:
+OBJ-NEXT: 0x0e: UOP_AllocLarge 8454128
+OBJ-NEXT: 0x07: UOP_AllocLarge 8190
+OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x1000
+EXE-NEXT: End Address: 0x101b
+EXE-NEXT: Unwind Info Address: 0x2000
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 1 UNW_ExceptionHandler
+EXE-NEXT: Size of prolog: 18
+EXE-NEXT: Number of Codes: 8
+EXE-NEXT: Frame register: RBX
+EXE-NEXT: Frame offset: 0
+EXE-NEXT: Unwind Codes:
+EXE-NEXT: 0x12: UOP_SetFPReg
+EXE-NEXT: 0x0f: UOP_PushNonVol RBX
+EXE-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+EXE-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
+EXE-NEXT: 0x04: UOP_AllocSmall 24
+EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x1012
+EXE-NEXT: End Address: 0x1012
+EXE-NEXT: Unwind Info Address: 0x201c
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 4 UNW_ChainInfo
+EXE-NEXT: Size of prolog: 0
+EXE-NEXT: Number of Codes: 0
+EXE-NEXT: No frame pointer used
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x101b
+EXE-NEXT: End Address: 0x101c
+EXE-NEXT: Unwind Info Address: 0x202c
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 0
+EXE-NEXT: Size of prolog: 0
+EXE-NEXT: Number of Codes: 0
+EXE-NEXT: No frame pointer used
+
+EXE: Function Table:
+EXE-NEXT: Start Address: 0x101c
+EXE-NEXT: End Address: 0x1039
+EXE-NEXT: Unwind Info Address: 0x2034
+EXE-NEXT: Version: 1
+EXE-NEXT: Flags: 0
+EXE-NEXT: Size of prolog: 14
+EXE-NEXT: Number of Codes: 6
+EXE-NEXT: No frame pointer used
+EXE-NEXT: Unwind Codes:
+EXE-NEXT: 0x0e: UOP_AllocLarge 8454128
+EXE-NEXT: 0x07: UOP_AllocLarge 8190
+EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code
diff --git a/test/tools/llvm-profdata/Inputs/bad-hash.profdata b/test/tools/llvm-profdata/Inputs/bad-hash.profdata
new file mode 100644
index 0000000..faa6f40
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/bad-hash.profdata
@@ -0,0 +1,4 @@
+function_count_not
+badhash
+1
+1
diff --git a/test/tools/llvm-profdata/Inputs/bar3-1.profdata b/test/tools/llvm-profdata/Inputs/bar3-1.profdata
new file mode 100644
index 0000000..5486e9d
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/bar3-1.profdata
@@ -0,0 +1,6 @@
+bar
+3
+3
+1
+2
+3
diff --git a/test/tools/llvm-profdata/Inputs/c-general.profdata b/test/tools/llvm-profdata/Inputs/c-general.profdata
new file mode 100644
index 0000000..e8cef21
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/c-general.profdata
Binary files differ
diff --git a/test/tools/llvm-profdata/Inputs/empty.profdata b/test/tools/llvm-profdata/Inputs/empty.profdata
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/empty.profdata
diff --git a/test/tools/llvm-profdata/Inputs/extra-word.profdata b/test/tools/llvm-profdata/Inputs/extra-word.profdata
new file mode 100644
index 0000000..67a6629
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/extra-word.profdata
@@ -0,0 +1,2 @@
+extra 1 word
+1
diff --git a/test/tools/llvm-profdata/Inputs/foo3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3-1.profdata
new file mode 100644
index 0000000..14a6200
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3-1.profdata
@@ -0,0 +1,6 @@
+foo
+3
+3
+1
+2
+3
diff --git a/test/tools/llvm-profdata/Inputs/foo3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3-2.profdata
new file mode 100644
index 0000000..801846e
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3-2.profdata
@@ -0,0 +1,6 @@
+foo
+3
+3
+7
+5
+3
diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata
new file mode 100644
index 0000000..12157b9
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata
@@ -0,0 +1,13 @@
+foo
+3
+3
+2
+3
+5
+
+bar
+3
+3
+7
+11
+13
diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata
new file mode 100644
index 0000000..f1f10bd
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata
@@ -0,0 +1,13 @@
+foo
+3
+3
+17
+19
+23
+
+bar
+3
+3
+29
+31
+37
diff --git a/test/tools/llvm-profdata/Inputs/foo4-1.profdata b/test/tools/llvm-profdata/Inputs/foo4-1.profdata
new file mode 100644
index 0000000..31d2a2c
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo4-1.profdata
@@ -0,0 +1,7 @@
+foo
+4
+4
+11
+22
+33
+44
diff --git a/test/tools/llvm-profdata/Inputs/foo4-2.profdata b/test/tools/llvm-profdata/Inputs/foo4-2.profdata
new file mode 100644
index 0000000..01d8309
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo4-2.profdata
@@ -0,0 +1,7 @@
+foo
+4
+4
+7
+6
+5
+4
diff --git a/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata b/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata
new file mode 100644
index 0000000..2b61c55
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata
@@ -0,0 +1,4 @@
+invalid_count
+1
+1
+1later
diff --git a/test/tools/llvm-profdata/Inputs/overflow.profdata b/test/tools/llvm-profdata/Inputs/overflow.profdata
new file mode 100644
index 0000000..c9a9d69
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/overflow.profdata
@@ -0,0 +1,4 @@
+overflow
+1
+1
+9223372036854775808
diff --git a/test/tools/llvm-profdata/c-general.test b/test/tools/llvm-profdata/c-general.test
new file mode 100644
index 0000000..9b6cd7f
--- /dev/null
+++ b/test/tools/llvm-profdata/c-general.test
@@ -0,0 +1,24 @@
+REGENERATE: You need a checkout of clang with compiler-rt to generate the
+REGENERATE: binary file here. These shell commands can be used to regenerate
+REGENERATE: it.
+REGENERATE:
+REGENERATE: $ SRC=path/to/llvm
+REGENERATE: $ CFE=$SRC/tools/clang
+REGENERATE: $ TESTDIR=$SRC/test/tools/llvm-profdata
+REGENERATE: $ CFE_TESTDIR=$CFE/test/Profile
+REGENERATE: $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/test/Profile/c-general.c
+REGENERATE: $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profdata ./a.out
+
+RUN: llvm-profdata show %p/Inputs/c-general.profdata -o - | FileCheck %s -check-prefix=CHECK
+RUN: llvm-profdata show %p/Inputs/c-general.profdata -o - --function=switches | FileCheck %s -check-prefix=SWITCHES -check-prefix=CHECK
+
+SWITCHES-LABEL: Counters:
+SWITCHES-NEXT: switches:
+SWITCHES-NEXT: Hash: 0x0000000000000013
+SWITCHES-NEXT: Counters: 19
+SWITCHES-NEXT: Function count: 1
+SWITCHES-LABEL: Functions shown: 1
+
+CHECK-LABEL: Total functions: 11
+CHECK-NEXT: Maximum function count: 1
+CHECK-NEXT: Maximum internal block count: 100
diff --git a/test/tools/llvm-profdata/errors.test b/test/tools/llvm-profdata/errors.test
new file mode 100644
index 0000000..6ccb084
--- /dev/null
+++ b/test/tools/llvm-profdata/errors.test
@@ -0,0 +1,13 @@
+RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata -o /dev/null 2>&1 | FileCheck %s --check-prefix=HASH
+HASH: foo4-1.profdata: foo: Function hash mismatch
+
+RUN: llvm-profdata merge %p/Inputs/overflow.profdata %p/Inputs/overflow.profdata -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW
+OVERFLOW: overflow.profdata: overflow: Counter overflow
+
+RUN: not llvm-profdata show %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
+RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.profdata %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
+INVALID-COUNT-LATER: error: {{.*}}invalid-count-later.profdata: Malformed profile data
+
+RUN: not llvm-profdata show %p/Inputs/bad-hash.profdata 2>&1 | FileCheck %s --check-prefix=BAD-HASH
+RUN: not llvm-profdata merge %p/Inputs/bad-hash.profdata %p/Inputs/bad-hash.profdata 2>&1 | FileCheck %s --check-prefix=BAD-HASH
+BAD-HASH: error: {{.*}}bad-hash.profdata: Malformed profile data
diff --git a/test/tools/llvm-profdata/raw-32-bits-be.test b/test/tools/llvm-profdata/raw-32-bits-be.test
new file mode 100644
index 0000000..86ac56d
--- /dev/null
+++ b/test/tools/llvm-profdata/raw-32-bits-be.test
@@ -0,0 +1,42 @@
+RUN: printf '\377lprofR\201' > %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\3' >> %t
+RUN: printf '\0\0\0\0\0\0\0\6' >> %t
+RUN: printf '\0\0\0\0\1\0\0\0' >> %t
+RUN: printf '\0\0\0\0\2\0\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\2\0\0\0' >> %t
+RUN: printf '\1\0\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\2' >> %t
+RUN: printf '\2\0\0\03' >> %t
+RUN: printf '\1\0\0\10' >> %t
+
+RUN: printf '\0\0\0\0\0\0\0\023' >> %t
+RUN: printf '\0\0\0\0\0\0\0\067' >> %t
+RUN: printf '\0\0\0\0\0\0\0\101' >> %t
+RUN: printf 'foobar' >> %t
+
+RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
+
+CHECK: Counters:
+CHECK: foo:
+CHECK: Hash: 0x0000000000000001
+CHECK: Counters: 1
+CHECK: Function count: 19
+CHECK: Block counts: []
+CHECK: bar:
+CHECK: Hash: 0x0000000000000002
+CHECK: Counters: 2
+CHECK: Function count: 55
+CHECK: Block counts: [65]
+CHECK: Functions shown: 2
+CHECK: Total functions: 2
+CHECK: Maximum function count: 55
+CHECK: Maximum internal block count: 65
diff --git a/test/tools/llvm-profdata/raw-32-bits-le.test b/test/tools/llvm-profdata/raw-32-bits-le.test
new file mode 100644
index 0000000..9325e7e
--- /dev/null
+++ b/test/tools/llvm-profdata/raw-32-bits-le.test
@@ -0,0 +1,42 @@
+RUN: printf '\201Rforpl\377' > %t
+RUN: printf '\1\0\0\0\0\0\0\0' >> %t
+RUN: printf '\2\0\0\0\0\0\0\0' >> %t
+RUN: printf '\3\0\0\0\0\0\0\0' >> %t
+RUN: printf '\6\0\0\0\0\0\0\0' >> %t
+RUN: printf '\0\0\0\1\0\0\0\0' >> %t
+RUN: printf '\0\0\0\2\0\0\0\0' >> %t
+
+RUN: printf '\3\0\0\0' >> %t
+RUN: printf '\1\0\0\0' >> %t
+RUN: printf '\1\0\0\0\0\0\0\0' >> %t
+RUN: printf '\0\0\0\2' >> %t
+RUN: printf '\0\0\0\1' >> %t
+
+RUN: printf '\3\0\0\0' >> %t
+RUN: printf '\2\0\0\0' >> %t
+RUN: printf '\02\0\0\0\0\0\0\0' >> %t
+RUN: printf '\03\0\0\2' >> %t
+RUN: printf '\10\0\0\1' >> %t
+
+RUN: printf '\023\0\0\0\0\0\0\0' >> %t
+RUN: printf '\067\0\0\0\0\0\0\0' >> %t
+RUN: printf '\101\0\0\0\0\0\0\0' >> %t
+RUN: printf 'foobar' >> %t
+
+RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
+
+CHECK: Counters:
+CHECK: foo:
+CHECK: Hash: 0x0000000000000001
+CHECK: Counters: 1
+CHECK: Function count: 19
+CHECK: Block counts: []
+CHECK: bar:
+CHECK: Hash: 0x0000000000000002
+CHECK: Counters: 2
+CHECK: Function count: 55
+CHECK: Block counts: [65]
+CHECK: Functions shown: 2
+CHECK: Total functions: 2
+CHECK: Maximum function count: 55
+CHECK: Maximum internal block count: 65
diff --git a/test/tools/llvm-profdata/raw-64-bits-be.test b/test/tools/llvm-profdata/raw-64-bits-be.test
new file mode 100644
index 0000000..b97d8b5
--- /dev/null
+++ b/test/tools/llvm-profdata/raw-64-bits-be.test
@@ -0,0 +1,42 @@
+RUN: printf '\377lprofr\201' > %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\3' >> %t
+RUN: printf '\0\0\0\0\0\0\0\6' >> %t
+RUN: printf '\0\0\0\1\0\4\0\0' >> %t
+RUN: printf '\0\0\0\2\0\4\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\0\0\0\2\0\4\0\0' >> %t
+RUN: printf '\0\0\0\1\0\4\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\02' >> %t
+RUN: printf '\0\0\0\2\0\4\0\03' >> %t
+RUN: printf '\0\0\0\1\0\4\0\10' >> %t
+
+RUN: printf '\0\0\0\0\0\0\0\023' >> %t
+RUN: printf '\0\0\0\0\0\0\0\067' >> %t
+RUN: printf '\0\0\0\0\0\0\0\101' >> %t
+RUN: printf 'foobar' >> %t
+
+RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
+
+CHECK: Counters:
+CHECK: foo:
+CHECK: Hash: 0x0000000000000001
+CHECK: Counters: 1
+CHECK: Function count: 19
+CHECK: Block counts: []
+CHECK: bar:
+CHECK: Hash: 0x0000000000000002
+CHECK: Counters: 2
+CHECK: Function count: 55
+CHECK: Block counts: [65]
+CHECK: Functions shown: 2
+CHECK: Total functions: 2
+CHECK: Maximum function count: 55
+CHECK: Maximum internal block count: 65
diff --git a/test/tools/llvm-profdata/raw-64-bits-le.test b/test/tools/llvm-profdata/raw-64-bits-le.test
new file mode 100644
index 0000000..0e68538
--- /dev/null
+++ b/test/tools/llvm-profdata/raw-64-bits-le.test
@@ -0,0 +1,42 @@
+RUN: printf '\201rforpl\377' > %t
+RUN: printf '\1\0\0\0\0\0\0\0' >> %t
+RUN: printf '\2\0\0\0\0\0\0\0' >> %t
+RUN: printf '\3\0\0\0\0\0\0\0' >> %t
+RUN: printf '\6\0\0\0\0\0\0\0' >> %t
+RUN: printf '\0\0\4\0\1\0\0\0' >> %t
+RUN: printf '\0\0\4\0\2\0\0\0' >> %t
+
+RUN: printf '\3\0\0\0' >> %t
+RUN: printf '\1\0\0\0' >> %t
+RUN: printf '\1\0\0\0\0\0\0\0' >> %t
+RUN: printf '\0\0\4\0\2\0\0\0' >> %t
+RUN: printf '\0\0\4\0\1\0\0\0' >> %t
+
+RUN: printf '\03\0\0\0' >> %t
+RUN: printf '\02\0\0\0' >> %t
+RUN: printf '\02\0\0\0\0\0\0\0' >> %t
+RUN: printf '\03\0\4\0\2\0\0\0' >> %t
+RUN: printf '\10\0\4\0\1\0\0\0' >> %t
+
+RUN: printf '\023\0\0\0\0\0\0\0' >> %t
+RUN: printf '\067\0\0\0\0\0\0\0' >> %t
+RUN: printf '\101\0\0\0\0\0\0\0' >> %t
+RUN: printf 'foobar' >> %t
+
+RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
+
+CHECK: Counters:
+CHECK: foo:
+CHECK: Hash: 0x0000000000000001
+CHECK: Counters: 1
+CHECK: Function count: 19
+CHECK: Block counts: []
+CHECK: bar:
+CHECK: Hash: 0x0000000000000002
+CHECK: Counters: 2
+CHECK: Function count: 55
+CHECK: Block counts: [65]
+CHECK: Functions shown: 2
+CHECK: Total functions: 2
+CHECK: Maximum function count: 55
+CHECK: Maximum internal block count: 65
diff --git a/test/tools/llvm-profdata/raw-magic-but-no-header.test b/test/tools/llvm-profdata/raw-magic-but-no-header.test
new file mode 100644
index 0000000..6db723c
--- /dev/null
+++ b/test/tools/llvm-profdata/raw-magic-but-no-header.test
@@ -0,0 +1,6 @@
+RUN: printf '\201rforpl\377' > %t
+RUN: not llvm-profdata show %t 2>&1 | FileCheck %s
+RUN: printf '\377lprofr\201' > %t
+RUN: not llvm-profdata show %t 2>&1 | FileCheck %s
+
+CHECK: error: {{.+}}: Invalid header
diff --git a/test/tools/llvm-profdata/simple.test b/test/tools/llvm-profdata/simple.test
new file mode 100644
index 0000000..97dda5a
--- /dev/null
+++ b/test/tools/llvm-profdata/simple.test
@@ -0,0 +1,68 @@
+RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3
+RUN: llvm-profdata merge %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3
+FOO3: foo:
+FOO3: Counters: 3
+FOO3: Function count: 8
+FOO3: Block counts: [7, 6]
+FOO3: Total functions: 1
+FOO3: Maximum function count: 8
+FOO3: Maximum internal block count: 7
+
+RUN: llvm-profdata merge %p/Inputs/foo4-1.profdata %p/Inputs/foo4-2.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO4
+RUN: llvm-profdata merge %p/Inputs/foo4-2.profdata %p/Inputs/foo4-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO4
+FOO4: foo:
+FOO4: Counters: 4
+FOO4: Function count: 18
+FOO4: Block counts: [28, 38, 48]
+FOO4: Total functions: 1
+FOO4: Maximum function count: 18
+FOO4: Maximum internal block count: 48
+
+RUN: llvm-profdata merge %p/Inputs/foo3bar3-1.profdata %p/Inputs/foo3bar3-2.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3
+RUN: llvm-profdata merge %p/Inputs/foo3bar3-2.profdata %p/Inputs/foo3bar3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3
+FOO3BAR3: foo:
+FOO3BAR3: Counters: 3
+FOO3BAR3: Function count: 19
+FOO3BAR3: Block counts: [22, 28]
+FOO3BAR3: bar:
+FOO3BAR3: Counters: 3
+FOO3BAR3: Function count: 36
+FOO3BAR3: Block counts: [42, 50]
+FOO3BAR3: Total functions: 2
+FOO3BAR3: Maximum function count: 36
+FOO3BAR3: Maximum internal block count: 50
+
+RUN: llvm-profdata merge %p/Inputs/empty.profdata %p/Inputs/foo3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY
+FOO3EMPTY: foo:
+FOO3EMPTY: Counters: 3
+FOO3EMPTY: Function count: 1
+FOO3EMPTY: Block counts: [2, 3]
+FOO3EMPTY: Total functions: 1
+FOO3EMPTY: Maximum function count: 1
+FOO3EMPTY: Maximum internal block count: 3
+
+RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3bar3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3
+FOO3FOO3BAR3: foo:
+FOO3FOO3BAR3: Counters: 3
+FOO3FOO3BAR3: Function count: 3
+FOO3FOO3BAR3: Block counts: [5, 8]
+FOO3FOO3BAR3: bar:
+FOO3FOO3BAR3: Counters: 3
+FOO3FOO3BAR3: Function count: 7
+FOO3FOO3BAR3: Block counts: [11, 13]
+FOO3FOO3BAR3: Total functions: 2
+FOO3FOO3BAR3: Maximum function count: 7
+FOO3FOO3BAR3: Maximum internal block count: 13
+
+RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/bar3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=DISJOINT
+DISJOINT: foo:
+DISJOINT: Counters: 3
+DISJOINT: Function count: 1
+DISJOINT: Block counts: [2, 3]
+DISJOINT: bar:
+DISJOINT: Counters: 3
+DISJOINT: Function count: 1
+DISJOINT: Block counts: [2, 3]
+DISJOINT: Total functions: 2
+DISJOINT: Maximum function count: 1
+DISJOINT: Maximum internal block count: 3
diff --git a/test/tools/llvm-readobj/ARM/attributes.s b/test/tools/llvm-readobj/ARM/attributes.s
new file mode 100644
index 0000000..594bab8
--- /dev/null
+++ b/test/tools/llvm-readobj/ARM/attributes.s
@@ -0,0 +1,287 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s \
+@ RUN: | llvm-readobj -arm-attributes - | FileCheck %s
+
+ .syntax unified
+
+ .cpu cortex-a8
+ .fpu neon
+
+ .eabi_attribute Tag_CPU_raw_name, "Cortex-A9"
+ .eabi_attribute Tag_CPU_name, "cortex-a9"
+ .eabi_attribute Tag_CPU_arch, 10
+ .eabi_attribute Tag_CPU_arch_profile, 'A'
+ .eabi_attribute Tag_ARM_ISA_use, 0
+ .eabi_attribute Tag_THUMB_ISA_use, 2
+ .eabi_attribute Tag_FP_arch, 3
+ .eabi_attribute Tag_WMMX_arch, 0
+ .eabi_attribute Tag_Advanced_SIMD_arch, 1
+ .eabi_attribute Tag_PCS_config, 2
+ .eabi_attribute Tag_ABI_PCS_R9_use, 0
+ .eabi_attribute Tag_ABI_PCS_RW_data, 0
+ .eabi_attribute Tag_ABI_PCS_RO_data, 0
+ .eabi_attribute Tag_ABI_PCS_GOT_use, 0
+ .eabi_attribute Tag_ABI_PCS_wchar_t, 4
+ .eabi_attribute Tag_ABI_FP_rounding, 1
+ .eabi_attribute Tag_ABI_FP_denormal, 2
+ .eabi_attribute Tag_ABI_FP_exceptions, 1
+ .eabi_attribute Tag_ABI_FP_user_exceptions, 1
+ .eabi_attribute Tag_ABI_FP_number_model, 3
+ .eabi_attribute Tag_ABI_align_needed, 1
+ .eabi_attribute Tag_ABI_align_preserved, 2
+ .eabi_attribute Tag_ABI_enum_size, 3
+ .eabi_attribute Tag_ABI_HardFP_use, 0
+ .eabi_attribute Tag_ABI_VFP_args, 1
+ .eabi_attribute Tag_ABI_WMMX_args, 0
+ .eabi_attribute Tag_ABI_optimization_goals, 2
+ .eabi_attribute Tag_ABI_FP_optimization_goals, 2
+ .eabi_attribute Tag_compatibility, 1
+ .eabi_attribute Tag_compatibility, 1, "aeabi"
+ .eabi_attribute Tag_CPU_unaligned_access, 0
+ .eabi_attribute Tag_FP_HP_extension, 0
+ .eabi_attribute Tag_ABI_FP_16bit_format, 0
+ .eabi_attribute Tag_MPextension_use, 0
+ .eabi_attribute Tag_DIV_use, 0
+ .eabi_attribute Tag_nodefaults, 0
+ .eabi_attribute Tag_also_compatible_with, "gnu"
+ .eabi_attribute Tag_T2EE_use, 0
+ .eabi_attribute Tag_conformance, "2.09"
+ .eabi_attribute Tag_Virtualization_use, 0
+
+@ CHECK: BuildAttributes {
+@ CHECK: Section 1 {
+@ CHECK: Tag: Tag_File (0x1)
+@ CHECK: FileAttributes {
+@ CHECK: Attribute {
+@ CHECK: Tag: 4
+@ CHECK: TagName: CPU_raw_name
+@ CHECK: Value: CORTEX-A9
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 5
+@ CHECK: TagName: CPU_name
+@ CHECK: Value: CORTEX-A9
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 6
+@ CHECK: Value: 10
+@ CHECK: TagName: CPU_arch
+@ CHECK: Description: ARM v7
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 7
+@ CHECK: Value: 65
+@ CHECK: TagName: CPU_arch_profile
+@ CHECK: Description: Application
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 8
+@ CHECK: Value: 0
+@ CHECK: TagName: ARM_ISA_use
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 9
+@ CHECK: Value: 2
+@ CHECK: TagName: THUMB_ISA_use
+@ CHECK: Description: Thumb-2
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 10
+@ CHECK: Value: 3
+@ CHECK: TagName: FP_arch
+@ CHECK: Description: VFPv3
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 11
+@ CHECK: Value: 0
+@ CHECK: TagName: WMMX_arch
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 12
+@ CHECK: Value: 1
+@ CHECK: TagName: Advanced_SIMD_arch
+@ CHECK: Description: NEONv1
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 13
+@ CHECK: Value: 2
+@ CHECK: TagName: PCS_config
+@ CHECK: Description: Linux Application
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 14
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_PCS_R9_use
+@ CHECK: Description: v6
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 15
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_PCS_RW_data
+@ CHECK: Description: Absolute
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 16
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_PCS_RO_data
+@ CHECK: Description: Absolute
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 17
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_PCS_GOT_use
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 18
+@ CHECK: Value: 4
+@ CHECK: TagName: ABI_PCS_wchar_t
+@ CHECK: Description: 4-byte
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 19
+@ CHECK: Value: 1
+@ CHECK: TagName: ABI_FP_rounding
+@ CHECK: Description: Runtime
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 20
+@ CHECK: Value: 2
+@ CHECK: TagName: ABI_FP_denormal
+@ CHECK: Description: Sign Only
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 21
+@ CHECK: Value: 1
+@ CHECK: TagName: ABI_FP_exceptions
+@ CHECK: Description: IEEE-754
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 22
+@ CHECK: Value: 1
+@ CHECK: TagName: ABI_FP_user_exceptions
+@ CHECK: Description: IEEE-754
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 23
+@ CHECK: Value: 3
+@ CHECK: TagName: ABI_FP_number_model
+@ CHECK: Description: IEEE-754
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 24
+@ CHECK: Value: 1
+@ CHECK: TagName: ABI_align_needed
+@ CHECK: Description: 8-byte alignment
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 25
+@ CHECK: Value: 2
+@ CHECK: TagName: ABI_align_preserved
+@ CHECK: Description: 8-byte data and code alignment
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 26
+@ CHECK: Value: 3
+@ CHECK: TagName: ABI_enum_size
+@ CHECK: Description: External Int32
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 27
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_HardFP_use
+@ CHECK: Description: Tag_FP_arch
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 28
+@ CHECK: Value: 1
+@ CHECK: TagName: ABI_VFP_args
+@ CHECK: Description: AAPCS VFP
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 29
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_WMMX_args
+@ CHECK: Description: AAPCS
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 30
+@ CHECK: Value: 2
+@ CHECK: TagName: ABI_optimization_goals
+@ CHECK: Description: Aggressive Speed
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 31
+@ CHECK: Value: 2
+@ CHECK: TagName: ABI_FP_optimization_goals
+@ CHECK: Description: Aggressive Speed
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 32
+@ CHECK: Value: 1, AEABI
+@ CHECK: TagName: compatibility
+@ CHECK: Description: AEABI Conformant
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 34
+@ CHECK: Value: 0
+@ CHECK: TagName: CPU_unaligned_access
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 36
+@ CHECK: Value: 0
+@ CHECK: TagName: FP_HP_extension
+@ CHECK: Description: If Available
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 38
+@ CHECK: Value: 0
+@ CHECK: TagName: ABI_FP_16bit_format
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 42
+@ CHECK: Value: 0
+@ CHECK: TagName: MPextension_use
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 44
+@ CHECK: Value: 0
+@ CHECK: TagName: DIV_use
+@ CHECK: Description: If Available
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 64
+@ CHECK: Value: 0
+@ CHECK: TagName: nodefaults
+@ CHECK: Description: Unspecified Tags UNDEFINED
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 65
+@ CHECK: TagName: also_compatible_with
+@ CHECK: Value: GNU
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 66
+@ CHECK: Value: 0
+@ CHECK: TagName: T2EE_use
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 67
+@ CHECK: TagName: conformance
+@ CHECK: Value: 2.09
+@ CHECK: }
+@ CHECK: Attribute {
+@ CHECK: Tag: 68
+@ CHECK: Value: 0
+@ CHECK: TagName: Virtualization_use
+@ CHECK: Description: Not Permitted
+@ CHECK: }
+@ CHECK: }
+@ CHECK: }
+@ CHECK: }
+
diff --git a/test/tools/llvm-readobj/ARM/lit.local.cfg b/test/tools/llvm-readobj/ARM/lit.local.cfg
new file mode 100644
index 0000000..8a3ba96
--- /dev/null
+++ b/test/tools/llvm-readobj/ARM/lit.local.cfg
@@ -0,0 +1,4 @@
+targets = set(config.root.targets_to_build.split())
+if not 'ARM' in targets:
+ config.unsupported = True
+
diff --git a/test/tools/llvm-readobj/ARM/unwind.s b/test/tools/llvm-readobj/ARM/unwind.s
new file mode 100644
index 0000000..afabeb7
--- /dev/null
+++ b/test/tools/llvm-readobj/ARM/unwind.s
@@ -0,0 +1,326 @@
+@ RUN: llvm-mc -triple armv7-linux-eabi -filetype obj -o - %s \
+@ RUN: | llvm-readobj -u | FileCheck %s
+
+ .syntax unified
+
+ .cpu cortex-a8
+ .fpu neon
+
+ .section .personality
+
+ .type __personality,%function
+__personality:
+ .fnstart
+ bkpt
+ .fnend
+
+
+ .section .personality0
+
+ .type personality0,%function
+personality0:
+ .fnstart
+ bx lr
+ .fnend
+
+
+ .section .personality1
+
+ .type personality1,%function
+personality1:
+ .fnstart
+ .pad #0x100
+ sub sp, sp, #0x100
+ .save {r0-r11}
+ push {r0-r11}
+ pop {r0-r11}
+ add sp, sp, #0x100
+ bx lr
+ .fnend
+
+
+ .section .custom_personality
+
+ .type custom_personality,%function
+custom_personality:
+ .fnstart
+ .personality __personality
+ bx lr
+ .fnend
+
+
+ .section .opcodes
+
+ .type opcodes,%function
+opcodes:
+ .fnstart
+ .vsave {d8-d12}
+ vpush {d8-d12}
+ vpop {d8-d12}
+ bx lr
+ .fnend
+
+
+ .section .multiple
+
+ .type function0,%function
+function0:
+ .fnstart
+ bx lr
+ .fnend
+
+ .type function1,%function
+function1:
+ .fnstart
+ .personality __personality
+ bx lr
+ .fnend
+
+ .type function2,%function
+function2:
+ .fnstart
+ bx lr
+ .fnend
+
+ .section .raw
+
+ .type raw,%function
+ .thumb_func
+raw:
+ .fnstart
+ .unwind_raw 12, 0x02
+ .unwind_raw -12, 0x42
+ .unwind_raw 0, 0x80, 0x00
+ .unwind_raw 4, 0x81, 0x00
+ .unwind_raw 4, 0x80, 0x01
+ .unwind_raw 8, 0x80, 0xc0
+ .unwind_raw 12, 0x84, 0xc0
+ .unwind_raw 0, 0x91
+ .unwind_raw 8, 0xa1
+ .unwind_raw 12, 0xa9
+ .unwind_raw 0, 0xb0
+ .unwind_raw 4, 0xb1, 0x01
+ .unwind_raw 0xa04, 0xb2, 0x80, 0x04
+ .unwind_raw 24, 0xb3, 0x12
+ .unwind_raw 24, 0xba
+ .unwind_raw 24, 0xc2
+ .unwind_raw 24, 0xc6, 0x02
+ .unwind_raw 8, 0xc7, 0x03
+ .unwind_raw 24, 0xc8, 0x02
+ .unwind_raw 24, 0xc9, 0x02
+ .unwind_raw 64, 0xd7
+ .fnend
+
+ .section .spare
+
+ .type spare,%function
+spare:
+ .fnstart
+ .unwind_raw 4, 0x00
+ .unwind_raw -4, 0x40
+ .unwind_raw 0, 0x80, 0x00
+ .unwind_raw 4, 0x88, 0x00
+ .unwind_raw 0, 0x91
+ .unwind_raw 0, 0x9d
+ .unwind_raw 0, 0x9f
+ .unwind_raw 0, 0xa0
+ .unwind_raw 0, 0xa8
+ .unwind_raw 0, 0xb0
+ .unwind_raw 0, 0xb1, 0x00
+ .unwind_raw 4, 0xb1, 0x01
+ .unwind_raw 0, 0xb1, 0x10
+ .unwind_raw 0x204, 0xb2, 0x00
+ .unwind_raw 16, 0xb3, 0x00
+ .unwind_raw 0, 0xb4
+ .unwind_raw 16, 0xb8
+ .unwind_raw 4, 0xc0
+ .unwind_raw 4, 0xc6, 0x00
+ .unwind_raw 4, 0xc7, 0x00
+ .unwind_raw 4, 0xc7, 0x01
+ .unwind_raw 0, 0xc7, 0x10
+ .unwind_raw 16, 0xc8, 0x00
+ .unwind_raw 16, 0xc9, 0x00
+ .unwind_raw 0, 0xca
+ .unwind_raw 16, 0xd0
+ .unwind_raw 0, 0xd8
+ .fnend
+
+@ CHECK: UnwindInformation {
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.personality
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: __personality
+@ CHECK: Model: Compact (Inline)
+@ CHECK: PersonalityIndex: 0
+@ CHECK: Opcodes [
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.personality0
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: personality0
+@ CHECK: Model: Compact (Inline)
+@ CHECK: PersonalityIndex: 0
+@ CHECK: Opcodes [
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.personality1
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: personality1
+@ CHECK: ExceptionHandlingTable: .ARM.extab.personality1
+@ CHECK: TableEntryOffset: 0x0
+@ CHECK: Model: Compact
+@ CHECK: PersonalityIndex: 1
+@ CHECK: Opcodes [
+@ CHECK: 0xB1 0x0F ; pop {r0, r1, r2, r3}
+@ CHECK: 0xA7 ; pop {r4, r5, r6, r7, r8, r9, r10, fp}
+@ CHECK: 0x3F ; vsp = vsp + 256
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.custom_personality
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: custom_personality
+@ CHECK: ExceptionHandlingTable: .ARM.extab.custom_personality
+@ CHECK: TableEntryOffset: 0x0
+@ CHECK: Model: Generic
+@ CHECK: PersonalityRoutineAddress: 0x0
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.opcodes
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: opcodes
+@ CHECK: Model: Compact (Inline)
+@ CHECK: PersonalityIndex: 0
+@ CHECK: Opcodes [
+@ CHECK: 0xC9 0x84 ; pop {d8, d9, d10, d11, d12}
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.multiple
+@ CHECK: Entries [
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x0
+@ CHECK: FunctionName: function0
+@ CHECK: Model: Compact (Inline)
+@ CHECK: PersonalityIndex: 0
+@ CHECK: Opcodes [
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x4
+@ CHECK: FunctionName: function1
+@ CHECK: ExceptionHandlingTable: .ARM.extab.multiple
+@ CHECK: Model: Generic
+@ CHECK: PersonalityRoutineAddress: 0x0
+@ CHECK: }
+@ CHECK: Entry {
+@ CHECK: FunctionAddress: 0x8
+@ CHECK: FunctionName: function2
+@ CHECK: Model: Compact (Inline)
+@ CHECK: PersonalityIndex: 0
+@ CHECK: Opcodes [
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xB0 ; finish
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.raw
+@ CHECK: Entries [
+@ CHECK: Opcodes [
+@ CHECK: 0xD7 ; pop {d8, d9, d10, d11, d12, d13, d14, d15}
+@ CHECK: 0xC9 0x02 ; pop {d0, d1, d2}
+@ CHECK: 0xC8 0x02 ; pop {d16, d17, d18}
+@ CHECK: 0xC7 0x03 ; pop {wCGR0, wCGR1}
+@ CHECK: 0xC6 0x02 ; pop {wR0, wR1, wR2}
+@ CHECK: 0xC2 ; pop {wR10, wR11, wR12}
+@ CHECK: 0xBA ; pop {d8, d9, d10}
+@ CHECK: 0xB3 0x12 ; pop {d1, d2, d3}
+@ CHECK: 0xB2 0x80 0x04 ; vsp = vsp + 2564
+@ CHECK: 0xB1 0x01 ; pop {r0}
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xA9 ; pop {r4, r5, lr}
+@ CHECK: 0xA1 ; pop {r4, r5}
+@ CHECK: 0x91 ; vsp = r1
+@ CHECK: 0x84 0xC0 ; pop {r10, fp, lr}
+@ CHECK: 0x80 0xC0 ; pop {r10, fp}
+@ CHECK: 0x80 0x01 ; pop {r4}
+@ CHECK: 0x81 0x00 ; pop {ip}
+@ CHECK: 0x80 0x00 ; refuse to unwind
+@ CHECK: 0x42 ; vsp = vsp - 12
+@ CHECK: 0x02 ; vsp = vsp + 12
+@ CHECK: ]
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: UnwindIndexTable {
+@ CHECK: SectionName: .ARM.exidx.spare
+@ CHECK: Entries [
+@ CHECK: Opcodes [
+@ CHECK: 0xD8 ; spare
+@ CHECK: 0xD0 ; pop {d8}
+@ CHECK: 0xCA ; spare
+@ CHECK: 0xC9 0x00 ; pop {d0}
+@ CHECK: 0xC8 0x00 ; pop {d16}
+@ CHECK: 0xC7 0x10 ; spare
+@ CHECK: 0xC7 0x01 ; pop {wCGR0}
+@ CHECK: 0xC7 0x00 ; spare
+@ CHECK: 0xC6 0x00 ; pop {wR0}
+@ CHECK: 0xC0 ; pop {wR10}
+@ CHECK: 0xB8 ; pop {d8}
+@ CHECK: 0xB4 ; spare
+@ CHECK: 0xB3 0x00 ; pop {d0}
+@ CHECK: 0xB2 0x00 ; vsp = vsp + 516
+@ CHECK: 0xB1 0x10 ; spare
+@ CHECK: 0xB1 0x01 ; pop {r0}
+@ CHECK: 0xB1 0x00 ; spare
+@ CHECK: 0xB0 ; finish
+@ CHECK: 0xA8 ; pop {r4, lr}
+@ CHECK: 0xA0 ; pop {r4}
+@ CHECK: 0x9F ; reserved (WiMMX MOVrr)
+@ CHECK: 0x9D ; reserved (ARM MOVrr)
+@ CHECK: 0x91 ; vsp = r1
+@ CHECK: 0x88 0x00 ; pop {pc}
+@ CHECK: 0x80 0x00 ; refuse to unwind
+@ CHECK: 0x40 ; vsp = vsp - 4
+@ CHECK: 0x00 ; vsp = vsp + 4
+@ CHECK: ]
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: }
+
diff --git a/test/tools/llvm-readobj/Inputs/cxx-cli-aux.cpp b/test/tools/llvm-readobj/Inputs/cxx-cli-aux.cpp
new file mode 100644
index 0000000..6386cb2
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/cxx-cli-aux.cpp
@@ -0,0 +1,2 @@
+// cl.exe -clr -c t.cpp -Fo"cxx-cli-aux.obj.coff-i386"
+__declspec(appdomain) int PerAppDomain = 0;
diff --git a/test/tools/llvm-readobj/Inputs/cxx-cli-aux.obj.coff-i386 b/test/tools/llvm-readobj/Inputs/cxx-cli-aux.obj.coff-i386
new file mode 100644
index 0000000..a88c670
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/cxx-cli-aux.obj.coff-i386
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table-exe.mips b/test/tools/llvm-readobj/Inputs/dynamic-table-exe.mips
new file mode 100755
index 0000000..28d8e33
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/dynamic-table-exe.mips
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table.mips b/test/tools/llvm-readobj/Inputs/dynamic-table-so.mips
index ab36cee..ab36cee 100644
--- a/test/tools/llvm-readobj/Inputs/dynamic-table.mips
+++ b/test/tools/llvm-readobj/Inputs/dynamic-table-so.mips
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table.c b/test/tools/llvm-readobj/Inputs/dynamic-table.c
index 6d36e8a..6b01ba5 100644
--- a/test/tools/llvm-readobj/Inputs/dynamic-table.c
+++ b/test/tools/llvm-readobj/Inputs/dynamic-table.c
@@ -1,7 +1,9 @@
// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
-// -o dynamic-table.mips
+// -o dynamic-table-so.mips
+// clang -target mipsel-linux-gnu -lc dynamic-table.c \
+// -o dynamic-table-exe.mips
int puts(const char *);
-void foo(void) {
+int main(void) {
puts("Hello, World");
}
diff --git a/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-i368 b/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-i368
new file mode 100644
index 0000000..1672d3a
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-i368
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-x86_64 b/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-x86_64
new file mode 100644
index 0000000..30bfe79
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/multifile-linetables.obj.coff-2012-x86_64
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-i368 b/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-i368
new file mode 100644
index 0000000..a0196ff
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-i368
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-x86_64 b/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-x86_64
new file mode 100644
index 0000000..14f65ab
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/multifunction-linetables.obj.coff-2012-x86_64
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/nop.exe.coff-x86-64 b/test/tools/llvm-readobj/Inputs/nop.exe.coff-x86-64
new file mode 100644
index 0000000..62b3b46
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/nop.exe.coff-x86-64
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm
new file mode 100755
index 0000000..e3b5df4
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386 b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386
index 282e569..7486562 100644
--- a/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386
+++ b/test/tools/llvm-readobj/Inputs/trivial.obj.coff-i386
Binary files differ
diff --git a/test/tools/llvm-readobj/Inputs/zero-string-table.obj.coff-i386 b/test/tools/llvm-readobj/Inputs/zero-string-table.obj.coff-i386
new file mode 100644
index 0000000..f41f224
--- /dev/null
+++ b/test/tools/llvm-readobj/Inputs/zero-string-table.obj.coff-i386
Binary files differ
diff --git a/test/tools/llvm-readobj/codeview-linetables.test b/test/tools/llvm-readobj/codeview-linetables.test
new file mode 100644
index 0000000..4854d7a
--- /dev/null
+++ b/test/tools/llvm-readobj/codeview-linetables.test
@@ -0,0 +1,282 @@
+RUN: llvm-readobj -s -codeview-linetables %p/Inputs/multifunction-linetables.obj.coff-2012-i368 \
+RUN: | FileCheck %s -check-prefix MFUN32
+RUN: llvm-readobj -s -codeview-linetables %p/Inputs/multifunction-linetables.obj.coff-2012-x86_64 \
+RUN: | FileCheck %s -check-prefix MFUN64
+RUN: llvm-readobj -s -codeview-linetables %p/Inputs/multifile-linetables.obj.coff-2012-i368 \
+RUN: | FileCheck %s -check-prefix MFILE32
+RUN: llvm-readobj -s -codeview-linetables %p/Inputs/multifile-linetables.obj.coff-2012-x86_64 \
+RUN: | FileCheck %s -check-prefix MFILE64
+
+MFUN32: CodeViewLineTables [
+MFUN32-NEXT: Magic: 0x4
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF1
+MFUN32-NEXT: PayloadSize: 0x52
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF5
+MFUN32-NEXT: PayloadSize: 0x24
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF1
+MFUN32-NEXT: PayloadSize: 0x4B
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF2
+MFUN32-NEXT: PayloadSize: 0x30
+MFUN32: FunctionName: _x
+MFUN32-NEXT: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF5
+MFUN32-NEXT: PayloadSize: 0x24
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF1
+MFUN32-NEXT: PayloadSize: 0x4B
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF2
+MFUN32-NEXT: PayloadSize: 0x30
+MFUN32: FunctionName: _y
+MFUN32-NEXT: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF5
+MFUN32-NEXT: PayloadSize: 0x24
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF1
+MFUN32-NEXT: PayloadSize: 0x4B
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF2
+MFUN32-NEXT: PayloadSize: 0x40
+MFUN32: FunctionName: _f
+MFUN32-NEXT: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF4
+MFUN32-NEXT: PayloadSize: 0x18
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF3
+MFUN32-NEXT: PayloadSize: 0x46
+MFUN32: ]
+MFUN32-NEXT: Subsection [
+MFUN32-NEXT: Type: 0xF1
+MFUN32-NEXT: PayloadSize: 0x8
+MFUN32: ]
+MFUN32-NEXT: FunctionLineTable [
+MFUN32-NEXT: FunctionName: _x
+MFUN32-NEXT: CodeSize: 0xA
+MFUN32-NEXT: FilenameSegment [
+MFUN32-NEXT: Filename: d:\source.c
+MFUN32-NEXT: +0x0: 3
+MFUN32-NEXT: +0x3: 4
+MFUN32-NEXT: +0x8: 5
+MFUN32-NEXT: ]
+MFUN32-NEXT: ]
+MFUN32-NEXT: FunctionLineTable [
+MFUN32-NEXT: FunctionName: _y
+MFUN32-NEXT: CodeSize: 0xA
+MFUN32-NEXT: FilenameSegment [
+MFUN32-NEXT: Filename: d:\source.c
+MFUN32-NEXT: +0x0: 7
+MFUN32-NEXT: +0x3: 8
+MFUN32-NEXT: +0x8: 9
+MFUN32-NEXT: ]
+MFUN32-NEXT: ]
+MFUN32-NEXT: FunctionLineTable [
+MFUN32-NEXT: FunctionName: _f
+MFUN32-NEXT: CodeSize: 0x14
+MFUN32-NEXT: FilenameSegment [
+MFUN32-NEXT: Filename: d:\source.c
+MFUN32-NEXT: +0x0: 11
+MFUN32-NEXT: +0x3: 12
+MFUN32-NEXT: +0x8: 13
+MFUN32-NEXT: +0xD: 14
+MFUN32-NEXT: +0x12: 15
+MFUN32-NEXT: ]
+MFUN32-NEXT: ]
+MFUN32-NEXT: ]
+
+MFUN64: CodeViewLineTables [
+MFUN64-NEXT: Magic: 0x4
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF1
+MFUN64-NEXT: PayloadSize: 0x52
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF1
+MFUN64-NEXT: PayloadSize: 0x4B
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF2
+MFUN64-NEXT: PayloadSize: 0x30
+MFUN64: FunctionName: x
+MFUN64-NEXT: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF1
+MFUN64-NEXT: PayloadSize: 0x4B
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF2
+MFUN64-NEXT: PayloadSize: 0x30
+MFUN64: FunctionName: y
+MFUN64-NEXT: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF1
+MFUN64-NEXT: PayloadSize: 0x4B
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF2
+MFUN64-NEXT: PayloadSize: 0x40
+MFUN64: FunctionName: f
+MFUN64-NEXT: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF4
+MFUN64-NEXT: PayloadSize: 0x18
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF3
+MFUN64-NEXT: PayloadSize: 0xD
+MFUN64: ]
+MFUN64-NEXT: Subsection [
+MFUN64-NEXT: Type: 0xF1
+MFUN64-NEXT: PayloadSize: 0x8
+MFUN64: ]
+MFUN64-NEXT: FunctionLineTable [
+MFUN64-NEXT: FunctionName: x
+MFUN64-NEXT: CodeSize: 0xE
+MFUN64-NEXT: FilenameSegment [
+MFUN64-NEXT: Filename: d:\source.c
+MFUN64-NEXT: +0x0: 3
+MFUN64-NEXT: +0x4: 4
+MFUN64-NEXT: +0x9: 5
+MFUN64-NEXT: ]
+MFUN64-NEXT: ]
+MFUN64-NEXT: FunctionLineTable [
+MFUN64-NEXT: FunctionName: y
+MFUN64-NEXT: CodeSize: 0xE
+MFUN64-NEXT: FilenameSegment [
+MFUN64-NEXT: Filename: d:\source.c
+MFUN64-NEXT: +0x0: 7
+MFUN64-NEXT: +0x4: 8
+MFUN64-NEXT: +0x9: 9
+MFUN64-NEXT: ]
+MFUN64-NEXT: ]
+MFUN64-NEXT: FunctionLineTable [
+MFUN64-NEXT: FunctionName: f
+MFUN64-NEXT: CodeSize: 0x18
+MFUN64-NEXT: FilenameSegment [
+MFUN64-NEXT: Filename: d:\source.c
+MFUN64-NEXT: +0x0: 11
+MFUN64-NEXT: +0x4: 12
+MFUN64-NEXT: +0x9: 13
+MFUN64-NEXT: +0xE: 14
+MFUN64-NEXT: +0x13: 15
+MFUN64-NEXT: ]
+MFUN64-NEXT: ]
+MFUN64-NEXT: ]
+
+MFILE32: CodeViewLineTables [
+MFILE32-NEXT: Magic: 0x4
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF1
+MFILE32-NEXT: PayloadSize: 0x51
+MFILE32: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF5
+MFILE32-NEXT: PayloadSize: 0x24
+MFILE32: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF1
+MFILE32-NEXT: PayloadSize: 0x4B
+MFILE32: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF2
+MFILE32-NEXT: PayloadSize: 0x64
+MFILE32: FunctionName: _f
+MFILE32-NEXT: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF4
+MFILE32-NEXT: PayloadSize: 0x28
+MFILE32: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF3
+MFILE32-NEXT: PayloadSize: 0x57
+MFILE32: ]
+MFILE32-NEXT: Subsection [
+MFILE32-NEXT: Type: 0xF1
+MFILE32-NEXT: PayloadSize: 0x8
+MFILE32: ]
+MFILE32-NEXT: FunctionLineTable [
+MFILE32-NEXT: FunctionName: _f
+MFILE32-NEXT: CodeSize: 0x14
+MFILE32-NEXT: FilenameSegment [
+MFILE32-NEXT: Filename: d:\input.c
+MFILE32-NEXT: +0x0: 3
+MFILE32-NEXT: ]
+MFILE32-NEXT: FilenameSegment [
+MFILE32-NEXT: Filename: d:\one.c
+MFILE32-NEXT: +0x3: 1
+MFILE32-NEXT: ]
+MFILE32-NEXT: FilenameSegment [
+MFILE32-NEXT: Filename: d:\two.c
+MFILE32-NEXT: +0x8: 2
+MFILE32-NEXT: ]
+MFILE32-NEXT: FilenameSegment [
+MFILE32-NEXT: Filename: d:\one.c
+MFILE32-NEXT: +0xD: 7
+MFILE32-NEXT: +0x12: 8
+MFILE32-NEXT: ]
+MFILE32-NEXT: ]
+MFILE32-NEXT: ]
+
+MFILE64: CodeViewLineTables [
+MFILE64-NEXT: Magic: 0x4
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF1
+MFILE64-NEXT: PayloadSize: 0x51
+MFILE64: ]
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF1
+MFILE64-NEXT: PayloadSize: 0x4B
+MFILE64: ]
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF2
+MFILE64-NEXT: PayloadSize: 0x64
+MFILE64: FunctionName: f
+MFILE64-NEXT: ]
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF4
+MFILE64-NEXT: PayloadSize: 0x28
+MFILE64: ]
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF3
+MFILE64-NEXT: PayloadSize: 0x1E
+MFILE64: ]
+MFILE64-NEXT: Subsection [
+MFILE64-NEXT: Type: 0xF1
+MFILE64-NEXT: PayloadSize: 0x8
+MFILE64: ]
+MFILE64-NEXT: FunctionLineTable [
+MFILE64-NEXT: FunctionName: f
+MFILE64-NEXT: CodeSize: 0x18
+MFILE64-NEXT: FilenameSegment [
+MFILE64-NEXT: Filename: d:\input.c
+MFILE64-NEXT: +0x0: 3
+MFILE64-NEXT: ]
+MFILE64-NEXT: FilenameSegment [
+MFILE64-NEXT: Filename: d:\one.c
+MFILE64-NEXT: +0x4: 1
+MFILE64-NEXT: ]
+MFILE64-NEXT: FilenameSegment [
+MFILE64-NEXT: Filename: d:\two.c
+MFILE64-NEXT: +0x9: 2
+MFILE64-NEXT: ]
+MFILE64-NEXT: FilenameSegment [
+MFILE64-NEXT: Filename: d:\one.c
+MFILE64-NEXT: +0xE: 7
+MFILE64-NEXT: +0x13: 8
+MFILE64-NEXT: ]
+MFILE64-NEXT: ]
+MFILE64-NEXT: ]
diff --git a/test/tools/llvm-readobj/coff-zero-string-table.test b/test/tools/llvm-readobj/coff-zero-string-table.test
new file mode 100644
index 0000000..dfcf79e
--- /dev/null
+++ b/test/tools/llvm-readobj/coff-zero-string-table.test
@@ -0,0 +1,8 @@
+Ensure that we can read COFF objects with a string table size of 0 (instead
+of 4) for empty string tables.
+
+RUN: llvm-readobj -t %p/Inputs/zero-string-table.obj.coff-i386 | FileCheck %s
+
+CHECK: Symbols [
+CHECK: Symbol {
+CHECK: Name: $R000000
diff --git a/test/tools/llvm-readobj/cxx-cli-aux.test b/test/tools/llvm-readobj/cxx-cli-aux.test
new file mode 100644
index 0000000..90e73c0
--- /dev/null
+++ b/test/tools/llvm-readobj/cxx-cli-aux.test
@@ -0,0 +1,42 @@
+Ensure that we can read the COFF auxiliary symbols 'section definition' and
+'CLR token definition' as used in C++/CLI object files. Auxiliary section
+definitions usually only follow a symbol with static storage class, but
+non-const appdomain globals (external ABS) also get one.
+
+RUN: llvm-readobj -t %p/Inputs/cxx-cli-aux.obj.coff-i386 | FileCheck %s
+
+CHECK: Symbols [
+CHECK: Symbol {
+CHECK: Name: ?PerAppDomain@@$$Q3HA
+CHECK-NEXT: Value: 4
+CHECK-NEXT: Section: (65535)
+CHECK-NEXT: BaseType: Null (0x0)
+CHECK-NEXT: ComplexType: Null (0x0)
+CHECK-NEXT: StorageClass: External (0x2)
+CHECK-NEXT: AuxSymbolCount: 1
+CHECK-NEXT: AuxSectionDef {
+CHECK-NEXT: Length: 0
+CHECK-NEXT: RelocationCount: 0
+CHECK-NEXT: LineNumberCount: 0
+CHECK-NEXT: Checksum: 0x0
+CHECK-NEXT: Number: 0
+CHECK-NEXT: Selection: NoDuplicates (0x1)
+CHECK-NEXT: Unused: (00 00 00)
+CHECK-NEXT: }
+CHECK-NEXT: }
+
+CHECK: Symbol {
+CHECK: Name: 04000001
+CHECK-NEXT: Value: 4
+CHECK-NEXT: Section: (65535)
+CHECK-NEXT: BaseType: Null (0x0)
+CHECK-NEXT: ComplexType: Null (0x0)
+CHECK-NEXT: StorageClass: CLRToken (0x6B)
+CHECK-NEXT: AuxSymbolCount: 1
+CHECK-NEXT: AuxCLRToken {
+CHECK-NEXT: AuxType: 1
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: SymbolTableIndex: ?PerAppDomain@@$$Q3HA (19)
+CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00 00 00)
+CHECK-NEXT: }
+CHECK-NEXT: }
diff --git a/test/tools/llvm-readobj/dynamic.test b/test/tools/llvm-readobj/dynamic.test
index 78a9b3b..6a5fe95 100644
--- a/test/tools/llvm-readobj/dynamic.test
+++ b/test/tools/llvm-readobj/dynamic.test
@@ -1,4 +1,5 @@
-RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table.mips \
+// Check dynamic section tags in case of shared library file.
+RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-so.mips \
RUN: | FileCheck %s -check-prefix ELF-MIPS
ELF-MIPS: Format: ELF32-mips
@@ -31,3 +32,41 @@ ELF-MIPS: 0x6FFFFFFF VERNEEDNUM 1
ELF-MIPS: 0x6FFFFFF0 VERSYM 0x4C0
ELF-MIPS: 0x00000000 NULL 0x0
ELF-MIPS: ]
+
+// Check dynamic section tags in case of non-pic executable file.
+RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-exe.mips \
+RUN: | FileCheck %s -check-prefix ELF-MIPS-EXE
+
+ELF-MIPS-EXE: Format: ELF32-mips
+ELF-MIPS-EXE: Arch: mipsel
+ELF-MIPS-EXE: AddressSize: 32bit
+ELF-MIPS-EXE: LoadName:
+ELF-MIPS-EXE: DynamicSection [ (26 entries)
+ELF-MIPS-EXE: Tag Type Name/Value
+ELF-MIPS-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
+ELF-MIPS-EXE: 0x0000000C INIT 0x400418
+ELF-MIPS-EXE: 0x0000000D FINI 0x4007B0
+ELF-MIPS-EXE: 0x00000004 HASH 0x4002B8
+ELF-MIPS-EXE: 0x00000005 STRTAB 0x40036C
+ELF-MIPS-EXE: 0x00000006 SYMTAB 0x4002EC
+ELF-MIPS-EXE: 0x0000000A STRSZ 107 (bytes)
+ELF-MIPS-EXE: 0x0000000B SYMENT 16 (bytes)
+ELF-MIPS-EXE: 0x70000016 MIPS_RLD_MAP 0x410880
+ELF-MIPS-EXE: 0x00000015 DEBUG 0x0
+ELF-MIPS-EXE: 0x00000003 PLTGOT 0x410890
+ELF-MIPS-EXE: 0x70000001 MIPS_RLD_VERSION 1
+ELF-MIPS-EXE: 0x70000005 MIPS_FLAGS 0x2
+ELF-MIPS-EXE: 0x70000006 MIPS_BASE_ADDRESS 0x400000
+ELF-MIPS-EXE: 0x7000000A MIPS_LOCAL_GOTNO 5
+ELF-MIPS-EXE: 0x70000011 MIPS_SYMTABNO 8
+ELF-MIPS-EXE: 0x70000012 MIPS_UNREFEXTNO 32
+ELF-MIPS-EXE: 0x70000013 MIPS_GOTSYM 0x7
+ELF-MIPS-EXE: 0x00000014 PLTREL REL
+ELF-MIPS-EXE: 0x00000017 JMPREL 0x400408
+ELF-MIPS-EXE: 0x00000002 PLTRELSZ 16 (bytes)
+ELF-MIPS-EXE: 0x70000032 MIPS_PLTGOT 0x410854
+ELF-MIPS-EXE: 0x6FFFFFFE VERNEED 0x4003E8
+ELF-MIPS-EXE: 0x6FFFFFFF VERNEEDNUM 1
+ELF-MIPS-EXE: 0x6FFFFFF0 VERSYM 0x4003D8
+ELF-MIPS-EXE: 0x00000000 NULL 0x0
+ELF-MIPS-EXE: ]
diff --git a/test/tools/llvm-readobj/file-headers.test b/test/tools/llvm-readobj/file-headers.test
index b2b4547..39a8c0e 100644
--- a/test/tools/llvm-readobj/file-headers.test
+++ b/test/tools/llvm-readobj/file-headers.test
@@ -1,3 +1,5 @@
+RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-arm \
+RUN: | FileCheck %s -check-prefix COFF-ARM
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF32
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-x86-64 \
@@ -13,6 +15,21 @@ RUN: | FileCheck %s -check-prefix COFF-UNKNOWN
RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
RUN: | FileCheck %s -check-prefix COFF-IMPORTLIB
+COFF-ARM: File: {{(.*[/\\])?}}trivial.obj.coff-arm
+COFF-ARM-NEXT: Format: COFF-ARM
+COFF-ARM-NEXT: Arch: thumb
+COFF-ARM-NEXT: AddressSize: 32bit
+COFF-ARM-NEXT: ImageFileHeader {
+COFF-ARM-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
+COFF-ARM-NEXT: SectionCount: 2
+COFF-ARM-NEXT: TimeDateStamp: 2014-03-13 02:48:34 (0x53211C82)
+COFF-ARM-NEXT: PointerToSymbolTable: 0xFF
+COFF-ARM-NEXT: SymbolCount: 6
+COFF-ARM-NEXT: OptionalHeaderSize: 0
+COFF-ARM-NEXT: Characteristics [ (0x0)
+COFF-ARM-NEXT: ]
+COFF-ARM-NEXT: }
+
COFF32: File: {{(.*[/\\])?}}trivial.obj.coff-i386
COFF32-NEXT: Format: COFF-i386
COFF32-NEXT: Arch: i386
@@ -22,7 +39,7 @@ COFF32-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
COFF32-NEXT: SectionCount: 2
COFF32-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E)
COFF32-NEXT: PointerToSymbolTable: 0xA5
-COFF32-NEXT: SymbolCount: 7
+COFF32-NEXT: SymbolCount: 9
COFF32-NEXT: OptionalHeaderSize: 0
COFF32-NEXT: Characteristics [ (0x0)
COFF32-NEXT: ]
diff --git a/test/tools/llvm-readobj/peplus.test b/test/tools/llvm-readobj/peplus.test
new file mode 100644
index 0000000..8e6f550
--- /dev/null
+++ b/test/tools/llvm-readobj/peplus.test
@@ -0,0 +1,83 @@
+RUN: llvm-readobj -file-headers %p/Inputs/nop.exe.coff-x86-64 | FileCheck %s
+
+CHECK: Format: COFF-x86-64
+CHECK: Arch: x86_64
+CHECK: AddressSize: 64bit
+CHECK: ImageFileHeader {
+CHECK: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
+CHECK: SectionCount: 1
+CHECK: TimeDateStamp: 2014-01-26 03:43:56 (0x52E4847C)
+CHECK: PointerToSymbolTable: 0x0
+CHECK: SymbolCount: 0
+CHECK: OptionalHeaderSize: 240
+CHECK: Characteristics [ (0x22)
+CHECK: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
+CHECK: IMAGE_FILE_LARGE_ADDRESS_AWARE (0x20)
+CHECK: ]
+CHECK: }
+CHECK: ImageOptionalHeader {
+CHECK: MajorLinkerVersion: 11
+CHECK: MinorLinkerVersion: 0
+CHECK: SizeOfCode: 512
+CHECK: SizeOfInitializedData: 0
+CHECK: SizeOfUninitializedData: 0
+CHECK: AddressOfEntryPoint: 0x1000
+CHECK: BaseOfCode: 0x1000
+CHECK: ImageBase: 0x140000000
+CHECK: SectionAlignment: 4096
+CHECK: FileAlignment: 512
+CHECK: MajorOperatingSystemVersion: 6
+CHECK: MinorOperatingSystemVersion: 0
+CHECK: MajorImageVersion: 0
+CHECK: MinorImageVersion: 0
+CHECK: MajorSubsystemVersion: 6
+CHECK: MinorSubsystemVersion: 0
+CHECK: SizeOfImage: 8192
+CHECK: SizeOfHeaders: 512
+CHECK: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
+CHECK: Subsystem [ (0x8160)
+CHECK: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
+CHECK: IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA (0x20)
+CHECK: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
+CHECK: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
+CHECK: ]
+CHECK: SizeOfStackReserve: 1048576
+CHECK: SizeOfStackCommit: 4096
+CHECK: SizeOfHeapReserve: 1048576
+CHECK: SizeOfHeapCommit: 4096
+CHECK: NumberOfRvaAndSize: 16
+CHECK: DataDirectory {
+CHECK: ExportTableRVA: 0x0
+CHECK: ExportTableSize: 0x0
+CHECK: ImportTableRVA: 0x0
+CHECK: ImportTableSize: 0x0
+CHECK: ResourceTableRVA: 0x0
+CHECK: ResourceTableSize: 0x0
+CHECK: ExceptionTableRVA: 0x0
+CHECK: ExceptionTableSize: 0x0
+CHECK: CertificateTableRVA: 0x0
+CHECK: CertificateTableSize: 0x0
+CHECK: BaseRelocationTableRVA: 0x0
+CHECK: BaseRelocationTableSize: 0x0
+CHECK: DebugRVA: 0x0
+CHECK: DebugSize: 0x0
+CHECK: ArchitectureRVA: 0x0
+CHECK: ArchitectureSize: 0x0
+CHECK: GlobalPtrRVA: 0x0
+CHECK: GlobalPtrSize: 0x0
+CHECK: TLSTableRVA: 0x0
+CHECK: TLSTableSize: 0x0
+CHECK: LoadConfigTableRVA: 0x0
+CHECK: LoadConfigTableSize: 0x0
+CHECK: BoundImportRVA: 0x0
+CHECK: BoundImportSize: 0x0
+CHECK: IATRVA: 0x0
+CHECK: IATSize: 0x0
+CHECK: DelayImportDescriptorRVA: 0x0
+CHECK: DelayImportDescriptorSize: 0x0
+CHECK: CLRRuntimeHeaderRVA: 0x0
+CHECK: CLRRuntimeHeaderSize: 0x0
+CHECK: ReservedRVA: 0x0
+CHECK: ReservedSize: 0x0
+CHECK: }
+CHECK: }
diff --git a/test/tools/llvm-readobj/sections-ext.test b/test/tools/llvm-readobj/sections-ext.test
index e3a40c3..0f7ce26 100644
--- a/test/tools/llvm-readobj/sections-ext.test
+++ b/test/tools/llvm-readobj/sections-ext.test
@@ -189,7 +189,8 @@ MACHO-I386-NEXT: ]
MACHO-I386-NEXT: Symbols [
MACHO-I386-NEXT: Symbol {
MACHO-I386-NEXT: Name: _main (1)
-MACHO-I386-NEXT: Type: 0xF
+MACHO-I386-NEXT: Extern
+MACHO-I386-NEXT: Type: Section (0xE)
MACHO-I386-NEXT: Section: __text (0x1)
MACHO-I386-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-I386-NEXT: Flags [ (0x0)
@@ -231,7 +232,8 @@ MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Symbols [
MACHO-X86-64-NEXT: Symbol {
MACHO-X86-64-NEXT: Name: _main (1)
-MACHO-X86-64-NEXT: Type: 0xF
+MACHO-X86-64-NEXT: Extern
+MACHO-X86-64-NEXT: Type: Section (0xE)
MACHO-X86-64-NEXT: Section: __text (0x1)
MACHO-X86-64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-X86-64-NEXT: Flags [ (0x0)
@@ -306,7 +308,8 @@ MACHO-PPC-NEXT: ]
MACHO-PPC-NEXT: Symbols [
MACHO-PPC-NEXT: Symbol {
MACHO-PPC-NEXT: Name: _f (4)
-MACHO-PPC-NEXT: Type: 0xF
+MACHO-PPC-NEXT: Extern
+MACHO-PPC-NEXT: Type: Section (0xE)
MACHO-PPC-NEXT: Section: __text (0x1)
MACHO-PPC-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC-NEXT: Flags [ (0x0)
@@ -371,7 +374,8 @@ MACHO-PPC-NEXT: ]
MACHO-PPC-NEXT: Symbols [
MACHO-PPC-NEXT: Symbol {
MACHO-PPC-NEXT: Name: _b (1)
-MACHO-PPC-NEXT: Type: 0xF
+MACHO-PPC-NEXT: Extern
+MACHO-PPC-NEXT: Type: Section (0xE)
MACHO-PPC-NEXT: Section: __data (0x3)
MACHO-PPC-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC-NEXT: Flags [ (0x0)
@@ -461,7 +465,8 @@ MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
MACHO-PPC64-NEXT: Symbol {
MACHO-PPC64-NEXT: Name: _f (4)
-MACHO-PPC64-NEXT: Type: 0xF
+MACHO-PPC64-NEXT: Extern
+MACHO-PPC64-NEXT: Type: Section (0xE)
MACHO-PPC64-NEXT: Section: __text (0x1)
MACHO-PPC64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC64-NEXT: Flags [ (0x0)
@@ -526,7 +531,8 @@ MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
MACHO-PPC64-NEXT: Symbol {
MACHO-PPC64-NEXT: Name: _b (1)
-MACHO-PPC64-NEXT: Type: 0xF
+MACHO-PPC64-NEXT: Extern
+MACHO-PPC64-NEXT: Type: Section (0xE)
MACHO-PPC64-NEXT: Section: __data (0x3)
MACHO-PPC64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC64-NEXT: Flags [ (0x0)
@@ -691,7 +697,8 @@ MACHO-ARM-NEXT: ]
MACHO-ARM-NEXT: Symbols [
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _f (4)
-MACHO-ARM-NEXT: Type: 0xF
+MACHO-ARM-NEXT: Extern
+MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __text (0x1)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)
@@ -700,7 +707,8 @@ MACHO-ARM-NEXT: Value: 0x10
MACHO-ARM-NEXT: }
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _h (1)
-MACHO-ARM-NEXT: Type: 0xF
+MACHO-ARM-NEXT: Extern
+MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __text (0x1)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)
@@ -825,7 +833,8 @@ MACHO-ARM-NEXT: ]
MACHO-ARM-NEXT: Symbols [
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _b (10)
-MACHO-ARM-NEXT: Type: 0xF
+MACHO-ARM-NEXT: Extern
+MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __data (0x6)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)
diff --git a/test/tools/llvm-readobj/symbols.test b/test/tools/llvm-readobj/symbols.test
index e014377..26830ac 100644
--- a/test/tools/llvm-readobj/symbols.test
+++ b/test/tools/llvm-readobj/symbols.test
@@ -5,6 +5,24 @@ RUN: | FileCheck %s -check-prefix ELF
COFF: Symbols [
COFF-NEXT: Symbol {
+COFF-NEXT: Name: @comp.id
+COFF-NEXT: Value: 14766605
+COFF-NEXT: Section: (65535)
+COFF-NEXT: BaseType: Null (0x0)
+COFF-NEXT: ComplexType: Null (0x0)
+COFF-NEXT: StorageClass: Static (0x3)
+COFF-NEXT: AuxSymbolCount: 0
+COFF-NEXT: }
+COFF-NEXT: Symbol {
+COFF-NEXT: Name: @feat.00
+COFF-NEXT: Value: 2147484049
+COFF-NEXT: Section: (65535)
+COFF-NEXT: BaseType: Null (0x0)
+COFF-NEXT: ComplexType: Null (0x0)
+COFF-NEXT: StorageClass: Static (0x3)
+COFF-NEXT: AuxSymbolCount: 0
+COFF-NEXT: }
+COFF-NEXT: Symbol {
COFF-NEXT: Name: .text
COFF-NEXT: Value: 0
COFF-NEXT: Section: .text (1)
@@ -31,7 +49,7 @@ ELF-NEXT: Size: 0
ELF-NEXT: Binding: Local (0x0)
ELF-NEXT: Type: None (0x0)
ELF-NEXT: Other: 0
-ELF-NEXT: Section: (0x0)
+ELF-NEXT: Section: Undefined (0x0)
ELF-NEXT: }
ELF-NEXT: Symbol {
ELF-NEXT: Name: trivial.ll (1)
@@ -40,7 +58,7 @@ ELF-NEXT: Size: 0
ELF-NEXT: Binding: Local (0x0)
ELF-NEXT: Type: File (0x4)
ELF-NEXT: Other: 0
-ELF-NEXT: Section: (0xFFF1)
+ELF-NEXT: Section: Absolute (0xFFF1)
ELF-NEXT: }
ELF-NEXT: Symbol {
ELF-NEXT: Name: .L.str (39)