summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-10-09 17:27:47 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-10-09 17:27:47 +0000
commit01ab402463f4e213adb0fe7e5f7d7db1836a666f (patch)
tree405e08a0525413c9aa553f4dbe94b9269b996e97 /llvm/test
parentaadc2331e42008ace6b254d02a2ccee7fd656bfc (diff)
downloadbcm5719-llvm-01ab402463f4e213adb0fe7e5f7d7db1836a666f.tar.gz
bcm5719-llvm-01ab402463f4e213adb0fe7e5f7d7db1836a666f.zip
[dsymutil] Emit valid debug locations when no symbol flags are set
Summary: swiftc emits symbols without flags set, which led dsymutil to ignore them when searching for global symbols, causing dwarf location data to be omitted. Xcode's dsymutil handles this case correctly, and emits valid location data. Add this functionality to llvm-dsymutil by allowing parsing of symbols with no flags set. Reviewers: aprantl, friss, JDevlieghere Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38587 llvm-svn: 315218
Diffstat (limited to 'llvm/test')
-rwxr-xr-xllvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64bin0 -> 4320 bytes
-rw-r--r--llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64.obin0 -> 1704 bytes
-rw-r--r--llvm/test/tools/dsymutil/X86/swift-dwarf-loc.test37
3 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64 b/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64
new file mode 100755
index 00000000000..b232e509442
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64
Binary files differ
diff --git a/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64.o b/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64.o
new file mode 100644
index 00000000000..2e34ce3de5b
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/swift-dwarf-loc.macho.x86_64.o
Binary files differ
diff --git a/llvm/test/tools/dsymutil/X86/swift-dwarf-loc.test b/llvm/test/tools/dsymutil/X86/swift-dwarf-loc.test
new file mode 100644
index 00000000000..29310cae6a4
--- /dev/null
+++ b/llvm/test/tools/dsymutil/X86/swift-dwarf-loc.test
@@ -0,0 +1,37 @@
+RUN: llvm-dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/swift-dwarf-loc.macho.x86_64 -no-output -verbose | FileCheck %s
+
+This test checks that dsymutil generates a valid dwarf location for a symbol with no flags set.
+
+The following IR was compiled for x86_64-apple:
+; ModuleID = '-'
+source_filename = "-"
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.12"
+
+%TSi = type <{ i64 }>
+
+@_var = hidden global %TSi zeroinitializer, align 8, !dbg !0
+
+!llvm.dbg.cu = !{!8}
+!llvm.module.flags = !{!11, !12}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "x", linkageName: "_var", scope: !2, file: !3, line: 1, type: !4, isLocal: false, isDefinition: true)
+!2 = !DIModule(scope: null, name: "main")
+!3 = !DIFile(filename: "<stdin>", directory: "")
+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "Int", scope: !6, file: !5, size: 64, elements: !7, runtimeLang: DW_LANG_Swift, identifier: "_T0SiD")
+!5 = !DIFile(filename: "foo", directory: "/tmp")
+!6 = !DIModule(scope: null, name: "foo", includePath: "")
+!7 = !{}
+!8 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !9, producer: "swiftc", isOptimized: false, flags: "", runtimeVersion: 4, emissionKind: FullDebug, enums: !7, globals: !10, imports: null)
+!9 = !DIFile(filename: "/tmp", directory: "")
+!10 = !{!0}
+!11 = !{i32 2, !"Dwarf Version", i32 4}
+!12 = !{i32 2, !"Debug Info Version", i32 3}
+
+Compiled with: llc -filetype=obj %p/../Inputs/swift-dwarf-loc.ll -mtriple x86_64-apple-darwin
+Linked with: ld -dylib %T/swift-dwarf-loc.o -arch x86_64 -lSystem -macosx_version_min 10.9.0
+
+CHECK: __var,
+CHECK-NOT: __var,{{.*}}binAddr: 0x0000000000000000
+CHECK-NOT: __var{{.*}} => 0000000000000000
OpenPOWER on IntegriCloud