Re: Preventing abort() and exit() calls in libpq

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jacob Champion <pchampion(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, info(at)cspug(dot)cz
Subject: Re: Preventing abort() and exit() calls in libpq
Date: 2021-06-30 13:46:59
Message-ID: 202106301346.c64ysatd7o5l@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Jun-30, Alvaro Herrera wrote:

> If I remove -fprofile-arcs from CFLAGS, then abort is no longer present,
> but we still get a fail because of __gcov_exit. I suppose if you'd add
> an exception for __cxa_atexit, the same place could use one for
> __gcov_exit.

I tried the attached patch, and while libpq.so now builds successfully,
it causes anything that tries to link to libpq fail like

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -fprofile-arcs -ftest-coverage findtimezone.o initdb.o localtime.o -L../../../src/port -L../../../src/common -L../../../src/fe_utils -lpgfeutils -L../../../src/common -lpgcommon -L../../../src/port -lpgport -L../../../src/interfaces/libpq -lpq -Wl,--as-needed -Wl,-rpath,'/pgsql/install/master-coverage/lib',--enable-new-dtags -lpgcommon -lpgport -lpthread -lxml2 -lssl -lcrypto -lz -lreadline -lpthread -lrt -ldl -lm -o initdb
/usr/bin/ld: initdb: hidden symbol `__gcov_merge_add' in /usr/lib/gcc/x86_64-linux-gnu/8/libgcov.a(_gcov_merge_add.o) is referenced by DSO
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:43: initdb] Error 1

so this doesn't look too promising.

--
Álvaro Herrera Valdivia, Chile
https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-Fix-libpq-build-for-coverage-support.patch text/x-diff 1.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-06-30 13:59:28 Record a Bitmapset of non-pruned partitions
Previous Message Robert Haas 2021-06-30 13:46:41 Re: What is "wraparound failure", really?