summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-01-05 21:29:28 +0000
committerFrederic Riss <friss@apple.com>2015-01-05 21:29:28 +0000
commit4398850779b8d6f21ac6376440d5c857a11d40b3 (patch)
tree192439827ee9f6d9ac073dac2cf2f30fd15ba916 /llvm/test/tools
parent2997dbff12ad95e28b396bf37b4b7fe88a5767c1 (diff)
downloadbcm5719-llvm-4398850779b8d6f21ac6376440d5c857a11d40b3.tar.gz
bcm5719-llvm-4398850779b8d6f21ac6376440d5c857a11d40b3.zip
[dsymutil] Implement the BinaryHolder object and gain archive support.
This object is meant to own the ObjectFiles and their underlying MemoryBuffer. It is basically the equivalent of an OwningBinary except that it efficiently handles Archives. It is optimized for efficiently providing mappings of members of the same archive when they are opened successively (which is standard in Darwin debug maps, objects from the same archive will be contiguous). Of course, the BinaryHolder will also be used by the DWARF linker once it is commited, but for now only the debug map parser uses it. With this change, you can run llvm-dsymutil on your Darwin debug build of clang and get a complete debug map for it. Differential Revision: http://reviews.llvm.org/D6690 llvm-svn: 225207
Diffstat (limited to 'llvm/test/tools')
-rwxr-xr-xllvm/test/tools/dsymutil/Inputs/basic-archive.macho.x86_64bin0 -> 9352 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/basic1.c3
-rw-r--r--llvm/test/tools/dsymutil/Inputs/libbasic.abin0 -> 6840 bytes
-rw-r--r--llvm/test/tools/dsymutil/debug-map-parsing.test29
4 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/tools/dsymutil/Inputs/basic-archive.macho.x86_64 b/llvm/test/tools/dsymutil/Inputs/basic-archive.macho.x86_64
new file mode 100755
index 00000000000..abffb06147d
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/basic-archive.macho.x86_64
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/basic1.c b/llvm/test/tools/dsymutil/Inputs/basic1.c
index 04e8f9391d1..cedf83aec3e 100644
--- a/llvm/test/tools/dsymutil/Inputs/basic1.c
+++ b/llvm/test/tools/dsymutil/Inputs/basic1.c
@@ -16,6 +16,9 @@
clang basic1-lto.o basic2-lto.o basic3-lto.o -o basic-lto.macho.x86_64 -Wl,-object_path_lto,$PWD/basic-lto.macho.x86_64.o -Wl,-dead_strip
rm basic1-lto.o basic2-lto.o basic3-lto.o
+ Archive compilation (after basic compilation):
+ ar -q libbasic.a basic2.macho.x86_64.o basic3.macho.x86_64.o
+ clang basic1.macho.x86_64.o -lbasic -o basic-archive.macho.x86_64 -Wl,-dead_strip -L.
*/
int foo(int);
diff --git a/llvm/test/tools/dsymutil/Inputs/libbasic.a b/llvm/test/tools/dsymutil/Inputs/libbasic.a
new file mode 100644
index 00000000000..9657e789557
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/libbasic.a
Binary files differ
diff --git a/llvm/test/tools/dsymutil/debug-map-parsing.test b/llvm/test/tools/dsymutil/debug-map-parsing.test
index 4fa7e715b97..f1b310f9b71 100644
--- a/llvm/test/tools/dsymutil/debug-map-parsing.test
+++ b/llvm/test/tools/dsymutil/debug-map-parsing.test
@@ -1,7 +1,10 @@
RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
+RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
RUN: llvm-dsymutil -v -parse-only %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=NOT-FOUND
RUN: not llvm-dsymutil -v -parse-only %p/Inputs/inexistant 2>&1 | FileCheck %s --check-prefix=NO-EXECUTABLE
+
+
Check that We can parse the debug map of the basic executable.
CHECK-NOT: error
@@ -33,6 +36,32 @@ CHECK-LTO: 00000000000008e8 => 0000000100001008 _private_int
CHECK-LTO: 00000000000008ec => 0000000100001004 _val
CHECK-LTO: END DEBUG MAP
+Check thet we correctly handle debug maps with archive members (including only
+opening the archive once if mulitple of its members are used).
+
+CHECK-ARCHIVE: trying to open {{.*}}basic-archive.macho.x86_64'
+CHECK-ARCHIVE-NEXT: loaded file.
+CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
+CHECK-ARCHIVE-NEXT: loaded file.
+CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
+CHECK-ARCHIVE-NEXT: opened new archive {{.*}}/libbasic.a'
+CHECK-ARCHIVE-NEXT: found member in current archive.
+CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
+CHECK-ARCHIVE-NEXT: found member in current archive.
+CHECK-ARCHIVE: DEBUG MAP: object addr => executable addr symbol name
+CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o:
+CHECK-ARCHIVE: 0000000000000000 => 0000000100000ea0 _main
+CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o):
+CHECK-ARCHIVE: 0000000000000310 => 0000000100001000 _baz
+CHECK-ARCHIVE: 0000000000000020 => 0000000100000ed0 _foo
+CHECK-ARCHIVE: 0000000000000070 => 0000000100000f20 _inc
+CHECK-ARCHIVE: 0000000000000560 => 0000000100001004 _private_int
+CHECK-ARCHIVE: /Inputs/./libbasic.a(basic3.macho.x86_64.o):
+CHECK-ARCHIVE: 0000000000000020 => 0000000100000f40 _bar
+CHECK-ARCHIVE: 0000000000000070 => 0000000100000f90 _inc
+CHECK-ARCHIVE: 0000000000000004 => 0000000100001008 _val
+CHECK-ARCHIVE: END DEBUG MAP
+
Check that we warn about missing object files (this presumes that the files aren't
present in the machine's /Inputs/ folder, which should be a pretty safe bet).
OpenPOWER on IntegriCloud