| 1 |
/// Test -gsplit-dwarf and -gsplit-dwarf={split,single}. |
| 2 |
|
| 3 |
/// Interaction with -g (-g2). |
| 4 |
// RUN: %clang -### -c -target x86_64 -g -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT |
| 5 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT |
| 6 |
// RUN: %clang -### -c -target x86_64 -g2 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT |
| 7 |
/// -gsplit-dwarf=split is equivalent to -gsplit-dwarf. |
| 8 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT |
| 9 |
|
| 10 |
// INLINE: "-fsplit-dwarf-inlining" |
| 11 |
// NOINLINE-NOT: "-fsplit-dwarf-inlining" |
| 12 |
// SPLIT-NOT: "-dumpdir" |
| 13 |
// SPLIT: "-debug-info-kind=constructor" |
| 14 |
// SPLIT-SAME: "-ggnu-pubnames" |
| 15 |
// SPLIT-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" |
| 16 |
|
| 17 |
// RUN: %clang -### -c -target wasm32 -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=SPLIT |
| 18 |
// RUN: %clang -### -c --target=amdgcn-amd-amdhsa -nogpuinc -nogpulib -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=SPLIT |
| 19 |
// RUN: %clang_cl -### -c --target=x86_64-unknown-windows-msvc -gno-split-dwarf -gsplit-dwarf -g -- %s 2>&1 | FileCheck %s --check-prefix=SPLIT |
| 20 |
|
| 21 |
/// -gsplit-dwarf is a no-op on a non-ELF platform. |
| 22 |
// RUN: %clang -### -c -target x86_64-apple-darwin -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=DARWIN |
| 23 |
// DARWIN: "-debug-info-kind=standalone" |
| 24 |
// DARWIN-NOT: "-split-dwarf |
| 25 |
|
| 26 |
/// -gsplit-dwarf is a no-op if no -g is specified. |
| 27 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=G0 |
| 28 |
|
| 29 |
/// ... unless -fthinlto-index= is specified. |
| 30 |
// RUN: echo > %t.bc |
| 31 |
// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf %t.bc 2>&1 | FileCheck %s --check-prefix=IR |
| 32 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -x ir %t.bc 2>&1 | FileCheck %s --check-prefix=IR |
| 33 |
|
| 34 |
// IR-NOT: "-debug-info-kind= |
| 35 |
// IR: "-ggnu-pubnames" |
| 36 |
// IR-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" "{{.*}}.dwo" |
| 37 |
|
| 38 |
/// -gno-split-dwarf disables debug fission. |
| 39 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT |
| 40 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT |
| 41 |
// RUN: %clang -### -c -target x86_64 -gno-split-dwarf -g -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT |
| 42 |
|
| 43 |
// NOSPLIT: "-debug-info-kind=constructor" |
| 44 |
// NOSPLIT-NOT: "-ggnu-pubnames" |
| 45 |
// NOSPLIT-NOT: "-split-dwarf |
| 46 |
|
| 47 |
/// Test -gsplit-dwarf=single. |
| 48 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g %s 2>&1 | FileCheck %s --check-prefix=SINGLE |
| 49 |
|
| 50 |
// SINGLE: "-debug-info-kind=constructor" |
| 51 |
// SINGLE: "-split-dwarf-file" "split-debug.o" |
| 52 |
// SINGLE-NOT: "-split-dwarf-output" |
| 53 |
|
| 54 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -o %tfoo.o %s 2>&1 | FileCheck %s --check-prefix=SINGLE_WITH_FILENAME |
| 55 |
// RUN: %clang_cl -### -c --target=x86_64-unknown-windows-msvc -gsplit-dwarf=single -g -o %tfoo.o -- %s 2>&1 | FileCheck %s --check-prefix=SINGLE_WITH_FILENAME |
| 56 |
|
| 57 |
// SINGLE_WITH_FILENAME: "-split-dwarf-file" "{{.*}}foo.o" |
| 58 |
// SINGLE_WITH_FILENAME-NOT: "-split-dwarf-output" |
| 59 |
|
| 60 |
/// If linking is the final phase, the .dwo filename is derived from -o (if specified) or "a". |
| 61 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -gsplit-dwarf -g %s -o obj/out 2>&1 | FileCheck %s --check-prefix=SPLIT_LINK |
| 62 |
// RUN: %clang_cl -### --target=x86_64-unknown-windows-msvc -gsplit-dwarf -g -o obj/out -- %s 2>&1 | FileCheck %s --check-prefix=SPLIT_LINK |
| 63 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=SPLIT_LINK_A |
| 64 |
|
| 65 |
// SPLIT_LINK: "-dumpdir" "obj/out-" |
| 66 |
// SPLIT_LINK: "-debug-info-kind=constructor" |
| 67 |
// SPLIT_LINK-SAME: "-split-dwarf-file" "obj/out-split-debug.dwo" "-split-dwarf-output" "obj/out-split-debug.dwo" |
| 68 |
// SPLIT_LINK_A: "-dumpdir" "a-" |
| 69 |
// SPLIT_LINK_A-SAME: "-split-dwarf-file" "a-split-debug.dwo" "-split-dwarf-output" "a-split-debug.dwo" |
| 70 |
|
| 71 |
/// GCC special cases /dev/null (HOST_BIT_BUCKET) but not other special files like /dev/zero. |
| 72 |
/// We don't apply special rules at all. |
| 73 |
// RUN: %if !system-windows %{ %clang -### --target=x86_64-unknown-linux-gnu -gsplit-dwarf -g %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=SPLIT_LINK_NULL %} |
| 74 |
|
| 75 |
// SPLIT_LINK_NULL: "-dumpdir" "/dev/null-" |
| 76 |
// SPLIT_LINK_NULL-SAME: "-split-dwarf-output" "/dev/null-split-debug.dwo" |
| 77 |
|
| 78 |
/// If -dumpdir is specified, use its value to derive the .dwo filename. |
| 79 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -gsplit-dwarf -g %s -o obj/out -dumpdir pf/x -c 2>&1 | FileCheck %s --check-prefix=DUMPDIR |
| 80 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -gsplit-dwarf -g %s -o obj/out -dumpdir pf/x 2>&1 | FileCheck %s --check-prefix=DUMPDIR |
| 81 |
|
| 82 |
// DUMPDIR: "-dumpdir" "pf/x" |
| 83 |
// DUMPDIR-SAME: "-split-dwarf-output" "pf/xsplit-debug.dwo" |
| 84 |
|
| 85 |
/// -fsplit-dwarf-inlining |
| 86 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g -fsplit-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefixes=INLINE,SPLIT |
| 87 |
|
| 88 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g -gno-pubnames %s 2>&1 | FileCheck %s --check-prefixes=NOPUBNAMES |
| 89 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=split -g -gno-gnu-pubnames %s 2>&1 | FileCheck %s --check-prefixes=NOPUBNAMES |
| 90 |
// NOPUBNAMES: "-debug-info-kind=constructor" |
| 91 |
// NOPUBNAMES-NOT: "-ggnu-pubnames" |
| 92 |
// NOPUBNAMES-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" |
| 93 |
|
| 94 |
/// Invoke objcopy if not using the integrated assembler. |
| 95 |
// RUN: %clang -### -c -target x86_64-unknown-linux-gnu -fno-integrated-as -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=OBJCOPY |
| 96 |
// OBJCOPY: objcopy{{(.exe)?}}" "--extract-dwo" |
| 97 |
// OBJCOPY-NEXT: objcopy{{(.exe)?}}" "--strip-dwo" |
| 98 |
|
| 99 |
/// ... but not for assembly output. |
| 100 |
// RUN: %clang -### -S -target x86_64-unknown-linux-gnu -fno-integrated-as -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=NOOBJCOPY |
| 101 |
// NOOBJCOPY-NOT: objcopy" |
| 102 |
|
| 103 |
/// Interaction with -g0. |
| 104 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g0 -### %s 2>&1 | FileCheck %s --check-prefix=G0 |
| 105 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g0 %s 2>&1 | FileCheck %s --check-prefix=G0 |
| 106 |
// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=G0 |
| 107 |
// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf=single %s 2>&1 | FileCheck %s --check-prefix=G0 |
| 108 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g0 -fsplit-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G0 |
| 109 |
|
| 110 |
// G0-NOT: "-debug-info-kind= |
| 111 |
// G0-NOT: "-split-dwarf- |
| 112 |
|
| 113 |
/// Interaction with -g1 (-gmlt). |
| 114 |
// RUN: %clang -### -S -target x86_64 -gsplit-dwarf -g1 %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT |
| 115 |
// RUN: %clang -### -S -target x86_64 -gsplit-dwarf -g1 -fno-split-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT |
| 116 |
// RUN: %clang -### -S -target x86_64 -gmlt -gsplit-dwarf -fno-split-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT |
| 117 |
|
| 118 |
// G1_WITH_SPLIT: "-debug-info-kind=line-tables-only" |
| 119 |
// G1_WITH_SPLIT: "-split-dwarf-file" |
| 120 |
// G1_WITH_SPLIT: "-split-dwarf-output" |
| 121 |
|
| 122 |
// RUN: %clang -### -S -target x86_64 -gsplit-dwarf -g1 -fsplit-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G1_NOSPLIT |
| 123 |
|
| 124 |
// G1_NOSPLIT: "-debug-info-kind=line-tables-only" |
| 125 |
// G1_NOSPLIT-NOT: "-split-dwarf-file" |
| 126 |
// G1_NOSPLIT-NOT: "-split-dwarf-output" |
| 127 |
|
| 128 |
/// Do not generate -ggnu-pubnames for -glldb |
| 129 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -glldb %s 2>&1 | FileCheck %s --check-prefixes=GLLDBSPLIT |
| 130 |
|
| 131 |
// GLLDBSPLIT-NOT: "-ggnu-pubnames" |
| 132 |
|
| 133 |
/// Generate -ggnu-pubnames for -glldb when it is explicitly enabled |
| 134 |
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -glldb -ggnu-pubnames %s 2>&1 | FileCheck %s --check-prefixes=GLLDBSPLIT2 |
| 135 |
|
| 136 |
// GLLDBSPLIT2: "-ggnu-pubnames" |