[Bug 253942] clang -gz=zlib does not pass --compress-debug-sections to linker

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Mar 1 17:54:30 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253942

            Bug ID: 253942
           Summary: clang -gz=zlib does not pass --compress-debug-sections
                    to linker
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: emaste at freebsd.org

-gz=zlib compiler flag should enable compressed debug sections. It works as
expected for object files, but does not pass the required flag to the linker to
have them compressed in the final library/binary.

Version:

FreeBSD clang version 11.0.1 (git at github.com:llvm/llvm-project.git
llvmorg-11.0.1-0-g43ff75f2c3fe)

Object file has the 'C' flag:

% cc -c -g -gz=zlib hello.c
% readelf -S hello.o | grep -A1 ' .debug_info'
  [ 6] .debug_info       PROGBITS         0000000000000000  000000c7
       0000000000000055  0000000000000000   C       0     0     8

Linked binary does not have the 'C' flag:

% cc -g -gz=zlib  hello.c -o hello
% readelf -S hello | grep -A1 ' .debug_info'
  [28] .debug_info       PROGBITS         0000000000000000  00001520
       0000000000000a91  0000000000000000           0     0     1

% Using gcc, the linked binary does have 'C' flag:

% gcc10 -g -gz=zlib  hello.c -o hello
% readelf -S hello | grep -A1 ' .debug_info'
  [24] .debug_info       PROGBITS         0000000000000000  0000150a
       00000000000004de  0000000000000000   C       0     0     1

Using -v to see the command line, gcc is automatically adding
`-compress-debug-sections=zlib` to the linker invocation.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list