On 30.05.23 06:32, Peter Eisentraut wrote:
> I think the way to use this would be to compute the ABI for the .0
> release (or rc1 or something like that) and commit it into the tree. And
> then compute the current ABI and compare that against the recorded base
> ABI.
>
> Here is the workflow:
>
> # build REL_11_0
> abidw src/backend/postgres > src/tools/postgres-abi-REL_11_0.xml
> # build REL_11_20
> abidw src/backend/postgres > src/tools/postgres-abi.xml
> abidiff --no-added-syms src/tools/postgres-abi-REL_11_0.xml
> src/tools/postgres-abi.xml
Here is a demo patch that implements this.
Right now, I have only added support for libpq and postgres. For
completeness, the ecpg libraries should be covered as well.
(Unlike the above example, I did not use src/tools/ but each component's
own subdirectory.)
The patch as currently written will actually fail the tests because it
contains only one base ABI file to compare against, but the build_32
task on cirrus will of course produce a different ABI. But I left it
for now to able to see the results. Eventually, the base ABI file names
should include something from host_system.cpu_family().
Also, I commented out the abidiff test for postgres, because the base
file is 8 MB and I don't want to send that around.
Various findings while playing with these tools:
* Different Linux distributions produce slightly different ABI reports.
In some cases, symbols like 'optarg@GLIBC_2.17' leak out.
* PostgreSQL compilation options affect the exposed ABI. This is
perhaps expected to some degree, but there are some curious details.
* For example, --enable-cassert exposes additional symbols, and it's
maybe not impossible for those to leak into an extension.
* Also, --with-openssl actually *removes* symbols from the ABI (such as
pg_md5_init).
So it's probably not sensible to try to get some universal ABI
definition that works everywhere. Instead, I think it would be better
to get one specific case working, which would be the one tested on the
cirrus linux tasks and/or some equivalent buildfarm machine.