Re: abi-compliance-checker

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: abi-compliance-checker
Date: 2023-06-06 16:30:38
Message-ID: 04b85584-8c94-3c33-edcd-e139b23b1c7b@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)GLIBC_2(dot)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.

Attachment Content-Type Size
0001-abidiff-test.patch text/plain 171.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-06-06 16:31:14 Re: Potential us of initialized memory in xlogrecovery.c
Previous Message Heikki Linnakangas 2023-06-06 16:24:11 Re: Let's make PostgreSQL multi-threaded