Re: meson vs. llvm bitcode files
Nazir Bilal Yavuz <byavuz81@gmail.com>
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2025-03-07T10:52:09Z
Lists: pgsql-hackers
Attachments
- v1-0001-meson-Add-generated-header-stamps.patch (text/x-patch) patch v1-0001
- v1-0002-meson-Add-postgresql-extension.pc-for-building-ex.patch (text/x-patch) patch v1-0002
- v1-0003-meson-Test-building-extensions-by-using-postgresq.patch (text/x-patch) patch v1-0003
- v1-0004-meson-WIP-Add-docs-for-postgresql-extension.pc.patch (text/x-patch) patch v1-0004
- v1-0005-meson-Add-LLVM-bitcode-emission.patch (text/x-patch) patch v1-0005
- v1-0006-meson-Generate-bitcode-files-of-contrib-extension.patch (text/x-patch) patch v1-0006
Hi, On Thu, 5 Sept 2024 at 12:24, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote: > > I found that Andres shared a patch > (v17-0021-meson-Add-LLVM-bitcode-emission.patch) a while ago [1]. Andres and I continued to work on that. I think the patches are in sharable state now and I wanted to hear opinions before proceeding further. After applying the patches, bitcode files should be installed into $pkglibdir/bitcode/ directory if the llvm is found. There are 6 patches attached: v1-0001-meson-Add-generated-header-stamps: This patch is trivial. Instead of having targets depending directly on the generated headers, have them depend on a stamp file. The benefit of using a stamp file is that it makes ninja.build smaller and meson setup faster. ---------- v1-0002-meson-Add-postgresql-extension.pc-for-building-extension-libraries: This patch is for generating postgresql-extension.pc file which can be used for building extensions libraries. Normally, there is no need to use this .pc file for generating bitcode files. However, since there is no clear way to get all include paths for building bitcode files, this .pc file is later used for this purpose (by running pkg-config --cflags-only-I postgresql-extension-uninstalled.pc) [1]. ---------- v1-0003-meson-Test-building-extensions-by-using-postgresql-extension.pc: [Not needed for generating bitcode files] This is a patch for testing if extensions can be built by using postgresql-extension.pc. I added that commit as an example of using postgresql-extension.pc to build extensions. ---------- v1-0004-meson-WIP-Add-docs-for-postgresql-extension.pc: [Not needed for generating bitcode files] I added this patch in case we recommend people to use postgresql-extension.pc to build extension libraries. I am not sure if we want to do that because there are still TODOs about postgresql-extension.pc like running test suites. I just wanted to show my plan, dividing 'Extension Building Infrastructure' into two, 'PGXS' and 'postgresql-extension.pc'. ---------- v1-0005-meson-Add-LLVM-bitcode-emission: This patch adds required infrastructure to generate bitcode files and uses postgresql-extension-uninstalled.pc to get include paths for generating bitcode files [1]. ---------- v1-0006-meson-Generate-bitcode-files-of-contrib-extension.patch: This patch adds manually selected contrib libraries to generate their bitcode files. These libraries are selected manually, depending on - If they have SQL callable functions - If the library functions are short enough (the performance gain from bitcode files is too minimal compared to the function's run time, so this type of libraries are omitted). Any kind of feedback would be appreciated. -- Regards, Nazir Bilal Yavuz Microsoft