summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-08-23 04:44:21 +0000
committerFrederic Riss <friss@apple.com>2015-08-23 04:44:21 +0000
commit7bb12261a35352ce103e64551b49e7c20acc86e2 (patch)
tree278ab9145605ee122b9c3b2d48f7cc266606acf8 /llvm/test
parent1c813407976686f09096406b1d3141290dd93e61 (diff)
downloadbcm5719-llvm-7bb12261a35352ce103e64551b49e7c20acc86e2.tar.gz
bcm5719-llvm-7bb12261a35352ce103e64551b49e7c20acc86e2.zip
[dwarfdump] Do not apply relocations in mach-o files if there is no LoadedObjectInfo.
Not only do we not need to do anything to read correct values from the object files, but the current logic actually wrongly applies twice the section base address when there is no LoadedObjectInfo passed to the DWARFContext creation (as the added test shows). Simply do not apply any relocations on the mach-o debug info if there is no load offset to apply. llvm-svn: 245807
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/DebugInfo/Inputs/dwarfdump-macho-relocs.macho.x86_64.obin0 -> 2364 bytes
-rw-r--r--llvm/test/DebugInfo/dwarfdump-macho-relocs.test27
2 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-macho-relocs.macho.x86_64.o b/llvm/test/DebugInfo/Inputs/dwarfdump-macho-relocs.macho.x86_64.o
new file mode 100644
index 00000000000..a5f8476df5e
--- /dev/null
+++ b/llvm/test/DebugInfo/Inputs/dwarfdump-macho-relocs.macho.x86_64.o
Binary files differ
diff --git a/llvm/test/DebugInfo/dwarfdump-macho-relocs.test b/llvm/test/DebugInfo/dwarfdump-macho-relocs.test
new file mode 100644
index 00000000000..95798a841ca
--- /dev/null
+++ b/llvm/test/DebugInfo/dwarfdump-macho-relocs.test
@@ -0,0 +1,27 @@
+// RUN: llvm-dwarfdump -debug-dump=info %p/Inputs/dwarfdump-macho-relocs.macho.x86_64.o | FileCheck %s
+
+// The dumped file has 2 functions in different sections of the __TEXT segment.
+// Check that the addresses are are dumped correctly
+
+// Compiled with: clang -x c -g -c -o dwarfdump-macho-relocs.macho.x86_64.o dwarfdump-macho-relocs.test
+
+__attribute__((section("__TEXT,__blah")))
+int foo() {
+ return 42;
+}
+
+// CHECK: DW_TAG_subprogram
+// CHECK-NEXT: DW_AT_low_pc{{.*}}0x0000000000000020
+// CHECK-NEXT: DW_AT_high_pc{{.*}}0x000000000000002b
+// CHECK-NEXT: DW_AT_frame_base
+// CHECK-NEXT: DW_AT_name{{.*}}"foo"
+
+int main() {
+ return foo();
+}
+
+// CHECK: DW_TAG_subprogram
+// CHECK-NEXT: DW_AT_low_pc{{.*}}0x0000000000000000
+// CHECK-NEXT: DW_AT_high_pc{{.*}}0x000000000000001a
+// CHECK-NEXT: DW_AT_frame_base
+// CHECK-NEXT: DW_AT_name{{.*}}"main"
OpenPOWER on IntegriCloud