diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp --- a/clang/lib/Driver/ToolChains/Fuchsia.cpp +++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp @@ -127,6 +127,7 @@ D.getLTOMode() == LTOK_Thin); } + addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c --- a/clang/test/Driver/fuchsia.c +++ b/clang/test/Driver/fuchsia.c @@ -253,6 +253,13 @@ // CHECK-THINLTO: "-plugin-opt=thinlto" // CHECK-THINLTO: "-plugin-opt=jobs=8" +// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \ +// RUN: --sysroot=%S/platform \ +// RUN: -Og -gz 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-GZ +// CHECK-GZ: {{.*}}clang{{.*}}" "--compress-debug-sections=zlib" +// CHECK-GZ: {{.*}}ld.lld{{.*}}" "--compress-debug-sections=zlib" + // RUN: %clang %s -### --target=x86_64-unknown-fuchsia \ // RUN: -gsplit-dwarf -g -c %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF