Fix -gz=zlib options for linker
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Tue, 8 Sep 2020 17:45:45 +0000 (13:45 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Fri, 11 Sep 2020 21:12:58 +0000 (17:12 -0400)
commitccb4124a4172bf2cb2e1cd7c253f0f1654fce294
tree8e9cf703a14a620f126f90fc3b1a858b8f9ac40d
parent7dcd0042e8b8581751bd9b915207058d2ab88e1d
Fix -gz=zlib options for linker

gcc translates -gz=zlib to --compress-debug-options=zlib for both assembler and linker
but clang only does this for assembler.

The linker needs --compress-debug-options=zlib option to compress the debug sections
in the generated executable or shared library.

Due to this bug, -gz=zlib has no effect on the generated executable or shared library.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D87321
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/lib/Driver/ToolChains/Gnu.cpp
clang/lib/Driver/ToolChains/HIP.cpp
clang/test/Driver/amdgcn-gz-options.cl [new file with mode: 0644]
clang/test/Driver/compress.c
clang/test/Driver/hip-gz-options.hip [new file with mode: 0644]