Re: Compressed debug info sections and big-endian targets

From: Brooks Davis <brooks_at_freebsd.org>
Date: Tue, 10 Aug 2021 20:56:56 UTC
On Sat, Aug 07, 2021 at 12:07:39PM -0400, Ed Maste wrote:
> GCC and Clang/LLVM support coimpressed debug info, which compresses
> the .debug_* ELF sections in objects, archives, libraries, and
> executables. I recently committed build infrastructure changes to turn
> this on (c910570e7573) but it broke the build on big-endian targets
> (mips, powerpc) and so disabled it again (89ed2ecb14ce). PR257638 has
> more details.
> 
> The lld bug is now fixed in main thanks to Simon Atanasyan upstream
> and dim@ for merging it over (d69d07569ee2), and I would like to
> enable it again.

I've committed the fix to devel/llvm12 and will merge to quarterly.
I'll follow up with an update to llvm-devel.  I've not investigated
if it can be merged to older ports.

> An outstanding issue is that the bug is triggered by the linker's
> input, and so this will occur if we attempt to link against a base
> system .a archive using a buggy lld. In the short term I think we have
> no choice but to leave compressed debug disabled on BE targets, until
> fixed lld versions are available in ports/packages.
> 
> I have a review open to enable it for LE targets only:
> https://reviews.freebsd.org/D31454.
> 
> I'd like to apply that change for now, but would like to enable
> compressed debug across all targets in the future. This would break,
> on big-endian targets, any port that has a build-dependency on an
> older lld and links against a base system archive. Such a port could
> be fixed by switching to linking with binutils ld, or lld from the
> base system or a newer package. What do big-endian mips or powerpc
> users think?

I'd be surprised if it was significant for mips given the generally
sorry state of the port.  Might be more exciting for powerpc where X11
works.  (As an aside, I suspect we'll have updated CHERI-LLVM to ~13
before we've caught CheriBSD up to this change and we may even manage to
give mips the boot before then.)

-- Brooks