xref: /llvm-project/clang/test/Driver/lld-repro.c (revision a514457e62e96a13fc69343e058658f37bff9641)
1 // REQUIRES: lld
2 // UNSUPPORTED: target={{.*-(ps4|ps5)}}, target={{.*}}-zos{{.*}}
3 
4 // RUN: echo "-nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t" \
5 // RUN:   | sed -e 's/\\/\\\\/g' > %t.rsp
6 
7 // RUN: not %clang %s @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 \
8 // RUN:   | FileCheck %s
9 
10 // Test that the reproducer can still be created even when the input source cannot be preprocessed
11 // again, like when reading from stdin.
12 // RUN: not %clang -x c - @%t.rsp -fcrash-diagnostics=all -o /dev/null 2>&1 < %s \
13 // RUN:   | FileCheck %s
14 
15 // check that we still get lld's output
16 // CHECK: error: undefined symbol: {{_?}}a
17 
18 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
19 // CHECK-NEXT: note: diagnostic msg: {{.*}}linker-crash-{{.*}}.tar
20 // CHECK-NEXT: note: diagnostic msg:
21 // CHECK: ********************
22 
23 // RUN: not %clang %s @%t.rsp -fcrash-diagnostics=compiler -o /dev/null 2>&1 \
24 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
25 // RUN: not %clang %s @%t.rsp -o /dev/null 2>&1 \
26 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
27 
28 // NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are located at:
29 
30 extern int a;
31 int main() {
32   return a;
33 }
34