summaryrefslogtreecommitdiff
path: root/test/LTO
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-05-09 17:37:33 +0000
committerAdrian Prantl <aprantl@apple.com>2016-05-09 17:37:33 +0000
commit9860b93e0722d423fe651c223b1fc2071b8d1fa0 (patch)
treedbc14322e94e7483c186a4e6271df90f65716faa /test/LTO
parentbc9409d1af748ce704dc9dacd0d05ed36c909db8 (diff)
Allow the LTO code generator to strip invalid debug info from the input.
This patch introduces a new option -lto-strip-invalid-debug-info, which drops malformed debug info from the input. The problem I'm trying to solve with this sequence of patches is that historically we've done a really bad job at verifying debug info. We want to be able to make the verifier stricter without having to worry about breaking bitcode compatibility with existing producers. For example, we don't necessarily want IR produced by an older version of clang to be rejected by an LTO link just because of malformed debug info, and rather provide an option to strip it. Note that merely outdated (but well-formed) debug info would continue to be auto-upgraded in this scenario. rdar://problem/25818489 http://reviews.llvm.org/D19987 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r--test/LTO/X86/Inputs/strip-debug-info.bcbin0 -> 852 bytes
-rw-r--r--test/LTO/X86/strip-debug-info.ll20
2 files changed, 20 insertions, 0 deletions
diff --git a/test/LTO/X86/Inputs/strip-debug-info.bc b/test/LTO/X86/Inputs/strip-debug-info.bc
new file mode 100644
index 00000000000..c83195ff9ca
--- /dev/null
+++ b/test/LTO/X86/Inputs/strip-debug-info.bc
Binary files differ
diff --git a/test/LTO/X86/strip-debug-info.ll b/test/LTO/X86/strip-debug-info.ll
new file mode 100644
index 00000000000..265a34b9c97
--- /dev/null
+++ b/test/LTO/X86/strip-debug-info.ll
@@ -0,0 +1,20 @@
+; RUN: not llvm-lto -lto-strip-invalid-debug-info=false \
+; RUN: -o %t.o %S/Inputs/strip-debug-info.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty -check-prefix=CHECK-ERR
+; RUN: llvm-lto -lto-strip-invalid-debug-info=true -exported-symbol _foo \
+; RUN: -o %t.o %S/Inputs/strip-debug-info.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty -check-prefix=CHECK-WARN
+; RUN: llvm-nm %t.o | FileCheck %s
+
+; CHECK-ERR: Broken module found, compilation aborted
+; CHECK-WARN: Invalid debug info found, debug info will be stripped
+; CHECK: foo
+define void @foo() {
+ ret void
+}
+
+!llvm.module.flags = !{!0}
+!llvm.dbg.cu = !{!1}
+
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = !DIFile(filename: "broken", directory: "")