r360403 - Change -gz and -Wa, --compress-debug-sections to use gABI compression (SHF_COMPRESSED)

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 12:39:41 PDT 2019


Hi Ray,

I've temporarily reverted this here:

echristo at jhereg ~/s/llvm-project> git llvm push
Pushing 1 commit:
  fda79815a33 Temporarily revert "Change -gz and
-Wa,--compress-debug-sections to use gABI compression
(SHF_COMPRESSED)"
Sending        cfe/trunk/docs/ReleaseNotes.rst
Sending        cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Sending        cfe/trunk/tools/driver/cc1as_main.cpp
Transmitting file data ...done
Committing transaction...
Committed revision 360703.
Committed fda79815a33 to svn.

>From my message:

    This affects users of older (pre 2.26) binutils in such a way that
they can't necessarily
    work around it as it doesn't support the compress option on the
command line. Reverting
    to unblock them and we can revisit whether to make this change now
or fix how we want
    to express the option.

I'm not sure what we want to do here, but wanted to unblock people in
the meantime. What do you think?

Thanks!

-eric


On Thu, May 9, 2019 at 7:05 PM Fangrui Song via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: maskray
> Date: Thu May  9 19:08:21 2019
> New Revision: 360403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=360403&view=rev
> Log:
> Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)
>
> Since July 15, 2015 (binutils-gdb commit
> 19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas
> --compress-debug-sections=zlib (gcc -gz) means zlib-gabi:
> SHF_COMPRESSED. Before that it meant zlib-gnu (.zdebug).
>
> clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It
> is 2019 now and it is not unreasonable to assume users of the new
> feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661).
>
> Change clang's default accordingly to improve standard conformance.
> zlib-gnu becomes out of fashion and gets poorer toolchain support.
> Its mangled names confuse tools and are more likely to cause problems.
>
> Reviewed By: compnerd
>
> Differential Revision: https://reviews.llvm.org/D61689
>
> Modified:
>     cfe/trunk/docs/ReleaseNotes.rst
>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>     cfe/trunk/tools/driver/cc1as_main.cpp
>
> Modified: cfe/trunk/docs/ReleaseNotes.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=360403&r1=360402&r2=360403&view=diff
> ==============================================================================
> --- cfe/trunk/docs/ReleaseNotes.rst (original)
> +++ cfe/trunk/docs/ReleaseNotes.rst Thu May  9 19:08:21 2019
> @@ -77,7 +77,10 @@ Modified Compiler Flags
>
>  - `clang -dumpversion` now returns the version of Clang itself.
>
> -- ...
> +- On ELF, ``-gz`` now defaults to ``-gz=zlib``. It produces ``SHF_COMPRESSED``
> +  style compression of debug information. GNU binutils 2.26 or newer, or lld is
> +  required to link produced object files. Use ``-gz=zlib-gnu`` to get the old
> +  behavior.
>
>  New Pragmas in Clang
>  --------------------
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=360403&r1=360402&r2=360403&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May  9 19:08:21 2019
> @@ -1052,8 +1052,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
>    if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections,
>                                       OPT_compress_debug_sections_EQ)) {
>      if (A->getOption().getID() == OPT_compress_debug_sections) {
> -      // TODO: be more clever about the compression type auto-detection
> -      Opts.setCompressDebugSections(llvm::DebugCompressionType::GNU);
> +      Opts.setCompressDebugSections(llvm::DebugCompressionType::Z);
>      } else {
>        auto DCT = llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
>                       .Case("none", llvm::DebugCompressionType::None)
>
> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=360403&r1=360402&r2=360403&view=diff
> ==============================================================================
> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
> +++ cfe/trunk/tools/driver/cc1as_main.cpp Thu May  9 19:08:21 2019
> @@ -221,8 +221,7 @@ bool AssemblerInvocation::CreateFromArgs
>    if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections,
>                                       OPT_compress_debug_sections_EQ)) {
>      if (A->getOption().getID() == OPT_compress_debug_sections) {
> -      // TODO: be more clever about the compression type auto-detection
> -      Opts.CompressDebugSections = llvm::DebugCompressionType::GNU;
> +      Opts.CompressDebugSections = llvm::DebugCompressionType::Z;
>      } else {
>        Opts.CompressDebugSections =
>            llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list