Page MenuHomeFreeBSD

By default use compressed debug in standalone userland debug files
ClosedPublic

Authored by emaste on Mar 1 2021, 6:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 8:48 PM
Unknown Object (File)
Mon, Nov 4, 8:43 PM
Unknown Object (File)
Fri, Oct 18, 3:45 PM
Unknown Object (File)
Fri, Oct 18, 10:08 AM
Unknown Object (File)
Thu, Oct 17, 9:45 AM
Unknown Object (File)
Wed, Oct 16, 12:09 AM
Unknown Object (File)
Mon, Oct 14, 6:32 PM
Unknown Object (File)
Oct 11 2024, 6:24 PM
Subscribers

Details

Summary

The compiler supports CFLAGS=-gz=zlib to compress .debug sections in object files, libraries, and binaries. Enable it for standalone debug CFLAGS to reduce disk usage in objdir.

(This should also reduce the size of library/executable debug data in /usr/lib/debug but there is a bug in clang -- PR253942. Once the clang bug is fixed we'll get a bonus size reduction.)

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested review of this revision.Mar 1 2021, 6:49 PM

I suppose this also works with GCC 6 and later as well? (I suspect it does.) If not, we'd need a COMPILER_FEATURE or the like to gate this on. For kernel builds, do we have to change the 'makeoptions' like in GENERIC or can we get by with doing it in some kern.*mk file?

hrmph
x86_64-unknown-freebsd13.0-gcc6: error: -gz is not supported in this configuration

add compressed-debug compiler feature

This comment has been deleted.
share/mk/bsd.compiler.mk
227 ↗(On Diff #84922)

I'm not sure what GCC version added support; we could perhaps just stick it in the block above

For kernel builds, do we have to change the 'makeoptions' like in GENERIC or can we get by with doing it in some kern.*mk file?

Not sure off hand, I'll look at that as a subsequent change.

Add missing bsd.sys.mk change

Yes, this would be very nice to have. But does this improve or worsen link performance? (I'm unsure if we'd need a toggle... yet more toggles)

This revision is now accepted and ready to land.May 19 2021, 5:30 PM
In D29002#681658, @dim wrote:

Yes, this would be very nice to have. But does this improve or worsen link performance? (I'm unsure if we'd need a toggle... yet more toggles)

IMO let's not add a knob for it without a really compelling reason.

This LGTM, though.

In D29002#681658, @dim wrote:

Yes, this would be very nice to have. But does this improve or worsen link performance? (I'm unsure if we'd need a toggle... yet more toggles)

My guess is that it's a small pessimization if we have fast I/O. I'll see about a quick ad-hoc benchmark.

In D29002#681658, @dim wrote:

Yes, this would be very nice to have. But does this improve or worsen link performance? (I'm unsure if we'd need a toggle... yet more toggles)

My guess is that it's a small pessimization if we have fast I/O. I'll see about a quick ad-hoc benchmark.

I had a look at compiling libllvm's X86ISelLowering.o with various flags to see the effect:

FlagsWall ClockFile Size
-gline-tables-only (std)32.888861280
-g39.6227651272
-g -gz39.4115250672
-gline-tables-only -gz34.666677312

And on Cirrus-CI, 28:46 to build 11877MB in /usr/obj without this change, 28:37 10498MB with the change
Before: https://cirrus-ci.com/task/4753310411390976
With change: https://cirrus-ci.com/task/5037492861665280