Files
nixpkgs/pkgs/servers/sql/postgresql/postgresqlBuildExtension.nix
Sizhe Zhao 29d3586312 postgresqlBuildExtension: remove references in bitcode files
Some extensions compile their JIT bitcode with debug info: postgis
passes autoconf's default CFLAGS ("-g -O2") through PG_CPPFLAGS, and
pg_textsearch hard-codes -g there. The DIFile entries then reference
headers in clang-wrapper, glibc-dev, postgresql-dev and other -dev
outputs, pulling the whole LLVM toolchain into the runtime closure.
Native objects are stripped, but the bitcode is not.

PostgreSQL already runs nuke-refs on its own bitcode, so do the same
for extensions. SQL-only extensions have no lib/, hence the check.

On x86_64-linux with PostgreSQL 18, this shrinks the closure of postgis
from 2.8 GiB to 654 MiB and of pg_textsearch from 2.4 GiB to 40 MiB.
JIT inlining from the processed postgis bitcode was verified to still
work.

Assisted-by: Claude Code (Claude Opus 5.5)
2026-10-17 21:40:04 +08:00

6.4 KiB