Page MenuHomeFreeBSD

LinuxKPI: bitcount fix gcc and older llvm builds
ClosedPublic

Authored by bz on Dec 18 2025, 10:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 15, 10:14 PM
Unknown Object (File)
Tue, Jan 13, 8:22 PM
Unknown Object (File)
Thu, Jan 8, 12:28 AM
Unknown Object (File)
Tue, Jan 6, 10:22 AM
Unknown Object (File)
Wed, Dec 31, 3:37 PM
Unknown Object (File)
Wed, Dec 31, 3:25 PM
Unknown Object (File)
Mon, Dec 29, 11:03 PM
Unknown Object (File)
Sat, Dec 27, 7:28 AM
Subscribers

Details

Summary

LLVM before 19 and gcc before 14 do not support builtin_popcountg().
Use
const_bitcount<n> from sys/bitcount.h as a replacement in these
cases. This should still allow drm-kmod to build with size to be known
at compile-time.

Sponsored by: The FreeBSD Foundation
Fixes: 7cbc4d875971, 5e0a4859f28a
MFC after: 3 days
X-MFC: remove sys/modules/Makefile checks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Dec 18 2025, 10:28 PM
bz planned changes to this revision.Dec 18 2025, 10:41 PM

And that makes me find that __const_bitcount<n> is another local change; I'll update this in a minute

Adding @emaste as I found @dumbbell 's version through the stack of local changes you carry.

And for reference; pushing this out was triggered by https://reviews.freebsd.org/D54266

This revision is now accepted and ready to land.Dec 19 2025, 9:55 AM